Vulnerabilities in pkg:npm/shell-quote

PACKAGE
Advisory Identifier: GHSA-pqg4-j6r4-53mv
Advisory Summary

CVE-2026-102422 is a CRITICAL (CVSS 8.1) `quote()` command injection vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting shell-quote libraries in the npm ecosystem. The issue involves `quote()` command injection via a line terminator in a token after a `{ comment }` token. Remediation is available by upgrading affected packages to version 1.11.0.

5 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/shell-quote

5 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/shell-quote. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-pqg4-j6r4-53mv CVE-2026-102422 CRITICAL shell-quote: `quote()` command injection via a line terminator in a token after a `{ comment }` token
GHSA-395f-4hp3-45gv CVE-2026-13311 HIGH shell-quote: Quadratic-complexity Denial of Service in `parse()` (CWE-407)
GHSA-w7jw-789q-3m8p CVE-2026-9277 CRITICAL shell-quote quote() does not escape newlines in object .op values
GHSA-g4rg-993r-mgx7 CVE-2021-42740 CRITICAL Improper Neutralization of Special Elements used in a Command in Shell-quote
GHSA-qg8p-v9q4-gh34 CVE-2016-10541 CRITICAL Potential Command Injection in shell-quote

CVE-2026-102422 at a Glance

CVE Identifier CVE-2026-102422
GHSA Identifier GHSA-pqg4-j6r4-53mv
Severity CRITICAL
CVSS v3.1 Base Score 8.1
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product shell-quote
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-102422

To remediate this vulnerability, upgrade all affected shell-quote dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

shell-quote fixed: 1.11.0
npm install shell-quote@1.11.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls shell-quote

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-102422, inspect your project dependencies using npm:

npm ls shell-quote

Analyze the terminal output to locate any version of shell-quote in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.11.0), your application is affected.

Note: The npm ls shell-quote command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In shell-quote, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact `quote()` emits a `{ comment }` token as `#` followed by its text, which comments out the rest of the shell line, including the opening quote of any later string token. A line terminator in that later string ends the comment, and the rest of the string is parsed as shell input: ```js quote(['echo', 'ok', { comment: 'x' }, 'a\nid;#']); // echo ok #x 'a // id;#' ``` Passed to `sh`, `bash`, `dash`, `ksh`, or `zsh`, this runs `id`. `parse()` emits a comment token for a `#` in the middle of a word (for example `http://example.com/#frag`), so callers that combine `parse()` output with another untrusted string, such as `quote(parse(untrustedCommand).concat(untrustedArg))`, are affected. The fix for CVE-2026-9277 rejected line terminators in the comment's own text, but not in the tokens after it. Exploitation requires an attacker-controlled string containing a line terminator that follows a `{ comment }` token in the same `quote()` call. ### Patches Fixed in v1.11.0: `quote()` throws a `TypeError` when a string after a `{ comment }` token contains a line terminator (`\n`, `\r`, U+2028, or U+2029). ### Workarounds Drop every token after a `{ comment }` token before calling `quote()`, or reject line terminators in untrusted strings. Separately, do not append other shell text after `quote()` output that contains a comment, since the comment swallows it.

CVE-2026-102422 Affected shell-quote Versions

1 component(s)
Fixed Versions:
1.11.0
Product / Package Ecosystem Affected Versions Fixed Version
shell-quote
npm
≥ 1.8.4
< 1.11.0
1.11.0

References

Frequently Asked Questions

What is CVE-2026-102422?
CVE-2026-102422 is a security vulnerability in shell-quote involving `quote()` command injection via a line terminator in a token after a `{ comment }` token under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which shell-quote versions are affected?
Affected versions include releases prior to 1.11.0 across affected packages: shell-quote.
What version fixes CVE-2026-102422?
Upgrading to 1.11.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is shell-quote affected?
Yes, shell-quote is affected in releases prior to 1.11.0. Upgrade your dependency to 1.11.0 or later.
What is the CVSS score of CVE-2026-102422?
CVE-2026-102422 has a CVSS v3.1 base score of 8.1 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2026-102422?
CVE-2026-102422 is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.).
How can I check npm dependencies for CVE-2026-102422?
Run the dependency tree command: 'npm ls shell-quote'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-pqg4-j6r4-53mv",
  "modified" : "2026-10-06T13:40:36Z",
  "published" : "2026-10-06T13:40:36Z",
  "aliases" : [ "CVE-2026-102422" ],
  "summary" : "shell-quote: `quote()` command injection via a line terminator in a token after a `{ comment }` token",
  "details" : "### Impact\n\n`quote()` emits a `{ comment }` token as `#` followed by its text, which comments out the rest of the shell line, including the opening quote of any later string token. A line terminator in that later string ends the comment, and the rest of the string is parsed as shell input:\n\n```js\nquote(['echo', 'ok', { comment: 'x' }, 'a\\nid;#']);\n// echo ok #x 'a\n// id;#'\n```\n\nPassed to `sh`, `bash`, `dash`, `ksh`, or `zsh`, this runs `id`.\n\n`parse()` emits a comment token for a `#` in the middle of a word (for example `http://example.com/#frag`), so callers that combine `parse()` output with another untrusted string, such as `quote(parse(untrustedCommand).concat(untrustedArg))`, are affected. The fix for CVE-2026-9277 rejected line terminators in the comment's own text, but not in the tokens after it.\n\nExploitation requires an attacker-controlled string containing a line terminator that follows a `{ comment }` token in the same `quote()` call.\n\n### Patches\n\nFixed in v1.11.0: `quote()` throws a `TypeError` when a string after a `{ comment }` token contains a line terminator (`\\n`, `\\r`, U+2028, or U+2029).\n\n### Workarounds\n\nDrop every token after a `{ comment }` token before calling `quote()`, or reject line terminators in untrusted strings. Separately, do not append other shell text after `quote()` output that contains a comment, since the comment swallows it.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "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"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "shell-quote"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.8.4"
      }, {
        "fixed" : "1.11.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/ljharb/shell-quote/security/advisories/GHSA-pqg4-j6r4-53mv"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-102422"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ljharb/shell-quote/commit/6002b2ed90c6b83095eb272b6b0adaf3a172b0bc"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ljharb/shell-quote"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-10-06T13:40:36Z",
    "nvd_published_at" : "2026-09-29T04:17:55Z"
  }
}