CVE-2026-9277: CWE-78 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in shell-quote
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`.
AI Analysis
Technical Summary
The shell-quote library version 1.1.0 contains an OS command injection vulnerability (CVE-2026-9277) due to improper neutralization of special elements in the quote() function. Specifically, the function escapes characters in the .op field using a regex that does not match line terminators, allowing newline characters to pass unescaped. Since POSIX shells treat newlines as command separators, this enables injection of additional commands. The vulnerability can be exploited by crafting object tokens with malicious .op fields or by influencing the environment function passed to parse(). The fix involves replacing per-character escaping with strict validation that enforces an allowlist of control operators and forbids line terminators in patterns and comments. No patch or official remediation guidance is currently available.
Potential Impact
Successful exploitation of this vulnerability allows an attacker to execute arbitrary OS commands by injecting newline characters that separate commands in shell execution contexts. This can lead to full compromise of the affected system, including confidentiality, integrity, and availability impacts. The CVSS v3.1 base score is 8.1, reflecting high impact on confidentiality, integrity, and availability with network attack vector and no privileges or user interaction required.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. Until an official fix is released, avoid passing untrusted input to the shell-quote library's quote() or parse() functions, especially in contexts where .op fields can be influenced. Consider implementing input validation to reject tokens containing line terminators or avoid using affected versions of shell-quote. Monitor vendor channels for updates and apply official patches once available.
CVE-2026-9277: CWE-78 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in shell-quote
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`.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The shell-quote library version 1.1.0 contains an OS command injection vulnerability (CVE-2026-9277) due to improper neutralization of special elements in the quote() function. Specifically, the function escapes characters in the .op field using a regex that does not match line terminators, allowing newline characters to pass unescaped. Since POSIX shells treat newlines as command separators, this enables injection of additional commands. The vulnerability can be exploited by crafting object tokens with malicious .op fields or by influencing the environment function passed to parse(). The fix involves replacing per-character escaping with strict validation that enforces an allowlist of control operators and forbids line terminators in patterns and comments. No patch or official remediation guidance is currently available.
Potential Impact
Successful exploitation of this vulnerability allows an attacker to execute arbitrary OS commands by injecting newline characters that separate commands in shell execution contexts. This can lead to full compromise of the affected system, including confidentiality, integrity, and availability impacts. The CVSS v3.1 base score is 8.1, reflecting high impact on confidentiality, integrity, and availability with network attack vector and no privileges or user interaction required.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. Until an official fix is released, avoid passing untrusted input to the shell-quote library's quote() or parse() functions, especially in contexts where .op fields can be influenced. Consider implementing input validation to reject tokens containing line terminators or avoid using affected versions of shell-quote. Monitor vendor channels for updates and apply official patches once available.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- harborist
- Date Reserved
- 2026-05-22T12:13:25.893Z
- Cvss Version
- 3.1
- State
- PUBLISHED
- Remediation Level
- null
Threat ID: 6a105dd3e1370fbb48fef13b
Added to database: 5/22/2026, 1:44:51 PM
Last enriched: 5/22/2026, 1:59:53 PM
Last updated: 5/22/2026, 4:43:57 PM
Views: 6
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.