CVE-2026-137198: cross-spawn Argument Injection On Windows Vulnerability

HIGH
Advisory Identifier: GHSA-m6qr-m48x-3xhh
CWE-88
Published
Advisory Summary

CVE-2026-137198 is a HIGH argument injection on windows vulnerability (CWE-88: Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')) affecting cross-spawn libraries in the npm ecosystem. The issue involves argument injection on windows via backslashes before a double quote. Remediation is available by upgrading affected packages to version 7.1.0, 6.0.7.

CVE-2026-137198 at a Glance

CVE Identifier CVE-2026-137198
GHSA Identifier GHSA-m6qr-m48x-3xhh
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-88: Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')
Affected Product cross-spawn
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2026-137198

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

cross-spawn fixed: 7.1.0
npm install cross-spawn@7.1.0
cross-spawn fixed: 6.0.7
npm install cross-spawn@6.0.7
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 cross-spawn

How to Check if You Are Affected

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

npm ls cross-spawn

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

Note: The npm ls cross-spawn 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-88: Improper Neutralization of Argument Delimiters in a Command ('Argument Injection'), where the product constructs a string for a command to be executed by a separate component in another control sphere, but it does not properly delimit the intended arguments, options, or switches within that command string. In cross-spawn, 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 On Windows, when `cross-spawn` runs a command through `cmd.exe`, it quotes each argument and doubles the backslashes that precede a double quote or the end of the argument, so that they aren't taken as escaping the quote. Since `7.0.4`, `7.0.5` and `6.0.6`, which changed the regular expressions to fix a ReDoS vulnerability (GHSA-3xgq-45jj-v275), backslash runs weren't doubled correctly: `7.0.4` didn't double them at all, and `7.0.5`, `7.0.6` and `6.0.6` added only one backslash to each run. An argument with two or more backslashes before a double quote, or at its end, had its closing quote escaped, which let it split into extra arguments or swallow the next ones: ```js const spawn = require('cross-spawn'); // On Windows, the program received two arguments: `x\\` and `--evil` spawn.sync('foo.cmd', ['x\\\\" --evil']); ``` The caller can't tell: the command still exits successfully and nothing is written to stderr. Even an ordinary directory path such as `C:\some\dir\\` makes the caller's following arguments disappear. Applications are affected if they pass untrusted input as arguments to a command that runs through `cmd.exe` on Windows, which includes every npm cmd-shim in `node_modules/.bin`. The impact depends on the program: one that accepts extra arguments may act on the injected ones, e.g. a tool called with `--check` receiving an injected `--write`, while one that rejects an unexpected argument fails instead. This doesn't allow running other commands. Other platforms aren't affected. ### Patches This is fixed in `7.1.0` and `6.0.7`, which escape backslashes with a loop that handles any number of them in linear time. ### Workarounds Validate untrusted input so that only a safe subset is allowed. ### Credits MOXY Studio thanks Duong Bui Thai ([LinkedIn](https://www.linkedin.com/in/thaiducng/)) for privately reporting this vulnerability, and both @trackoor and @ogffx for independently reporting and fixing it in #188 and #190.

CVE-2026-137198 Affected cross-spawn Versions

2 component(s)
Fixed Versions:
7.1.06.0.7
Product / Package Ecosystem Affected Versions Fixed Version
cross-spawn
npm
≥ 7.0.4
< 7.1.0
7.1.0
cross-spawn
npm
≥ 6.0.6
< 6.0.7
All 1 versions
6.0.6
6.0.7

References

Frequently Asked Questions

What is CVE-2026-137198?
CVE-2026-137198 is a security vulnerability in cross-spawn involving Argument injection on Windows via backslashes before a double quote under CWE-88: Improper Neutralization of Argument Delimiters in a Command ('Argument Injection').
Which cross-spawn versions are affected?
Affected versions include releases prior to 7.1.0, 6.0.7 across affected packages: cross-spawn.
What version fixes CVE-2026-137198?
Upgrading to 7.1.0, 6.0.7 (or the latest patched release for your respective branch) resolves the vulnerability.
Is cross-spawn affected?
Yes, cross-spawn is affected in releases prior to 7.1.0, 6.0.7. Upgrade your dependency to 7.1.0, 6.0.7 or later.
What CWE is associated with CVE-2026-137198?
CVE-2026-137198 is classified under CWE-88: Improper Neutralization of Argument Delimiters in a Command ('Argument Injection') (The product constructs a string for a command to be executed by a separate component in another control sphere, but it does not properly delimit the intended arguments, options, or switches within that command string.).
How can I check npm dependencies for CVE-2026-137198?
Run the dependency tree command: 'npm ls cross-spawn'. 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-m6qr-m48x-3xhh",
  "modified" : "2026-12-04T00:14:09Z",
  "published" : "2026-12-04T00:14:09Z",
  "aliases" : [ "CVE-2026-137198" ],
  "summary" : "cross-spawn: Argument injection on Windows via backslashes before a double quote",
  "details" : "### Impact\n\nOn Windows, when `cross-spawn` runs a command through `cmd.exe`, it quotes each argument and doubles the backslashes that precede a double quote or the end of the argument, so that they aren't taken as escaping the quote.\n\nSince `7.0.4`, `7.0.5` and `6.0.6`, which changed the regular expressions to fix a ReDoS vulnerability (GHSA-3xgq-45jj-v275), backslash runs weren't doubled correctly: `7.0.4` didn't double them at all, and `7.0.5`, `7.0.6` and `6.0.6` added only one backslash to each run. An argument with two or more backslashes before a double quote, or at its end, had its closing quote escaped, which let it split into extra arguments or swallow the next ones:\n\n```js\nconst spawn = require('cross-spawn');\n\n// On Windows, the program received two arguments: `x\\\\` and `--evil`\nspawn.sync('foo.cmd', ['x\\\\\\\\\" --evil']);\n```\n\nThe caller can't tell: the command still exits successfully and nothing is written to stderr. Even an ordinary directory path such as `C:\\some\\dir\\\\` makes the caller's following arguments disappear.\n\nApplications are affected if they pass untrusted input as arguments to a command that runs through `cmd.exe` on Windows, which includes every npm cmd-shim in `node_modules/.bin`. The impact depends on the program: one that accepts extra arguments may act on the injected ones, e.g. a tool called with `--check` receiving an injected `--write`, while one that rejects an unexpected argument fails instead. This doesn't allow running other commands. Other platforms aren't affected.\n\n### Patches\n\nThis is fixed in `7.1.0` and `6.0.7`, which escape backslashes with a loop that handles any number of them in linear time.\n\n### Workarounds\n\nValidate untrusted input so that only a safe subset is allowed.\n\n### Credits\n\nMOXY Studio thanks Duong Bui Thai ([LinkedIn](https://www.linkedin.com/in/thaiducng/)) for privately reporting this vulnerability, and both @trackoor and @ogffx for independently reporting and fixing it in #188 and #190.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:N/VI:H/VA:L/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "cross-spawn"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "7.0.4"
      }, {
        "fixed" : "7.1.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "cross-spawn"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.0.6"
      }, {
        "fixed" : "6.0.7"
      } ]
    } ],
    "versions" : [ "6.0.6" ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/moxystudio/node-cross-spawn/security/advisories/GHSA-m6qr-m48x-3xhh"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-137198"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/moxystudio/node-cross-spawn/issues/188"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/moxystudio/node-cross-spawn/pull/160"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/moxystudio/node-cross-spawn/pull/162"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/moxystudio/node-cross-spawn/pull/191"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/moxystudio/node-cross-spawn/pull/192"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/moxystudio/node-cross-spawn/commit/1b71aa519a2e4f97d1f3ee27f0e2fc24ba17cf1a"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/moxystudio/node-cross-spawn/commit/244ffeaa8473de0080c93ebbf779bb953b94114b"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/moxystudio/node-cross-spawn"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/moxystudio/node-cross-spawn/releases/tag/v6.0.7"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/moxystudio/node-cross-spawn/releases/tag/v7.1.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-88" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-12-04T00:14:09Z",
    "nvd_published_at" : "2026-11-30T21:17:25Z"
  }
}