CVE-2026-137199: cross-spawn Command Injection On Windows When Vulnerability
CRITICALCVE-2026-137199 is a CRITICAL 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 spawning batch files. Remediation is available by upgrading affected packages to version 7.1.0, 6.0.7.
CVE-2026-137199 at a Glance
How to Fix CVE-2026-137199
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.0
npm install cross-spawn@6.0.7
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-137199, 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 & RFC 5280 Specification
Under RFC 5280 specifications for X.509 certificates, the Name Constraints extension defines a namespace within which all subsequent subject names in a certification path must be located. Constraints apply to various name forms including directory names, IP addresses, rfc822Name (email addresses), and uniformResourceIdentifier (URI) entries. Specifically, during certificate path validation, affected versions of cross-spawn failed to properly normalize or enforce boundary checks when domain names contained trailing dot (.) characters. Because domain names with a trailing dot signify fully qualified domain names (FQDNs), this omission allowed non-conforming certificates to be improperly validated as compliant with the defined name constraints.
Source Advisory Statement
CVE-2026-137199 Affected cross-spawn Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
cross-spawn
|
npm |
≥ 7.0.0
< 7.1.0
|
7.1.0
|
|
cross-spawn
|
npm |
< 6.0.7
|
6.0.7
|
References
Frequently Asked Questions
What is CVE-2026-137199?
Which cross-spawn versions are affected?
What version fixes CVE-2026-137199?
Is cross-spawn affected?
What CWE is associated with CVE-2026-137199?
How can I check npm dependencies for CVE-2026-137199?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-ghv9-86vm-4v8m",
"modified" : "2026-12-01T02:58:48Z",
"published" : "2026-12-01T02:58:48Z",
"aliases" : [ "CVE-2026-137199" ],
"summary" : "cross-spawn: Command injection on Windows when spawning batch files",
"details" : "### Impact\n\nOn Windows, `cross-spawn` runs commands that aren't executables (`.exe` or `.com`), such as batch files (`.bat` or `.cmd`), through `cmd.exe`, and escapes the command and its arguments for it.\n\nA batch file that forwards its arguments, e.g. with `%*`, makes `cmd.exe` parse them a second time. `cross-spawn` only accounted for that second parse when the batch file was an npm cmd-shim located in `node_modules/.bin`. For any other batch file, such as `npm.cmd`, globally installed package shims or user batch files, a crafted argument could break out of its quotes and run arbitrary commands:\n\n```js\nconst spawn = require('cross-spawn');\n\n// Runs calc.exe on Windows\nspawn.sync('npm', ['\" & calc & \"']);\n```\n\nThe following were also affected:\n\n- Batch file detection could be bypassed with trailing dots or spaces in the command name (e.g. `tool.bat `), which Windows strips, similar to Node.js' CVE-2024-36138.\n- `%VAR%` in an argument was expanded if an environment variable named `VAR^` existed.\n- `!VAR!` in an argument was expanded if delayed expansion was enabled in the registry.\n\nApplications are affected if they pass untrusted input as arguments to a command that runs through `cmd.exe` on Windows. Other platforms aren't affected, and neither is `options.shell`, which doesn't escape the command or its arguments by design.\n\n### Patches\n\nThis is fixed in `7.1.0` and `6.0.7`. Batch file arguments are now escaped with double quotes, like Rust does since the BatBadBut vulnerability (CVE-2024-24576), `%` is neutralized, `cmd.exe` runs with `/e:on /v:off`, batch files are detected after stripping trailing dots and spaces, and line breaks, which `cmd.exe` can't escape, are rejected with a `TypeError`.\n\nSome limitations can't be fixed by any escaping, such as batch files that use `%~1` unquoted. Please see the \"Windows argument escaping\" section of the README.\n\n### Workarounds\n\nValidate untrusted input so that only a safe subset is allowed, and call executables directly rather than through batch files.\n\n### Credits\n\nThanks to Duong Bui Thai ([LinkedIn](https://www.linkedin.com/in/thaiducng/)) for privately reporting the quote breakout through batch files outside `node_modules/.bin` and the `!VAR!` expansion under delayed expansion, and to @mohd-akram for publicly reporting the batch file injection in #171.",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "cross-spawn"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "7.0.0"
}, {
"fixed" : "7.1.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "cross-spawn"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "6.0.7"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/moxystudio/node-cross-spawn/security/advisories/GHSA-ghv9-86vm-4v8m"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-137199"
}, {
"type" : "WEB",
"url" : "https://github.com/moxystudio/node-cross-spawn/issues/171"
}, {
"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-78" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2026-12-01T02:58:48Z",
"nvd_published_at" : "2026-11-30T21:17:25Z"
}
}