CVE-2026-9277
High · 8.1CVSS
8.1
EPSS
0.8%
Published
May 22, 2026
CISA due date
—
Cloudanix analysis
A software component used to build system commands can let specially crafted input run an extra command on the server.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- Moderate
- Impact
- Remote Code Execution
- Component
- Library
- Class
- Command Injection
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
The flaw is a command injection vulnerability in the shell-quote library's quote() handling of object tokens. When an object token contains an attacker-controlled .op value with a line terminator such as \n, \r, U+2028, or U+2029, the escaping logic fails to escape that separator. If the resulting quoted string is passed to a POSIX shell, the shell interprets the embedded newline as a command separator, allowing attacker-supplied content after the newline to execute as an additional command. The vulnerable path can be reached either by directly constructing object tokens from external input or by using parse(cmd, envFn) where envFn returns attacker-influenced object tokens.
Why it matters to the business
Applications that use shell-quote to construct shell commands from untrusted or semi-trusted input may allow remote attackers to execute arbitrary operating-system commands with the privileges of the affected application. Successful exploitation could lead to data theft, service disruption, credential exposure, lateral movement, or full compromise of the application host. Although this issue is not currently listed in CISA KEV, is not known to be used in ransomware campaigns, has low EPSS probability, and has no public exploit maturity reported, it has been public for 79 days and affects a common command-construction pattern, so exposed uses should still be prioritized for review and remediation.
How an attack unfolds
An attacker first identifies an application feature that accepts input later incorporated into shell-quote object tokens, or into parse(cmd, envFn) where envFn returns object tokens. The attacker supplies a crafted operator-like value containing a literal line terminator followed by a second shell command. The vulnerable quote() implementation escapes ordinary characters in .op but fails to escape line terminators, leaving the newline intact in the generated command string. When the application passes that string to a POSIX shell, the shell treats the newline as a command boundary and executes the attacker's trailing command. The attacker can then use the execution context of the application to read files, modify data, run network utilities, download payloads, or establish persistence, depending on host permissions and surrounding controls.
How to fix it
Upgrade shell-quote to a patched version that validates object token shapes and restricts .op to the parser's allowed control operators. If exact package-level fixed versions are not available in the advisory data, use the latest non-vulnerable release published by the package maintainer and regenerate lockfiles so transitive dependencies are updated. Review all uses of quote(), parse(cmd, envFn), and any wrapper code that creates shell-quote object tokens from external input. Do not pass untrusted input into shell operators, command separators, comments, or glob object tokens. Prefer APIs that avoid shell interpretation entirely, such as spawn/execFile with argument arrays, and enforce allowlists for permitted commands and arguments. As interim mitigation, reject or normalize line terminators in any data that may flow into shell-quote object tokens, especially .op, glob pattern, and comment fields, and avoid executing generated strings through a shell.
How to confirm the fix worked
Confirm package inventories, lockfiles, container images, and deployed artifacts no longer include vulnerable shell-quote versions. Use dependency scanners such as npm audit, osv-scanner, SCA tooling, or package-lock/yarn.lock/pnpm-lock inspection to identify remaining vulnerable copies, including transitive dependencies. Add regression tests that attempt to quote object tokens containing \n, \r, U+2028, and U+2029 in .op, glob pattern, and comment fields and verify that patched behavior throws or rejects the input rather than producing a shell command containing a literal command separator. Review source code for direct construction of shell-quote object tokens from request parameters, message payloads, configuration values, environment-derived values, or template variables. In runtime validation, confirm application functionality no longer executes attacker-controlled content after embedded line terminators.
Typical attack path
- Find an application endpoint, job runner, build tool, automation feature, or API that uses shell-quote to build shell commands from external input.
- Determine whether attacker-controlled input can become an object token .op value or can influence an envFn return value used by parse(cmd, envFn).
- Submit a crafted value containing a literal line terminator followed by a shell command.
- Trigger the application path that calls quote() and then executes the resulting command through a POSIX shell.
- Rely on the shell interpreting the newline as a command separator, causing the injected command to run.
- Use the resulting command execution to access files, alter application state, exfiltrate secrets, deploy additional tooling, or pivot within the environment.
How to detect it
There are no universal network indicators for this library-level vulnerability; detection depends on how an application uses shell-quote and how command execution is logged. Review application logs, API request logs, job execution logs, shell audit logs, EDR telemetry, and process creation events for inputs or command lines containing literal line breaks in values that later become shell operators or command fragments. Look for unexpected child processes spawned by Node.js or application worker processes, especially shells such as sh, bash, dash, or zsh launching secondary utilities. Investigate command lines containing newline-separated commands, command chaining, outbound download utilities, file reads of sensitive locations, reverse-shell patterns, or unexpected writes to temporary directories. If parse(cmd, envFn) is used, instrument or review envFn return values for object tokens with attacker-controlled op, glob pattern, or comment fields. For forensic review, correlate suspicious requests containing encoded or literal line terminators with subsequent process creation, outbound network connections, file modifications, authentication events, and crashes. Threat actor-specific indicators are not currently reported for this CVE, and exploit maturity is listed as none, so behavioral detection is more reliable than IOC-only matching.
What your security team should do
- Inventory all applications and build/runtime images that include shell-quote, including transitive dependency paths.
- Prioritize remediation for internet-facing services, CI/CD systems, automation platforms, file-processing services, and any workload that constructs shell commands from user-controlled input.
- Upgrade to a patched shell-quote release and rebuild/redeploy affected artifacts; do not rely only on source repository updates.
- Search code for quote(), parse(cmd, envFn), object tokens containing op, glob, pattern, or comment fields, and any hand-built shell command strings.
- Replace shell string execution with argument-array process execution where practical, and apply strict allowlists for commands and arguments.
- Add input validation that rejects literal line terminators in values that can reach shell command construction.
- Review logs and endpoint telemetry for suspicious child processes spawned by affected applications since publication, especially where command lines contain unexpected line breaks or chained shell commands.
- Because this is not KEV-listed and has low EPSS with no reported exploit maturity, treat it as high-impact but exposure-dependent: urgently patch confirmed command-execution paths and schedule broader dependency cleanup for non-exposed uses.
The record
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 packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| npm | shell-quote | 1.1.0 | 1.8.4 |
| openSUSE:Leap 16.0 | agama-web-ui | 0 | 17+612.d8bf69336-160000.11.1 |
| openSUSE:Tumbleweed | agama-web-ui | 0 | 21+360.16caae772-44.1 |
| openSUSE:Tumbleweed | python-pytest-html | 0 | 4.2.0-2.1 |
Related vulnerabilities
- GHSA-w7jw-789q-3m8p shell-quote quote() does not escape newlines in object .op values Same vulnerability
- CVE-2021-42740 The shell-quote package before 1.7.3 for Node.js allows command injection. Also affects shell-quote
- CVE-2026-42264 Axios is a promise based HTTP client for the browser and Node.js. Also affects agama-web-ui
- CVE-2026-42041 Axios is a promise based HTTP client for the browser and Node.js. Also affects agama-web-ui
- CVE-2025-7339 on-headers is a node.js middleware for listening to when a response writes headers. Also affects agama-web-ui
- CVE-2026-34077 React Router is a router for React. Also affects agama-web-ui
- CVE-2026-6402 webpack-dev-server versions up to and including 5.2.3 are vulnerable to cross-origin… Also affects agama-web-ui
- CVE-2026-13311 shell-quote prior to 1.8.5 finalizes parsed tokens in parse() using… Also affects python-pytest-html