Vulnerability · Published May 22, 2026 · Assigned by harborist

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

High 8.1

In plain English

A high-severity OS command injection in shell-quote. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.8% (higher than 57% of all known vulnerabilities). Ready-made attack tooling exists: public proof-of-concept code. Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)8.1High
Exploit odds (30 days)0.8%top 43.5% of all CVEs
Exploited in the wildNo reportsCISA SSVC: none
Attack tooling1Public PoC

Official 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 packages & fixed versions

EcosystemPackageFixed inAdvisory
Debian:12node-shell-quote1.7.4+~1.7.1-1+deb12u1DEBIAN-CVE-2026-9277
Debian:13node-shell-quote1.7.4+~1.7.1-1+deb13u1DEBIAN-CVE-2026-9277
Debian:14node-shell-quote1.8.4+~1.7.5-1DEBIAN-CVE-2026-9277
Ubuntu:24.04:LTSnode-shell-quote1.7.4+~1.7.1-1ubuntu0.24.04.1UBUNTU-CVE-2026-9277
Ubuntu:25.10node-shell-quote1.7.4+~1.7.1-1ubuntu0.25.10.1UBUNTU-CVE-2026-9277
Ubuntu:26.10node-shell-quoteno fix listedUBUNTU-CVE-2026-9277
npmshell-quote1.8.4GHSA-w7jw-789q-3m8p

Affected products (as reported)

VendorProductVersions
shell-quote 1.1.0 – before 1.8.4

Weakness: CWE-78, CWE-77 · Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H

References