CVE-2026-137197: cross-spawn Command Injection On Windows When Vulnerability

HIGH
Advisory Identifier: GHSA-w3gc-668g-rf8f
CVSS 8.1
CWE-78
Published
Advisory Summary

CVE-2026-137197 is a HIGH (CVSS 8.1) command injection on windows when vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting cross-spawn libraries in the npm ecosystem. The issue involves command injection on windows when the command is not a plain program name or path. Remediation is available by upgrading affected packages to version 7.1.1, 6.0.8.

CVE-2026-137197 at a Glance

CVE Identifier CVE-2026-137197
GHSA Identifier GHSA-w3gc-668g-rf8f
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product cross-spawn
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-137197

To remediate this vulnerability, upgrade all affected cross-spawn dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

cross-spawn fixed: 7.1.1
npm install cross-spawn@7.1.1
cross-spawn fixed: 6.0.8
npm install cross-spawn@6.0.8
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls cross-spawn

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-137197, inspect your project dependencies using npm:

npm ls cross-spawn

Analyze the terminal output to locate any version of cross-spawn in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 7.1.1), your application is affected.

Note: The npm ls cross-spawn command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In cross-spawn, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact 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](https://github.com/moxystudio/node-cross-spawn/security/advisories/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 plain program name or path, while `cmd.exe` still runs a batch file: - the command contains double quotes, e.g. `spawn('"tool.bat"', args)` or `spawn('"tool"', args)`; - the command contains a space, tab, `,`, `;` or `=`, where `cmd.exe` ends the command name, e.g. `spawn('npm install', args)`, which runs `npm.cmd`; - the command ends with a tab or other whitespace; - the `PATHEXT` passed in `options.env` makes `cmd.exe` find a batch file that the parent's `PATHEXT` doesn't. In those cases the arguments were escaped for a regular program, and an argument such as `"&calc` could run arbitrary commands. Applications are affected if they run on Windows, pass a command in one of these forms, and pass untrusted input as arguments. ### Patches Fixed in 7.1.1 and 6.0.8. The command is now always quoted when it runs through `cmd.exe`, so `cmd.exe` treats it as a single name. Double quotes are removed from it first, since Windows file names can't contain them, and it's looked up with the child's `PATHEXT`. As a consequence, the command must be the name or path of a single program, as documented: `spawn('npm install')` now fails with `ENOENT`, like on other platforms. Versions before 6.0.0 are not maintained and won't be fixed. Upgrade to 7.1.1, or force it with `overrides` in `package.json`. ### Workarounds Pass the program as the command and its arguments in `args`, without quotes, e.g. `spawn('npm', ['install', ...])`, and don't set `PATHEXT` in `options.env`.

CVE-2026-137197 Affected cross-spawn Versions

2 component(s)
Fixed Versions:
7.1.16.0.8
Product / Package Ecosystem Affected Versions Fixed Version
cross-spawn
npm
≥ 7.0.0
< 7.1.1
7.1.1
cross-spawn
npm
< 6.0.8
6.0.8

References

Frequently Asked Questions

What is CVE-2026-137197?
CVE-2026-137197 is a security vulnerability in cross-spawn involving Command injection on Windows when the command is not a plain program name or path under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which cross-spawn versions are affected?
Affected versions include releases prior to 7.1.1, 6.0.8 across affected packages: cross-spawn.
What version fixes CVE-2026-137197?
Upgrading to 7.1.1, 6.0.8 (or the latest patched release for your respective branch) resolves the vulnerability.
Is cross-spawn affected?
Yes, cross-spawn is affected in releases prior to 7.1.1, 6.0.8. Upgrade your dependency to 7.1.1, 6.0.8 or later.
What is the CVSS score of CVE-2026-137197?
CVE-2026-137197 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2026-137197?
CVE-2026-137197 is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.).
How can I check npm dependencies for CVE-2026-137197?
Run the dependency tree command: 'npm ls cross-spawn'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-w3gc-668g-rf8f",
  "modified" : "2026-12-04T19:52:52Z",
  "published" : "2026-12-04T19:52:52Z",
  "aliases" : [ "CVE-2026-137197" ],
  "summary" : "cross-spawn: Command injection on Windows when the command is not a plain program name or path",
  "details" : "### Impact\n\nOn 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](https://github.com/moxystudio/node-cross-spawn/security/advisories/GHSA-ghv9-86vm-4v8m)), but it only applies when cross-spawn detects that the command is a batch file.\n\nThe detection could be bypassed when the command isn't written as a plain program name or path, while `cmd.exe` still runs a batch file:\n\n- the command contains double quotes, e.g. `spawn('\"tool.bat\"', args)` or `spawn('\"tool\"', args)`;\n- the command contains a space, tab, `,`, `;` or `=`, where `cmd.exe` ends the command name, e.g. `spawn('npm install', args)`, which runs `npm.cmd`;\n- the command ends with a tab or other whitespace;\n- the `PATHEXT` passed in `options.env` makes `cmd.exe` find a batch file that the parent's `PATHEXT` doesn't.\n\nIn those cases the arguments were escaped for a regular program, and an argument such as `\"&calc` could run arbitrary commands.\n\nApplications are affected if they run on Windows, pass a command in one of these forms, and pass untrusted input as arguments.\n\n### Patches\n\nFixed in 7.1.1 and 6.0.8. The command is now always quoted when it runs through `cmd.exe`, so `cmd.exe` treats it as a single name. Double quotes are removed from it first, since Windows file names can't contain them, and it's looked up with the child's `PATHEXT`. As a consequence, the command must be the name or path of a single program, as documented: `spawn('npm install')` now fails with `ENOENT`, like on other platforms.\n\nVersions before 6.0.0 are not maintained and won't be fixed. Upgrade to 7.1.1, or force it with `overrides` in `package.json`.\n\n### Workarounds\n\nPass the program as the command and its arguments in `args`, without quotes, e.g. `spawn('npm', ['install', ...])`, and don't set `PATHEXT` in `options.env`.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "cross-spawn"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "7.0.0"
      }, {
        "fixed" : "7.1.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "cross-spawn"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.0.8"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/moxystudio/node-cross-spawn/security/advisories/GHSA-w3gc-668g-rf8f"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-137197"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/moxystudio/node-cross-spawn/pull/196"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/moxystudio/node-cross-spawn/pull/197"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/moxystudio/node-cross-spawn/commit/4a15965b05415e9f817315206771b25558804b16"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/moxystudio/node-cross-spawn/commit/d0ead352a7380492cbb0f6548fa86f19448323c9"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/moxystudio/node-cross-spawn"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/moxystudio/node-cross-spawn/releases/tag/v6.0.8"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/moxystudio/node-cross-spawn/releases/tag/v7.1.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-12-04T19:52:52Z",
    "nvd_published_at" : "2026-11-30T21:17:25Z"
  }
}