Skip to content
← Blog · · df00tech

cross-spawn Advisory: Windows Batch File Argument Injection Enables Command Execution

breaking ghsa npm CVE-2026-137199

What Happened

A GitHub Security Advisory (GHSA-ghv9-86vm-4v8m, tracked as CVE-2026-137199) discloses a command injection vulnerability in the npm package cross-spawn. According to the advisory, on Windows, cross-spawn routes non-executable commands (such as .bat and .cmd batch files) through cmd.exe, escaping the command and arguments for that shell. The flaw is that batch files which forward their own arguments (for example via %*) cause cmd.exe to parse those arguments a second time. cross-spawn only accounted for this double-parsing when the batch file was an npm cmd-shim under node_modules/.bin. For any other batch file, including npm.cmd, globally installed package shims, or user-created batch files, a crafted argument could break out of its quoting and execute arbitrary commands. The advisory also notes related issues. Batch-file detection could be bypassed using trailing dots or spaces in a command name. %VAR% expansion could trigger if an environment variable named VAR^ existed. !VAR! expansion could occur when delayed expansion is enabled in the registry. The maintainers report fixes in versions 7.1.0 and 6.0.7.

Why It Matters

cross-spawn is a widely used cross-platform process-spawning library embedded (often transitively) in many Node.js tools and applications. Any application on Windows that uses an affected version of cross-spawn to pass untrusted or partially untrusted input as arguments to a command resolved through cmd.exe, directly or via a batch-file shim, is potentially exposed to arbitrary command execution. Exploit status is currently listed as theoretical, and the issue is Windows-specific. Other platforms and uses of options.shell are stated as unaffected. The practical exposure will largely depend on how deeply outdated versions are pinned across downstream dependency trees.

What Defenders Should Do Now

  • Inventory Windows-based Node.js applications and CI/build agents for dependence on cross-spawn (direct or transitive, including via tools that shell out to npm.cmd or other batch-file wrappers).
  • Upgrade to the patched releases (7.1.0 or 6.0.7) as soon as feasible, prioritizing Windows build servers, CI runners, and developer workstations where untrusted input (package names, CLI arguments, repo contents) might reach spawned commands.
  • As a mitigation, validate or allowlist any untrusted input passed as process arguments, and prefer invoking executables directly rather than through batch-file shims where possible.
  • For detection and hunting, consider reviewing cmd.exe child-process creation events (for example Sysmon Event ID 1) on Windows hosts running Node.js tooling for anomalous command lines spawned from node.exe, npm.cmd, or other .cmd/.bat shims, particularly command lines containing unexpected quote characters, &, %, or ! sequences that could indicate argument-escaping abuse.
  • Note that the advisory states some limitations (for example batch files using unquoted %~1) cannot be fully remediated by escaping alone. Review any custom batch-file tooling in your build pipeline against this risk.

Developing Intel

This is a same-day advisory and details may evolve as the community assesses real-world exposure across the npm ecosystem. Treat this as developing intel and consult the original GitHub Security Advisory for the authoritative technical writeup and patch details: GHSA-ghv9-86vm-4v8m.

Get new detections in your inbox

New ATT&CK coverage plus CISA KEV / CVE detection rules, roughly weekly. No spam, unsubscribe anytime.