All posts

Critical vulnerability

Critical remote code execution in cross-spawn (CVE-2026-137199)

Remote code execution in cross-spawn · npm

CVE-2026-137199

cross-spawn: Command injection on Windows when spawning batch files

Severity
Critical
Published
1 Dec 2026
Fixed in
6.0.7, 7.1.0
Weakness
OS command injection (CWE-78)

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.
From the GitHub Advisory Database, CC BY 4.0. Shortened; the full text is there.

Workarounds

Validate untrusted input so that only a safe subset is allowed, and call executables directly rather than through batch files.

Workarounds as given by the GitHub Advisory Database, CC BY 4.0.
SoftwareAffected versions
cross-spawnnpm
  • From 7.0.0 before 7.1.0
  • Every version before 6.0.7
Everything about CVE-2026-137199

From NVD, the CVE Program, OSV.dev with the GitHub Advisory Database, WPVulnerability, WordPress's security advisories and CISA's Known Exploited Vulnerabilities catalog, as they stood when this was written. Each vulnerability's own page has its latest rating and fix. This product uses the NVD API but is not endorsed or certified by the NVD.