CVE-2026-137198: cross-spawn: Argument injection on Windows via backslashes before a double quote
cross-spawn is a cross-platform solution for Node.js spawn and spawnSync. From 6.0.6 until 6.0.7 and from 7.0.4 until 7.1.0, Windows applications that pass untrusted arguments to commands routed through cmd.exe can be vulnerable because cross-spawn did not correctly double runs of backslashes before a double quote or at the end of an argument. Two or more backslashes could escape the argument's closing quote, allowing attacker-controlled text to become extra arguments or consume following arguments. The caller may not detect the injection when the target accepts the resulting arguments and exits successfully, while a target that rejects an unexpected argument can fail instead. The affected command class includes npm cmd-shims in nodemodules/.bin. This can change a target program's operation, although it does not by itself execute a second command and does not affect other platforms. This issue is fixed in versions 6.0.7 and 7.1.0.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
cross-spawnto a version that resolves this vulnerability.Fixed in 6.0.7 - Upgrade
Upgrade
cross-spawnto a version that resolves this vulnerability.Fixed in 7.1.0
Event History
Frequently Asked Questions
Which deployments are exposed to this issue?
Only Windows applications are affected, and only when they pass untrusted arguments to commands that are routed through cmd.exe. npm cmd-shims in node_modules/.bin are included in the affected command class; other platforms are not affected.
What input is needed to trigger the injection?
An attacker needs control over an argument passed by the application, with two or more backslashes before a double quote or at the end of the argument. The malformed escaping can cause attacker-controlled text to be interpreted as additional arguments or to consume arguments that follow.
Does successful command execution rule out exploitation?
No. The caller may not notice the injection if the target program accepts the altered arguments and exits successfully. Targets that reject unexpected arguments may instead fail.
Is this equivalent to arbitrary command execution?
No. The issue can change the target program's operation by injecting or consuming arguments, but it does not itself execute a second command.
What versions should be used to remediate the issue?
Upgrade to cross-spawn 6.0.7 or 7.1.0. The affected ranges are from 6.0.6 until 6.0.7 and from 7.0.4 until 7.1.0.