Command Injection Affecting cross-spawn package, versions <6.0.0>=6.0.0 <6.0.7>=7.0.0 <7.1.0


Severity

Recommended
0.0
critical
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
1.01% (65th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Command Injection vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-CROSSSPAWN-23184493
  • published1 Dec 2026
  • disclosed30 Nov 2026
  • creditDuong Bui Thai, Mohamed Akram

Introduced: 30 Nov 2026

NewCVE-2026-137199  (opens in a new tab)
CWE-78  (opens in a new tab)

How to fix?

Upgrade cross-spawn to version 6.0.0, 6.0.7, 7.1.0 or higher.

Overview

Affected versions of this package are vulnerable to Command Injection via insufficient escaping in lib/util/escape.js when spawning batch files on Windows. When a batch file outside node_modules/.bin forwards its arguments (e.g. with %*), cmd.exe parses them a second time, and an attacker-controlled argument can break out of its quotes to execute arbitrary commands through npm.cmd, globally installed package shims, or user batch files. Additionally, batch file detection can be bypassed with trailing dots or spaces in the command name, %VAR% in an argument can be expanded if an environment variable named VAR^ exists, and !VAR! can be expanded when delayed expansion is enabled in the registry.

Note: This is only exploitable on Windows when untrusted input is passed as arguments to a command that runs through cmd.exe; other platforms and options.shell mode are not affected.

Workaround

Validate untrusted input so that only a safe subset is allowed, and call executables directly rather than through batch files.

CVSS Base Scores

version 4.0
version 3.1