PortGate

Advisories · Node.js & Next.js

CVE-2024-27980 High CVSS 8.1

Node.js Windows command injection in child_process

Disclosed 2024 · Last reviewed 2 Dec 2026

On Windows, a batch file spawned by child_process could run extra commands when arguments contained special characters.

What happened

Node.js did not escape arguments the way cmd.exe parses a batch file.

Affected and patched versions

Affected
Node.js 18 before 18.20.2, 20 before 20.12.2, and 21 before 21.7.3 on Windows.
Patched
Node.js 18.20.2, 20.12.2, 21.7.3, and later. Linux is not this bug.

How to check your server

Check

node -v

How to fix and harden

  1. Run node -v on the Windows host.
  2. Upgrade Node.js on that major.
  3. Linux production hosts are a different platform. Still pin Node so a Windows build machine is not left behind.

Fix

node -v

Sources

Version ranges and fixes follow the vendor advisory. When a distribution backports a fix, trust its security tracker over the upstream version number. New advisories: RSS · JSON