CVE-2026-137199
### Impact 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: ```js const spawn = require('cross-spawn'); // Runs calc.exe on Windows spawn.sync('npm', ['" & calc & "']); ``` 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. Applications 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. ### Patches This 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`. Some 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. ### Workarounds Validate untrusted input so that only a safe subset is allowed, and call executables directly r
Properties
- Summary
- cross-spawn: Command injection on Windows when spawning batch files
- Severity
- critical
- Nvd fetched at
- 2026-12-01T06:30:34.011967+00:00
- Cvss score
- 9.2
- Cvss severity
- CRITICAL
- Retrieved at
- 2026-12-01T06:31:18+00:00
- Ghsa published
- 2026-12-01T02:58:48Z
- Source url
- https://github.com/advisories/GHSA-ghv9-86vm-4v8m
- Ghsa updated
- 2026-12-01T02:58:49Z
- Ghsa id
- GHSA-ghv9-86vm-4v8m
- Last source
- GitHub Advisory Database
- Score
- 9.2
- Cvss version
- 4.0
- Cve id
- CVE-2026-137199
- Cvss vector
- 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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
- First seen by Signal
- 2026-11-30T22:28:40+00:00
- Name
- CVE-2026-137199
- Is ghsa only
- false
- Vector
- 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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
- Published at
- 2026-11-30T21:17:25.533
Related Entities (3)
AFFECTS (1)
HAS_WEAKNESS (1)
VULNERABLE_TO (1)
Related research
Explore deeper with Ninja Signal's threat intelligence graph