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

> Attackers can execute arbitrary commands by injecting line terminators into object tokens passed to the shell-quote library's quote function.

- **Severity:** Critical 9.2 (`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`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 22 May 2026
- **Updated:** 14 Sep 2026
- **Also known as:** CLEANSTART-2026-GD45765, CLEANSTART-2026-GJ43492, CLEANSTART-2026-JC29454, CLSA-2026-1783558964, CLSA-2026-1791359284, DEBIAN-CVE-2026-9277, ECHO-9c06-21c4-eee8, GHSA-w7jw-789q-3m8p, MINI-2x58-rc8x-33wh, MINI-9q99-vmjw-hjxw, MINI-c98h-4vqh-8jrm, MINI-h7gc-2ggj-f75c, MINI-hg4r-84vf-w9rp, MINI-hxw3-vjgf-fc35, MINI-m2r9-43xq-wxjm, MINI-pv2p-ccv3-ghf3, MINI-v87r-r2cf-c3x3, MINI-xm3j-wxgp-w468, ROOT-APP-NPM-CVE-2026-9277, UBUNTU-CVE-2026-9277, openSUSE-SU-2026:10861-1, openSUSE-SU-2026:20839-1

## What is CVE-2026-9277?

CVE-2026-9277 is a critical command injection vulnerability in shell-quote, published on 22 May 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### 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`.

Weakness: CWE-78 (Improper Neutralization of Special Elements used in an OS Command), CWE-77 (Improper Neutralization of Special Elements used in a Command)

## Which versions are affected by CVE-2026-9277?

2 open source packages ship an affected version, including shell-quote.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `shell-quote` | npm | From 1.1.0 | 1.8.4 |
| `shell-quote` | npm | From 1.1.0 | 1.8.4 |
| `python-pytest-html` | openSUSE:Tumbleweed | All versions | 4.2.0-2.1 |

## How do I fix CVE-2026-9277?

Upgrade shell-quote to 1.8.4 or later.

## Is CVE-2026-9277 being exploited?

There is no known exploitation of CVE-2026-9277 in the wild and no public exploit code.

Public exploit code:

- https://github.com/DylanZahedi/CVE-2026-9277 (github_poc): https://github.com/DylanZahedi/CVE-2026-9277

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-9277 and fix it if it is affected.

What it is: CVE-2026-9277 is a critical command injection vulnerability in shell-quote, published on 22 May 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2026-9277 in the wild and no public exploit code.

Affected packages and fixed versions:
- shell-quote (npm): affected from 1.1.0; fixed in 1.8.4
- shell-quote (npm): affected from 1.1.0; fixed in 1.8.4

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-9277/ (Markdown: https://insights.sbomify.com/CVE-2026-9277/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-9277
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-9277
- OSV: https://osv.dev/vulnerability/CVE-2026-9277

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-9277/
Summaries are generated and may contain mistakes; the official description above is the record.
