CVE-2021-22921

7.8 HIGH

📋 TL;DR

This vulnerability allows local attackers on Windows systems to escalate privileges through PATH and DLL hijacking attacks. It affects Node.js installations where improper directory permissions enable attackers to place malicious files that get executed with elevated privileges. Users running vulnerable Node.js versions on Windows are affected.

💻 Affected Systems

Products:
  • Node.js
Versions: Node.js < 12.22.2, < 14.17.2, < 16.4.1
Operating Systems: Windows
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects Windows installations. Linux/macOS systems are not vulnerable. Requires local access to the system.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Local attacker gains SYSTEM/administrator privileges, enabling complete system compromise, data theft, persistence mechanisms, and lateral movement.

🟠

Likely Case

Local user with limited privileges escalates to administrator rights, potentially installing malware, accessing sensitive data, or modifying system configurations.

🟢

If Mitigated

With proper file permissions and user access controls, attack surface is reduced but still possible if initial access is obtained.

🌐 Internet-Facing: LOW - This is a local privilege escalation requiring initial access to the system.
🏢 Internal Only: HIGH - Internal users with local access to Windows systems running vulnerable Node.js can exploit this to gain administrative privileges.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: LOW

Exploitation requires local access to the Windows system. Attack vectors include placing malicious executables or DLLs in improperly secured Node.js installation directories.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Node.js 12.22.2, 14.17.2, 16.4.1 or later

Vendor Advisory: https://nodejs.org/en/blog/vulnerability/july-2021-security-releases/

Restart Required: No

Instructions:

1. Download and install patched Node.js version from nodejs.org. 2. Replace existing installation with updated version. 3. Verify installation with 'node --version' command.

🔧 Temporary Workarounds

Restrict Node.js directory permissions

windows

Manually set proper permissions on Node.js installation directory to prevent unauthorized file writes

icacls "C:\Program Files\nodejs" /inheritance:r /grant:r "Administrators:(OI)(CI)F" /grant:r "SYSTEM:(OI)(CI)F" /grant:r "Users:(OI)(CI)RX"

Use alternative installation methods

windows

Install Node.js via package managers that handle permissions properly or use containerized deployments

choco install nodejs
scoop install nodejs

🧯 If You Can't Patch

  • Implement strict file system permissions on Node.js installation directories
  • Monitor for unauthorized file creation/modification in Node.js directories using file integrity monitoring

🔍 How to Verify

Check if Vulnerable:

Check Node.js version with 'node --version' and compare against affected versions. Also verify Windows OS and installation directory permissions.

Check Version:

node --version

Verify Fix Applied:

Run 'node --version' to confirm version is 12.22.2, 14.17.2, 16.4.1 or higher. Verify directory permissions restrict write access to non-administrative users.

📡 Detection & Monitoring

Log Indicators:

  • File creation/modification events in Node.js installation directories by non-admin users
  • Process execution from Node.js directories with unexpected parent processes

Network Indicators:

  • Unusual outbound connections from Node.js processes running with elevated privileges

SIEM Query:

EventID=4663 OR EventID=4656 WHERE ObjectName LIKE '%nodejs%' AND SubjectUserName NOT IN ('SYSTEM', 'Administrators')

🔗 References

📤 Share & Export