Actively exploited Attackers exploit Acronis Backup plugin for cPanel; users of version 1.9.4 are told to downgrade CVSS 7.5 · Published Dec 4, 05:40 UTC What to do now ›

TechNews

cross-spawn fixes critical command injection when Node.js apps run batch files on Windows

CVE-2026-137199 in the cross-spawn npm package lets a crafted argument break out of its quotes when a batch file such as npm.cmd runs on Windows. Versions 7.1.0 and 6.0.7 fix it; other platforms are not affected.

9.2 CriticalPatch available

News graphic with the label 'Developer security', the title 'cross-spawn' and the line 'CVE-2026-137199, CVSS 9.2, Windows', above an illustration of a command window running a .bat file, with a red injected command breaking out of a pair of quotation marks
Illustration: AI Security Times
CVE
CVE-2026-137199
Severity
9.2 Critical
CVSS 9.2, Critical
Status
Patch available
Product
cross-spawn (npm package)

Am I affected?

Check your version
Affected
versions before 6.0.7, and 7.0.0 up to but not including 7.1.0
Fixed in
6.0.7 and 7.1.0

What to do now:

  1. Update cross-spawn to 7.1.0 or later, or to 6.0.7 on the 6.x line. It is usually a dependency of another package: run npm ls cross-spawn to find every copy.
  2. On Windows, do not pass untrusted input as arguments to batch files (.bat or .cmd). Call executables directly.
  3. Remember that options.shell is not escaped by design, before and after this fix.

The maintainers of cross-spawn, one of the most widely used packages on npm, have fixed a critical flaw that lets a crafted argument run extra commands when a Node.js program starts a batch file on Windows. The advisory, CVE-2026-137199, was published on Dec 1 and is rated 9.2 under CVSS 4.0.

cross-spawn is a small library that starts other programs the same way on every operating system. Many tools depend on it, often indirectly: npm counted about 346 million downloads of the package in the week of Nov 24 to Nov 30.

What goes wrong

On Windows, programs that are not .exe or .com files, such as batch files (.bat or .cmd), run through cmd.exe. cross-spawn escapes the command and its arguments for it.

A batch file that passes its arguments on, for example with %*, makes cmd.exe read them a second time. According to the advisory, cross-spawn only accounted for that second pass when the batch file was an npm shim in node_modules/.bin. For any other batch file, such as npm.cmd, globally installed package shims or a user’s own batch files, a crafted argument could break out of its quotes. The advisory’s example runs the Windows calculator:

js
const spawn = require('cross-spawn');
// Runs calc.exe on Windows
spawn.sync('npm', ['" & calc & "']);

The advisory lists three more weaknesses fixed at the same time:

  • Batch file detection could be bypassed with trailing dots or spaces in the command name, such as tool.bat , which Windows removes.
  • %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.

Who is affected

Programs are affected if they pass untrusted input as arguments to a command that runs through cmd.exe on Windows. Other operating systems are not affected. Neither is the shell option, which does not escape the command or its arguments by design.

The CVSS 4.0 rating marks the attack as high complexity with specific preconditions, because the input has to reach a batch file on Windows.

The fix

Versions 7.1.0 and 6.0.7, released on Nov 28, fix the flaw. Version 8.0.0, released a day later, is outside the affected ranges. The fixed versions quote batch file arguments with double quotes, the approach Rust adopted after the BatBadBut vulnerability (CVE-2024-24576). It also neutralizes %, starts cmd.exe with /e:on /v:off, strips trailing dots and spaces before detecting batch files, and rejects line breaks, which cmd.exe cannot escape, with a TypeError.

Some cases cannot be fixed by any escaping, the maintainers warn, such as batch files that use %~1 without quotes. For those, the advice is to validate input and call executables directly.

What to do now

Update cross-spawn wherever it appears in your dependency tree, including through other packages, and keep untrusted input away from batch files on Windows.

Sources

  1. GHSA-ghv9-86vm-4v8m: cross-spawn command injection on Windows when spawning batch filesAdvisory
  2. cross-spawn repositoryProject
  3. npm download counts for cross-spawnnpm

AI Security Times

Newsroom

Stories signed AI Security Times are researched and drafted with AI assistance, checked against their primary sources and approved by our editor before they are published. Every news story and analysis lists its sources at the end. Read how we use AI and our editorial standards.

More from AI Security Times ›

Spotted a mistake? Report an error

Related coverage

More in Tech ›