# CVE-2026-9277: shell-quote \`quote()\` does not validate object-token shapes, allowing command injection via line terminators in \`.op\`

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** CRITICAL 9.2
- **CVSS:** 9.2 (v4.0, CNA) `CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N`
- **CVSS metrics:** Attack vector: Network; Attack complexity: Low; Attack requirements: Present; Privileges required: None; User interaction: None; Confidentiality impact: High; Integrity impact: High; Availability impact: High; Confidentiality impact on other systems: None; Integrity impact on other systems: None; Availability impact on other systems: None
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, no login needed
- **EPSS:** 1.70% (percentile 78, 2026-11-26)
- **CWE:** CWE-78, CWE-77
- **Aliases:** GHSA-w7jw-789q-3m8p
- **Published:** 2026-05-22T13:22:38.873Z
- **Modified:** 2026-09-14T13:19:33.133Z

## Who should check

- Projects that depend on npm package shell-quote (\>= 1.1.0, \< 1.8.4)
- Anyone running shell-quote \>= 1.1.0, \< 1.8.4

## Description

shell-quote's \`quote()\` function did not validate object-token inputs against the operator model used by \`parse()\`. The \`.op\` field was backslash-escaped character by character using \`/(.)/g\`, which in JavaScript does not match line terminators (\\n, \\r, U+2028, U+2029). A line terminator in \`.op\` therefore passed through unescaped into the output; POSIX shells treat a literal newline as a command separator, so any content after it would execute as a second command. The vulnerable code path is reachable in two ways: (1) direct construction of \`{ op: '...\\n...' }\` from external input, and (2) via \`parse(cmd, envFn)\` when \`envFn\` returns object tokens whose \`.op\` is attacker-influenced. Both are documented API surface. Fixed by replacing the per-character escape with strict shape validation: \`.op\` must match the parser's control-operator allowlist; \`{ op: 'glob', pattern }\` validates \`pattern\` and forbids line terminators; \`{ comment }\` validates \`comment\` and forbids line terminators; any other object shape throws \`TypeError\`.

## Affected and fixed versions

- npm `shell-quote`: affected \>= 1.1.0, \< 1.8.4; fixed 1.8.4 (osv)
- shell-quote: \>= 1.1.0, \< 1.8.4 (cvelist)

## Mitigation

- Upgrade shell-quote to 1.8.4 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2026-9277. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2026-9277.md
Affected: shell-quote >= 1.1.0, < 1.8.4
Fixed in: 1.8.4

Steps:
1. Search this machine and project for shell-quote (npm), shell-quote: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2026-9277 being exploited?

There is no confirmed exploitation: CVE-2026-9277 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 1.70% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2026-9277?

Critical: CVSS 9.2 (v4.0, scored by CNA). Remote, no login needed.

### Which versions are affected by CVE-2026-9277?

shell-quote \>= 1.1.0, \< 1.8.4.

### Is there a fix for CVE-2026-9277?

Yes. Fixed in 1.8.4. Upgrade shell-quote to 1.8.4 or later.

### How do I check if I'm affected by CVE-2026-9277?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://github.com/ljharb/shell-quote/security/advisories/GHSA-w7jw-789q-3m8p>
- vendor: <https://access.redhat.com/errata/RHSA-2026:28010>
- vendor: <https://access.redhat.com/errata/RHSA-2026:34342>
- vendor: <https://access.redhat.com/errata/RHSA-2026:50850>
- vendor: <https://access.redhat.com/errata/RHSA-2026:36754>
- vendor: <https://access.redhat.com/errata/RHSA-2026:33574>
- vendor: <https://access.redhat.com/errata/RHSA-2026:29197>
- vendor: <https://access.redhat.com/errata/RHSA-2026:41928>
- vendor: <https://access.redhat.com/errata/RHSA-2026:62410>
- vendor: <https://access.redhat.com/errata/RHSA-2026:56912>
- vendor: <https://access.redhat.com/errata/RHSA-2026:56854>
- vendor: <https://access.redhat.com/errata/RHSA-2026:60023>
- vendor: <https://access.redhat.com/errata/RHSA-2026:48699>
- vendor: <https://access.redhat.com/errata/RHSA-2026:40765>
- vendor: <https://access.redhat.com/errata/RHSA-2026:44263>
- vendor: <https://access.redhat.com/errata/RHSA-2026:34791>
- vendor: <https://access.redhat.com/errata/RHSA-2026:44267>
- vendor: <https://access.redhat.com/errata/RHSA-2026:29834>
- vendor: <https://access.redhat.com/errata/RHSA-2026:44237>
- vendor: <https://access.redhat.com/errata/RHSA-2026:29795>
- vendor: <https://access.redhat.com/errata/RHSA-2026:62260>
- vendor: <https://access.redhat.com/errata/RHSA-2026:26072>
- vendor: <https://access.redhat.com/errata/RHSA-2026:26080>
- vendor: <https://access.redhat.com/errata/RHSA-2026:26077>
- vendor: <https://access.redhat.com/errata/RHSA-2026:26079>
- vendor: <https://access.redhat.com/errata/RHSA-2026:26090>
- vendor: <https://access.redhat.com/errata/RHSA-2026:33683>
- vendor: <https://access.redhat.com/errata/RHSA-2026:30076>
- vendor: <https://access.redhat.com/errata/RHSA-2026:42796>
- vendor: <https://access.redhat.com/errata/RHSA-2026:41066>
- vendor: <https://access.redhat.com/errata/RHSA-2026:28571>
- vendor: <https://access.redhat.com/errata/RHSA-2026:26225>
- vendor: <https://nvd.nist.gov/vuln/detail/CVE-2026-9277>
- patch: <https://github.com/ljharb/shell-quote/commit/1518179>
- other: <https://github.com/ljharb/shell-quote>
- other: <https://www.npmjs.com/package/shell-quote>
- other: <http://www.openwall.com/lists/oss-security/2026/05/23/2>
- other: <https://access.redhat.com/security/cve/CVE-2026-9277>
- other: <https://bugzilla.redhat.com/show_bug.cgi?id=2480741>
- other: <https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-9277.json>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2026-9277>
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GHSA-w7jw-789q-3m8p> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/CVE-2026-9277> · JSON: <https://flawdb.com/api/v1/entries/CVE-2026-9277>
