CVE-2026-9277
shell-quote `quote()` does not validate object-token shapes, allowing command injection via line terminators in `.op`
- State
- Published
- Severity
- 9.2 Critical
- Published
- May 22, 2026
- Updated
- Sep 14, 2026
- Reserved
- May 22, 2026
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`.
Scores
| CVSS | Score | Vector | Source |
|---|---|---|---|
| 4.0 | 9.2 Critical | 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 | harborist |
| 3.1 | 8.1 High | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H | harborist |
| 3.1 | 8.1 High | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H | redhat-SADP |
Weaknesses
Affected Products
| Product | Versions |
|---|---|
shell-quote |
|
References
- GHSA-w7jw-789q-3m8pvendor-advisory
- Fix commitpatch
- https://github.com/ljharb/shell-quoteproduct
- https://www.npmjs.com/package/shell-quoteproduct
- http://www.openwall.com/lists/oss-security/2026/05/23/2
- https://access.redhat.com/security/cve/CVE-2026-9277vdb-entry
- RHBZ#2480741issue-tracking
- https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-9277.json
- https://access.redhat.com/errata/RHSA-2026:28010vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:34342vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:50850vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:36754vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:33574vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:29197vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:41928vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:62410vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:56912vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:56854vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:60023vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:48699vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:40765vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:44263vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:34791vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:44267vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:29834vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:44237vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:29795vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:62260vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:26072vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:26080vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:26077vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:26079vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:26090vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:33683vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:30076vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:42796vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:41066vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:28571vendor-advisory
- https://access.redhat.com/errata/RHSA-2026:26225vendor-advisory
Every record here comes from the CVE Program’s CVE List. © 1999–2026 The MITRE Corporation. CVE is a registered trademark of The MITRE Corporation. The records are reproduced under the CVE Program terms of use.