CVE-2021-23449
📋 TL;DR
CVE-2021-23449 is a Prototype Pollution vulnerability in the vm2 sandbox package that allows attackers to escape the sandbox and execute arbitrary code on the host system. This affects any application using vulnerable versions of vm2 to run untrusted JavaScript code. The vulnerability is particularly dangerous because it breaks the fundamental security boundary of the sandbox.
💻 Affected Systems
- vm2 sandbox library
📦 What is this software?
Vm2 by Vm2 Project
⚠️ Risk & Real-World Impact
Worst Case
Full host system compromise with attacker gaining complete control over the server, allowing data theft, lateral movement, and persistent backdoor installation.
Likely Case
Remote code execution leading to data exfiltration, cryptocurrency mining, or ransomware deployment on affected servers.
If Mitigated
Limited impact if vm2 is only used with trusted code or in isolated environments, but still represents a significant security boundary violation.
🎯 Exploit Status
Public proof-of-concept exploits are available and weaponized attacks have been observed. Exploitation requires the ability to provide JavaScript code to the vm2 sandbox.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 3.9.4 and later
Vendor Advisory: https://github.com/patriksimek/vm2/security/advisories/GHSA-ch3r-j5x3-6q2m
Restart Required: Yes
Instructions:
1. Update vm2 dependency to version 3.9.4 or later. 2. Run 'npm update vm2' or 'yarn upgrade vm2'. 3. Restart all Node.js applications using vm2. 4. Test that sandbox functionality still works as expected.
🔧 Temporary Workarounds
Disable vm2 usage
allTemporarily disable or remove vm2 functionality until patching is possible
Comment out or remove vm2 import/usage in application code
Input validation and sanitization
allImplement strict validation of all input passed to vm2 sandbox
🧯 If You Can't Patch
- Isolate affected systems from critical networks and data
- Implement strict network segmentation and monitor for unusual outbound connections
🔍 How to Verify
Check if Vulnerable:
Check package.json or run 'npm list vm2' to see installed version. If version is below 3.9.4, the system is vulnerable.
Check Version:
npm list vm2 | grep vm2
Verify Fix Applied:
After updating, verify vm2 version is 3.9.4 or higher with 'npm list vm2' and test sandbox functionality with known safe test cases.
📡 Detection & Monitoring
Log Indicators:
- Unusual process spawns from Node.js applications
- Sandbox escape attempts in application logs
- Unexpected file system access patterns
Network Indicators:
- Outbound connections from Node.js processes to unexpected destinations
- Command and control traffic patterns
SIEM Query:
process.name:node.exe AND (process.args:*vm2* OR process.args:*sandbox*) AND (process.parent.name:cmd.exe OR process.parent.name:powershell.exe)
🔗 References
- https://github.com/patriksimek/vm2/commit/b4f6e2bd2c4a1ef52fc4483d8e35f28bc4481886
- https://github.com/patriksimek/vm2/issues/363
- https://github.com/patriksimek/vm2/releases/tag/3.9.4
- https://security.netapp.com/advisory/ntap-20211029-0010/
- https://snyk.io/vuln/SNYK-JS-VM2-1585918
- https://github.com/patriksimek/vm2/commit/b4f6e2bd2c4a1ef52fc4483d8e35f28bc4481886
- https://github.com/patriksimek/vm2/issues/363
- https://github.com/patriksimek/vm2/releases/tag/3.9.4
- https://security.netapp.com/advisory/ntap-20211029-0010/
- https://snyk.io/vuln/SNYK-JS-VM2-1585918