CVE-2026-9277
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 Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
shell-quotenpm | >= 1.1.0, < 1.8.4 | 1.8.4 |
Affected products
12- osv-coords11 versionspkg:apk/chainguard/arangodb-3.12pkg:apk/chainguard/code-serverpkg:apk/chainguard/langfuse-2-workerpkg:apk/chainguard/tileserver-glpkg:apk/chainguard/tileserver-gl-fipspkg:apk/wolfi/code-serverpkg:apk/wolfi/tileserver-glpkg:npm/shell-quotepkg:rpm/opensuse/agama-web-ui&distro=openSUSE%20Leap%2016.0pkg:rpm/opensuse/agama-web-ui&distro=openSUSE%20Tumbleweedpkg:rpm/opensuse/python-pytest-html&distro=openSUSE%20Tumbleweed
< 3.12.9.4-r2+ 10 more
- (no CPE)range: < 3.12.9.4-r2
- (no CPE)range: < 4.123.0-r2
- (no CPE)range: < 2.95.12-r28
- (no CPE)range: < 5.6.0-r5
- (no CPE)range: < 5.6.0-r4
- (no CPE)range: < 4.123.0-r2
- (no CPE)range: < 5.6.0-r5
- (no CPE)range: >= 1.1.0, < 1.8.4
- (no CPE)range: < 17+612.d8bf69336-160000.11.1
- (no CPE)range: < 21+360.16caae772-44.1
- (no CPE)range: < 4.2.0-2.1
Patches
Vulnerability mechanics
References
6- github.com/advisories/GHSA-w7jw-789q-3m8pghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2026-9277ghsaADVISORY
- www.openwall.com/lists/oss-security/2026/05/23/2nvdWEB
- github.com/ljharb/shell-quote/commit/1518179nvdWEB
- github.com/ljharb/shell-quote/security/advisories/GHSA-w7jw-789q-3m8pnvdWEB
- www.npmjs.com/package/shell-quotenvdWEB
News mentions
0No linked articles in our index yet.