Vulnerabilities in pkg:npm/cross-spawn
PACKAGECVE-2026-137197 is a HIGH (CVSS 8.1) command injection on windows when vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting cross-spawn libraries in the npm ecosystem. The issue involves command injection on windows when the command is not a plain program name or path. Remediation is available by upgrading affected packages to version 7.1.1, 6.0.8.
pkg:npm/cross-spawn
Vulnerability advisories affecting package pkg:npm/cross-spawn. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-w3gc-668g-rf8f | CVE-2026-137197 | HIGH | cross-spawn: Command injection on Windows when the command is not a plain program name or path |
| GHSA-m6qr-m48x-3xhh | CVE-2026-137198 | HIGH | cross-spawn: Argument injection on Windows via backslashes before a double quote |
| GHSA-ghv9-86vm-4v8m | CVE-2026-137199 | CRITICAL | cross-spawn: Command injection on Windows when spawning batch files |
| GHSA-3xgq-45jj-v275 | CVE-2024-21538 | HIGH | Regular Expression Denial of Service (ReDoS) in cross-spawn |
CVE-2026-137197 at a Glance
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).
How to Fix CVE-2026-137197
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.
npm install cross-spawn@7.1.1
npm install cross-spawn@6.0.8
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-137197, 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.1), 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-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 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
CVE-2026-137197 Affected cross-spawn Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
cross-spawn
|
npm |
≥ 7.0.0
< 7.1.1
|
7.1.1
|
|
cross-spawn
|
npm |
< 6.0.8
|
6.0.8
|
References
Frequently Asked Questions
What is CVE-2026-137197?
Which cross-spawn versions are affected?
What version fixes CVE-2026-137197?
Is cross-spawn affected?
What is the CVSS score of CVE-2026-137197?
What CWE is associated with CVE-2026-137197?
How can I check npm dependencies for CVE-2026-137197?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-w3gc-668g-rf8f",
"modified" : "2026-12-04T19:52:52Z",
"published" : "2026-12-04T19:52:52Z",
"aliases" : [ "CVE-2026-137197" ],
"summary" : "cross-spawn: Command injection on Windows when the command is not a plain program name or path",
"details" : "### Impact\n\nOn Windows, cross-spawn runs commands that aren't executables, such as batch files (`.bat` and `.cmd`), through `cmd.exe`, and escapes their arguments for it. Batch files need a stricter escaping, because `cmd.exe` parses their arguments a second time. 7.1.0 and 6.0.7 fixed that escaping ([GHSA-ghv9-86vm-4v8m](https://github.com/moxystudio/node-cross-spawn/security/advisories/GHSA-ghv9-86vm-4v8m)), but it only applies when cross-spawn detects that the command is a batch file.\n\nThe detection could be bypassed when the command isn't written as a plain program name or path, while `cmd.exe` still runs a batch file:\n\n- the command contains double quotes, e.g. `spawn('\"tool.bat\"', args)` or `spawn('\"tool\"', args)`;\n- the command contains a space, tab, `,`, `;` or `=`, where `cmd.exe` ends the command name, e.g. `spawn('npm install', args)`, which runs `npm.cmd`;\n- the command ends with a tab or other whitespace;\n- the `PATHEXT` passed in `options.env` makes `cmd.exe` find a batch file that the parent's `PATHEXT` doesn't.\n\nIn those cases the arguments were escaped for a regular program, and an argument such as `\"&calc` could run arbitrary commands.\n\nApplications are affected if they run on Windows, pass a command in one of these forms, and pass untrusted input as arguments.\n\n### Patches\n\nFixed in 7.1.1 and 6.0.8. The command is now always quoted when it runs through `cmd.exe`, so `cmd.exe` treats it as a single name. Double quotes are removed from it first, since Windows file names can't contain them, and it's looked up with the child's `PATHEXT`. As a consequence, the command must be the name or path of a single program, as documented: `spawn('npm install')` now fails with `ENOENT`, like on other platforms.\n\nVersions before 6.0.0 are not maintained and won't be fixed. Upgrade to 7.1.1, or force it with `overrides` in `package.json`.\n\n### Workarounds\n\nPass the program as the command and its arguments in `args`, without quotes, e.g. `spawn('npm', ['install', ...])`, and don't set `PATHEXT` in `options.env`.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "cross-spawn"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "7.0.0"
}, {
"fixed" : "7.1.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "cross-spawn"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "6.0.8"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/moxystudio/node-cross-spawn/security/advisories/GHSA-w3gc-668g-rf8f"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-137197"
}, {
"type" : "WEB",
"url" : "https://github.com/moxystudio/node-cross-spawn/pull/196"
}, {
"type" : "WEB",
"url" : "https://github.com/moxystudio/node-cross-spawn/pull/197"
}, {
"type" : "WEB",
"url" : "https://github.com/moxystudio/node-cross-spawn/commit/4a15965b05415e9f817315206771b25558804b16"
}, {
"type" : "WEB",
"url" : "https://github.com/moxystudio/node-cross-spawn/commit/d0ead352a7380492cbb0f6548fa86f19448323c9"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/moxystudio/node-cross-spawn"
}, {
"type" : "WEB",
"url" : "https://github.com/moxystudio/node-cross-spawn/releases/tag/v6.0.8"
}, {
"type" : "WEB",
"url" : "https://github.com/moxystudio/node-cross-spawn/releases/tag/v7.1.1"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-78" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-12-04T19:52:52Z",
"nvd_published_at" : "2026-11-30T21:17:25Z"
}
}