Command InjectionWeakness · CWE-77

CVE-2026-9277

HIGH · 8.1 CVSS v3.1 Published 2026-05-22
Patch available
A vendor patch is available. No clean upgrade release — apply the published patch.
See remediation →
90/100
Remediation priority · Urgent
Remotely reachable No privileges Zero-click Patch available

Official description Straight from the sourceThe vendor's or NVD's own wording, published unedited. Authoritative, but often terse — it says what broke, rarely what to do.

NVD · unedited
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`.

Technical summary Written by usOur analysis, written from the advisory, the CVSS vector and the affected-version data. It adds context the advisory leaves out, and never invents facts that are not in the source.

dbcve analysis · high confidence

The shell-quote library's quote() function fails to validate object-token inputs against the operator model used by parse(). The per-character backslash escaping regex /(.)/g does not match JavaScript line terminators (\n, \r, U+2028, U+2029), allowing line terminators in the .op field to pass through unescaped. Since POSIX shells treat literal newlines as command separators, content after an unescaped newline executes as a second command, enabling command injection.

MitigationUpgrade to a version with the fix that implements strict shape validation: control-operator allowlisting for .op, pattern validation forbidding line terminators for glob/comment objects, and TypeError for unrecognized shapes. If upgrade is not possible, ensure no external input can populate the .op field of object tokens passed to quote().

Verify against the referenced sources before acting — the references below are authoritative for this CVE, this summary is not.

CVSS breakdown How the score is builtThe industry scoring standard. It rates how the flaw is reached, what it takes to exploit, and what an attacker gains — the score is derived from those, not the other way round.

From the vector
Attack vector
Network
Complexity
High
Privileges
None
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H

Am I affected? How to checkSteps we derive from the advisory and the affected-version data, so you can decide whether this CVE reaches your setup. They are a guide, not a scan — your own configuration is the authority.

dbcve checks

Work through these to decide whether this CVE applies to you.

  1. Locate shell-quote in your project dependencies
    Search your package.json or run 'npm ls shell-quote' to identify if shell-quote is installed as a direct or transitive dependency
    Affected if shell-quote is present in the dependency tree and uses the quote() function with object tokens
  2. Identify the installed version
    Run 'npm list shell-quote' or check the version field in node_modules/shell-quote/package.json
    Affected if the version is unknown or earlier than the patched release that addresses line terminator escaping
  3. Audit quote() function usage with object tokens
    Search your codebase for calls to the quote() function and inspect whether object tokens containing an .op (operator) field are passed to it, especially from external or user-controlled input
    Affected if code passes object tokens with .op fields derived from external input to the quote() function
  4. Inspect parse() function for custom envFn callbacks
    Search for invocations of parse() that include a custom envFn callback parameter, which can introduce object tokens into the parsing process
    Affected if a custom envFn is used and it generates object tokens from untrusted sources
  5. Check for external input in object token construction
    Trace data flow from HTTP requests, CLI arguments, environment variables, or file reads to see if any flow into code that creates object tokens with .op fields for shell-quote
    Affected if external input reaches object token .op fields without sanitization

You are affected if shell-quote is installed, its version lacks the line terminator fix, and your code passes object tokens with .op fields (especially from external input) to the quote() function or uses custom envFn callbacks that introduce untrusted object tokens.

Generated from the published advisory. Verify against your own configuration.

Check your environment

Paste your version and any relevant configuration and it will be compared against the affected criteria above. Do not include secrets or credentials.

AI-assisted, checked against the advisory. Informational, not a guarantee.

Remediation Closing itWhat it takes to close this. Where a vendor fix exists we point at it; where none exists we say so plainly, and can build one. Effort estimates are scoped from the advisory, not from your codebase.

dbcve · scoped
Patch available Apply the vendor patch
Vendor patch github.com →
Interim mitigation

Upgrade to a version with the fix that implements strict shape validation: control-operator allowlisting for .op, pattern validation forbidding line terminators for glob/comment objects, and TypeError for unrecognized shapes. If upgrade is not possible, ensure no external input can populate the .op field of object tokens passed to quote().

Recommended fix Moderate confidence

Latest stable version that includes the fix from commit 1518179 (verify via npm or GitHub releases)

  1. Check your project's dependency on shell-quote using `npm list shell-quote` or reviewing package.json
  2. Identify the current version and compare against the fixed version that includes commit 1518179
  3. Run `npm install shell-quote@latest` or `npm update shell-quote` to upgrade to the patched version
  4. After upgrade, verify the version change with `npm list shell-quote`
  5. Test that your shell-quote integration still functions correctly, as the fix adds strict shape validation that throws TypeError for unexpected object shapes
Caveat The fix adds strict validation that throws TypeError for object tokens not matching the documented operator/glob/comment shapes - code relying on undocumented object structures may need adjustment

Generated from the published advisory — verify against the referenced sources before acting.

Have this fixed Scoped from the published advisory
  • Consultation3.0 h
  • Implementation5.0 h
  • Testing5.0 h
  • Review / QA3.0 h
16.0 hours of engineering $2,790
Get the patch applied

An estimate, not a bill — we confirm scope with you before any work starts. Need it this week? Rush from $4,464.

Scan for this in your stack

Free · runs locally
dbcve dependency scanner

Check whether your project pulls in CVE-2026-9277 — or any other known-vulnerable package — straight from your lock files. Free and open source; it runs locally and uploads nothing.

References Go to the primary sourcePrimary sources — vendor advisories, patches and trackers. Where our summary and a reference disagree, the reference wins.

Primary sources

Practitioner notes

Contributed

Peer-ranked notes from engineers who’ve handled CVE-2026-9277 in production — separate from our analysis above.

No notes yet

Be the first to add a field note for this CVE — a mitigation you’ve verified, a version caveat, or a link to a working fix. Sign in above to contribute.

What this is

A place for practitioners to share what actually worked: a mitigation you’ve tested, a configuration change, a version- or environment-specific caveat, or a link to a verified patch. The most useful notes rise to the top as peers upvote them, so the signal stays high.

What belongs here
  • Verified mitigations, workarounds, and config changes
  • Version or environment caveats, and links to real fixes
  • No weaponised exploit code, or anything meant to cause harm
  • No spam, self-promotion, credentials, or personal data