Command Injection Affecting cross-spawn package, versions <6.0.0>=6.0.0 <6.0.8>=7.0.0 <7.1.1


Severity

Recommended
0.0
critical
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.82% (59th 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-23184491
  • published1 Dec 2026
  • disclosed30 Nov 2026
  • creditUnknown

Introduced: 30 Nov 2026

NewCVE-2026-137197  (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.8, 7.1.1 or higher.

Overview

Affected versions of this package are vulnerable to Command Injection via the batch-file detection logic in lib/parse.js on Windows, when a command passed to spawn or spawnSync is not written as a plain program name or path. Commands containing double quotes, command-name delimiters (space, tab, ,, ;, =), trailing whitespace, or a child-specific PATHEXT can cause cross-spawn to miss that cmd.exe will resolve the target to a batch file. The arguments are then escaped as though the target were a regular executable rather than a batch file, so command metacharacters in an untrusted argument (for example "&calc) are interpreted by cmd.exe and execute arbitrary commands.

Note: This is only exploitable when the application passes a command in one of the affected forms (quoted, containing delimiters, with trailing whitespace, or with a custom PATHEXT) and passes untrusted input as arguments on Windows.

Workaround

Pass the program as the command and its arguments separately in args, without quotes, e.g. spawn('npm', ['install', ...]), and do not set PATHEXT in options.env.

CVSS Base Scores

version 4.0
version 3.1