Dev.to Security πŸ” Cybersecurity πŸ‘ 2 πŸ“– 2 min read

CVE-2026-137198: CVE-2026-137198: Argument Injection in Node.js cross-spawn via Improper Backslash Escaping on Windows

CVE-2026-137198: Argument Injection in Node.js cross-spawn via Improper Backslash Escaping on Windows Vulnerability ID: CVE-2026-137198 CVSS Score: 8.3 Published: 2026-12-04 CVE-2026-137198 is a high-severity argume

CVE-2026-137198: Argument Injection in Node.js cross-spawn via Improper Backslash Escaping on Windows

Vulnerability ID: CVE-2026-137198
CVSS Score: 8.3
Published: 2026-12-04

CVE-2026-137198 is a high-severity argument injection vulnerability (CWE-88) affecting the Node.js cross-spawn library in versions 6.0.6 and 7.0.4 through 7.0.6. On Windows systems, when commands are routed through cmd.exe (including batch files and npm cmd-shims in node_modules/.bin), cross-spawn fails to properly double contiguous sequences of two or more backslashes preceding a double quote or at the end of an argument. This parsing failure causes the argument's closing quotation mark to be escaped as a literal character, allowing attacker-controlled input to break out of quotation encapsulation and inject arbitrary command-line arguments or consume subsequent arguments.

TL;DR

An improper backslash escaping flaw in cross-spawn (versions 6.0.6 and 7.0.4 to 7.0.6) on Windows allows attackers to escape enclosing double quotes when commands are routed via cmd.exe, leading to arbitrary argument injection. Users must upgrade to cross-spawn 6.0.7 or 7.1.0.

⚠️ Exploit Status: POC

Technical Details

  • CVE ID: CVE-2026-137198 (GHSA-m6qr-m48x-3xhh)
  • Weakness Class: CWE-88: Argument Injection
  • CVSS v4.0 Score: 8.3 High (CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:N/VI:H/VA:L/SC:N/SI:N/SA:N)
  • EPSS Score: 0.562% (48.20th Percentile)
  • Affected Versions: cross-spawn 6.0.6 and 7.0.4 - 7.0.6 (Windows only)
  • Patched Versions: cross-spawn 6.0.7 and 7.1.0
  • Exploit Status: Proof-of-Concept (Unit test fixtures; not in CISA KEV)

Affected Systems

  • cross-spawn (npm package) on Microsoft Windows
  • cross-spawn: >= 6.0.6, < 6.0.7 (Fixed in: 6.0.7)
  • cross-spawn: >= 7.0.4, < 7.1.0 (Fixed in: 7.1.0)

Code Analysis

Commit: 1b71aa5

Fix argument escaping and hardening for cmd.exe on branch 6.x (v6.0.7)

Commit: 244ffea

Fix argument escaping and hardening for cmd.exe on branch 7.x (v7.1.0)

Mitigation Strategies

  • Upgrade cross-spawn to the latest patched version across direct and transitive dependencies.
  • Bypass cmd.exe routing on Windows by executing .exe binaries directly or invoking Node.js scripts via process.execPath instead of node_modules/.bin/*.cmd shims.
  • Enforce strict allowlist validation on user-supplied arguments passed to child processes, rejecting embedded double quotes, multiple contiguous backslashes, and newline characters.

Remediation Steps:

  1. Run npm ls cross-spawn (or yarn why cross-spawn / pnpm why cross-spawn) to identify all installed versions of cross-spawn across the project dependency tree.
  2. Upgrade cross-spawn on the 6.x branch to >= 6.0.7 and on the 7.x branch to >= 7.1.0 via npm update cross-spawn or npm audit fix.
  3. If cross-spawn is pinned by an upstream transitive dependency, configure an override in package.json (e.g., "overrides": { "cross-spawn": "^7.1.0" }) and regenerate the lockfile.
  4. Verify that any custom error handling accounts for the new TypeError thrown by cross-spawn 6.0.7 / 7.1.0 when arguments contain carriage return (\r) or newline (\n) characters on Windows.

References

Read the full report for CVE-2026-137198 on our website for more details including interactive diagrams and full exploit analysis.

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.