CVE-2024-27980

8.1 HIGH

📋 TL;DR

This vulnerability in Node.js allows command injection through malicious batch file arguments in child_process.spawn/spawnSync functions, even when shell option is disabled. Attackers can achieve remote code execution by crafting specific command line arguments. Affects Node.js applications using these functions with untrusted input.

💻 Affected Systems

Products:
  • Node.js
Versions: All versions before 18.20.3, 20.13.1, 21.7.3, and 22.0.0
Operating Systems: All platforms supporting Node.js
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects applications using child_process.spawn or child_process.spawnSync with untrusted command line arguments. The vulnerability exists even when shell option is false.

⚠️ Manual Verification Required

This CVE does not have specific version information in our database, so automatic vulnerability detection cannot determine if your system is affected.

Why? The CVE database entry doesn't specify which versions are vulnerable (no version ranges provided by the vendor/NVD).

🔒 Custom verification scripts are available for registered users. Sign up free to download automated test scripts.

Recommended Actions:
  1. Review the CVE details at NVD
  2. Check vendor security advisories for your specific version
  3. Test if the vulnerability is exploitable in your environment
  4. Consider updating to the latest version as a precaution

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full remote code execution with the privileges of the Node.js process, potentially leading to complete system compromise, data theft, or lateral movement.

🟠

Likely Case

Limited code execution within the application context, allowing file system access, data exfiltration, or further privilege escalation.

🟢

If Mitigated

No impact if proper input validation and sanitization are implemented, or if the application doesn't use child_process functions with untrusted input.

🌐 Internet-Facing: HIGH - Web applications accepting user input that gets passed to child_process functions are directly exploitable from the internet.
🏢 Internal Only: MEDIUM - Internal applications using child_process with untrusted input remain vulnerable to authenticated or internal attackers.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires the application to pass untrusted input to child_process functions. The vulnerability is in how Node.js handles batch file arguments on Windows systems.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Node.js 18.20.3, 20.13.1, 21.7.3, or 22.0.0

Vendor Advisory: https://nodejs.org/en/blog/vulnerability/april-2024-security-releases

Restart Required: Yes

Instructions:

1. Identify Node.js version with 'node --version'. 2. Update to patched version using package manager (npm, nvm, or system package manager). 3. Restart all Node.js applications and services.

🔧 Temporary Workarounds

Input validation and sanitization

all

Validate and sanitize all user input before passing to child_process functions. Use allowlists for command arguments.

Avoid untrusted input in child_process

all

Refactor applications to avoid passing untrusted user input to child_process.spawn or spawnSync functions.

🧯 If You Can't Patch

  • Implement strict input validation and sanitization for all parameters passed to child_process functions
  • Use application-level firewalls or WAFs to block suspicious command patterns
  • Run Node.js with minimal privileges and in isolated environments

🔍 How to Verify

Check if Vulnerable:

Check Node.js version with 'node --version'. If version is below 18.20.3, 20.13.1, 21.7.3, or 22.0.0, the system is vulnerable if using child_process functions with untrusted input.

Check Version:

node --version

Verify Fix Applied:

After updating, verify with 'node --version' shows patched version. Test application functionality with child_process calls.

📡 Detection & Monitoring

Log Indicators:

  • Unusual child process spawns from Node.js applications
  • Suspicious command line arguments in process execution logs
  • Multiple failed child process spawn attempts

Network Indicators:

  • Unexpected outbound connections from Node.js processes
  • Data exfiltration patterns from application servers

SIEM Query:

process.name:node.exe AND process.args:*cmd* OR process.args:*powershell* OR process.args:*batch*

🔗 References

📤 Share & Export