cross-spawn, the small package many Node tools use to start other programs the same way on every platform, was downloaded 359,331,942 times in the week before its maintainers published two Windows advisories. GitHub rates the first, GHSA-ghv9-86vm-4v8m (CVE-2026-137199, published 1 December 2026), critical: a crafted argument can run arbitrary commands. The second, GHSA-m6qr-m48x-3xhh (CVE-2026-137198, published 4 December 2026), is rated high and lets an argument split into extra arguments. Versions 7.1.0 and 6.0.7 fix both.

Most projects never call cross-spawn themselves, but it sits deep in many dependency trees, so it's worth a two-minute check.

What went wrong

On Windows, a command that isn't an .exe or .com, such as a .bat or .cmd file, has to run through cmd.exe, so cross-spawn adds the quoting and escaping that cmd.exe expects. A batch file that passes its arguments on, for example with %*, makes cmd.exe read them a second time. According to the maintainers' advisory, cross-spawn only handled that second pass for npm's own shims in node_modules/.bin. For any other batch file, npm.cmd and globally installed shims included, an argument could escape its quotes and start another program. The advisory also lists a detection bypass with trailing dots or spaces in the command name, and environment variable expansion inside arguments in some setups.

The second flaw came from an earlier ReDoS fix. Starting with 7.0.4, 7.0.5 and 6.0.6, backslashes in front of a double quote were no longer doubled correctly, so an argument such as a directory path ending in two backslashes could close its quote early. The advisory explains that the extra or missing arguments go unnoticed: the command still succeeds and prints nothing on stderr. This one can't run other commands, but a tool that accepts extra flags may act on injected ones.

Who is affected

Both advisories limit the impact to Windows, and to applications that pass untrusted input as arguments to a command that runs through cmd.exe. macOS and Linux aren't affected, and neither is the shell option, which doesn't escape anything by design. If your code only uses cross-spawn indirectly, through build or test tools running fixed commands on your own machine, the practical risk is low, but the upgrade is still cheap.

The affected ranges:

  • Command injection: below 6.0.7, and 7.0.0 up to (not including) 7.1.0.
  • Argument injection: 6.0.6, and 7.0.4 up to (not including) 7.1.0.

How to check and fix

See which versions your lockfile installs and which packages bring them in:

npm ls cross-spawn --all yarn why cross-spawn # Yarn 1 

When the packages that bring it in ask for a ^7 or ^6 range, the fixed releases already fit it, and refreshing the lockfile is enough:

npm audit fix npm ls cross-spawn --all # every copy should now be 7.1.0+ or 6.0.7+ 

If a package pins an older version, npm can't move it on its own. An "overrides" entry in package.json ("resolutions" in Yarn 1) forces the patched release; keep 6.x copies on 6.0.7 rather than jumping them to 7.x. The maintainers' only workaround is validating untrusted input and calling executables directly instead of batch files.

With Gnawky

Running gnawky in the project shows both advisories as one cross-spawn item, marked production or dev-only depending on which of your dependencies bring it in (Production first). Choosing Fix refreshes the lockfile on a new branch with install scripts off, and when a parent pins an old version, Gnawky writes the override for you and asks whether to keep it as a ^ range or an exact pin (Forcing a sub-dependency). If you've turned on the pre-push warning, your next git push lists cross-spawn when a production dependency still installs a vulnerable copy.

Sources

Originally published on the Gnawky blog. Drafted with AI assistance, checked against the sources and reviewed by a person before publishing.