Advisories for Npm/Cross-Spawn package

2026

cross-spawn: Command injection on Windows when the command is not a plain program name or path

On Windows, cross-spawn runs commands that aren't executables, such as batch files (.bat and .cmd), through cmd.exe, and escapes their arguments for it. Batch files need a stricter escaping, because cmd.exe parses their arguments a second time. 7.1.0 and 6.0.7 fixed that escaping (GHSA-ghv9-86vm-4v8m), but it only applies when cross-spawn detects that the command is a batch file. The detection could be bypassed when the command isn't written as a …

cross-spawn: Argument injection on Windows via backslashes before a double quote

On Windows, when cross-spawn runs a command through cmd.exe, it quotes each argument and doubles the backslashes that precede a double quote or the end of the argument, so that they aren't taken as escaping the quote. Since 7.0.4, 7.0.5 and 6.0.6, which changed the regular expressions to fix a ReDoS vulnerability (GHSA-3xgq-45jj-v275), backslash runs weren't doubled correctly: 7.0.4 didn't double them at all, and 7.0.5, 7.0.6 and 6.0.6 added …

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

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 …

2024