Skip to main content
EPSS 0.8%top 44%

CVE-2026-9277: CWE-78 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in shell-quote

0
High
VulnerabilityCVE-2026-9277cvecve-2026-9277cwe-78cwe-77
Published: 05/22/2026 (05/22/2026, 13:22:38 UTC)
Source: CVE Database V5
Product: shell-quote

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

CVSS v3.1

Score 8.1high

Attack Vector
Network
Attack Complexity
High
Privileges Required
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

Affected software

shell-quote

Affected versions
>=1.1.0 <1.8.4
shell-quote
pkg:npm/shell-quote
Affected versions
=1.1.0
shell-quote
pkg:npm/shell-quote
Affected versions
>=1.1.0 <1.8.4

Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 08/14/2026, 14:44:01 UTC

Technical Analysis

The shell-quote library's quote() function failed to properly neutralize special elements used in OS commands, specifically line terminators in the .op field of object tokens. The original escaping method did not cover line terminators, which POSIX shells treat as command separators, enabling command injection. The vulnerability can be triggered either by directly constructing tokens with malicious .op values containing line terminators or indirectly via the parse() function when an environment function returns attacker-influenced tokens. The issue was fixed by replacing per-character escaping with strict shape validation, ensuring .op matches a control-operator allowlist and forbidding line terminators in patterns and comments.

Potential Impact

An attacker can exploit this vulnerability to execute arbitrary operating system commands remotely without authentication, potentially leading to full system compromise. The vulnerability impacts confidentiality, integrity, and availability by allowing unauthorized code execution, data modification, and denial of service. Because the commands execute with the privileges of the vulnerable application, malicious actions may appear to originate from the application or its owner.

Mitigation Recommendations

An official fix is available and has been released that enforces strict validation of the .op field and forbids line terminators in tokens. Users should upgrade to the fixed version of shell-quote. The Red Hat advisory confirms the availability of a security update addressing this issue. No additional mitigations are specified beyond applying the official patch.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Data Version
5.2
Assigner Short Name
harborist
Date Reserved
2026-05-22T12:13:25.893Z
Cvss Version
3.1
State
PUBLISHED
Vendor Advisory Urls
[{"url":"https://access.redhat.com/security/cve/CVE-2026-9277","vendor":"Red Hat"},{"url":"https://access.redhat.com/errata/RHSA-2026:28010","vendor":"Red Hat"},{"url":"https://access.redhat.com/errata/RHSA-2026:26234","vendor":"Red Hat"},{"url":"https://access.redhat.com/errata/RHSA-2026:29197","vendor":"Red Hat"},{"url":"https://access.redhat.com/errata/RHSA-2026:26072","vendor":"Red Hat"},{"url":"https://access.redhat.com/errata/RHSA-2026:26080","vendor":"Red Hat"},{"url":"https://access.redhat.com/errata/RHSA-2026:26077","vendor":"Red Hat"},{"url":"https://access.redhat.com/errata/RHSA-2026:26079","vendor":"Red Hat"},{"url":"https://access.redhat.com/errata/RHSA-2026:26090","vendor":"Red Hat"},{"url":"https://access.redhat.com/errata/RHSA-2026:30076","vendor":"Red Hat"},{"url":"https://access.redhat.com/errata/RHSA-2026:28571","vendor":"Red Hat"},{"url":"https://access.redhat.com/errata/RHSA-2026:26225","vendor":"Red Hat"}]

Threat ID: 6a105dd3e1370fbb48fef13b

Added to database: 05/22/2026, 13:44:51 UTC

Last enriched: 08/14/2026, 14:44:01 UTC

Last updated: 09/14/2026, 22:11:26 UTC

Views: 139

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Need more coverage?

Upgrade to Pro Console for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses