cross-spawn Windows command injection via batch files (CVE-2026-137199)
Severity: critical · Patch status: patched · Since 2026-11-28 · CVE-2026-137199
cross-spawn, an npm package that runs child processes on Node.js with about 1.5 billion downloads in November 2026 (npm downloads API), mishandled arguments on Windows when a command was routed through cmd.exe via a batch file (.bat or .cmd) outside nodemodules/.bin, such as npm.cmd, global package shims or user batch files. cmd.exe parses the arguments a second time, so a crafted argument could break out of its quotes and run arbitrary commands. Trailing dots or spaces could evade batch-file detection, and %VAR% or !VAR! could be expanded in some environments. Only Windows is affected, and only when untrusted input reaches a command that runs through cmd.exe; other platforms and options.shell mode are not affected. The advisory GHSA-ghv9-86vm-4v8m (CVE-2026-137199, NVD record published 2026-11-30) lists affected versions below 6.0.7 and from 7.0.0 below 7.1.0. The fixed releases 6.0.7 and 7.1.0 were published to npm on 2026-11-28. The GitHub Advisory Database rates it critical with CVSS 4.0 9.2, while the maintainer's advisory page and release notes say High. The sources reviewed report no in-the-wild exploitation. Upgrade to 7.1.0 or 6.0.7 and redeploy Windows builds and services. Where that is not possible, allow only a safe subset of untrusted input and call executables directly instead of through batch shims. Batch files that read an argument unquoted with %~1 stay unsafe even after upgrading.
What to do
- Upgrade cross-spawn to 7.1.0 (or 6.0.7 on the v6 line) and redeploy Windows-dependent builds and services
- Audit dependencies for cross-spawn usage and any code paths passing untrusted input as arguments to batch files on Windows
- As a workaround, validate untrusted input to a safe subset and call executables directly rather than through .bat/.cmd shims
- Note residual limitations: batch files using %~1 unquoted cannot be fully fixed by escaping
Fixed versions
Sources
All live incidents on Threat Watch