npm
CVE-2026-137199
cross-spawn: Command injection on Windows when spawning batch files
- Severity
- Critical
- Published
- 1 Dec 2026
- Last changed
- 1 Dec 2026
- Added to UpHeron
- 1 Dec 2026
- Fixed in
- 6.0.7, 7.1.0
- Weakness
- OS command injection (CWE-78)
- Also known as
- GHSA-ghv9-86vm-4v8m
- Sources
- OSV.dev and GitHub
Description
On 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.
A 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:
The following were also affected:
- 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.
- %VAR% in an argument was expanded if an environment variable named VAR^ existed.
- !VAR! in an argument was expanded if delayed expansion was enabled in the registry.
Workarounds
Validate untrusted input so that only a safe subset is allowed, and call executables directly rather than through batch files.
Affected software
| Software | Affected versions |
|---|---|
cross-spawnnpm · osv:npm:cross-spawn |
|
About cross-spawn
- Weekly downloads (npm)
- 343,285,877npm, 1 Dec 2026
This is the only vulnerability in cross-spawn in our list.
References
- CVE.org https://www.cve.org/CVERecord?id=CVE-2026-137199
- GitHub Advisory Database https://github.com/advisories/GHSA-ghv9-86vm-4v8m