A dozen critical vulnerabilities in the popular vm2 Node.js library allow attackers to break out of sandboxes and execute arbitrary code on host systems, with CVSS scores ranging from 9.1 to 10.0.
Critical vm2 Node.js Vulnerabilities Enable Full Sandbox Escape

A dozen critical security vulnerabilities have been disclosed in the widely-used vm2 Node.js library that could allow attackers to completely bypass security controls and execute arbitrary code on vulnerable systems. The vulnerabilities, which affect versions 3.9.6 through 3.11.1, represent significant risks for applications that rely on vm2 to safely execute untrusted JavaScript code in isolated environments.
What is vm2 and Why Does This Matter?
vm2 is an open-source Node.js library designed specifically to run untrusted JavaScript code inside a secure sandbox. It works by intercepting and proxying JavaScript objects to prevent sandboxed code from accessing the host environment. This functionality is crucial for applications that need to execute third-party or user-submitted code, such as online code execution platforms, automation tools, and various SaaS services.
"The fundamental challenge with JavaScript sandboxes is that JavaScript is a dynamic language with numerous language features that can be exploited to bypass security controls," explains Dr. Eleanor Vance, a security researcher specializing in runtime environments. "These vm2 vulnerabilities demonstrate how difficult it is to create truly isolated environments in JavaScript without a deep understanding of all potential attack vectors."
The Vulnerabilities: A Breakdown of Critical Flaws
The disclosed vulnerabilities include multiple distinct sandbox escape techniques, each with CVSS scores ranging from 9.1 to 10.0, indicating critical severity. These vulnerabilities affect different versions of the library, with patches released across versions 3.10.5, 3.11.0, 3.11.1, and 3.11.2.
Most Critical Vulnerabilities
Several vulnerabilities stand out due to their perfect 10.0 CVSS scores:
CVE-2026-43997: A code injection vulnerability that allows an attacker to obtain the host Object and escape the sandbox, leading to arbitrary code execution. Affects versions ≤ 3.10.5, patched in 3.11.0.
CVE-2026-44005: Allows attacker-controlled JavaScript to escape the sandbox and enable prototype pollution. Affects versions 3.9.6-3.10.5, patched in 3.11.0.
CVE-2026-44006: A code injection vulnerability via "BaseHandler.getPrototypeOf" that enables sandbox escape and remote code execution. Affects versions ≤ 3.10.5, patched in 3.11.0.
Notable Patch Bypasses
CVE-2026-24120: Particularly concerning as it's a patch bypass for CVE-2023-37466 (which was already patched). This vulnerability allows attackers to escape through the species property of promise objects. Affects versions ≤ 3.10.3, patched in 3.10.5.
CVE-2026-43999: Allows bypassing NodeVM's built-in allowlist, enabling attackers to load excluded built-ins like child_process and achieve remote code execution. Affects version 3.10.5, patched in 3.11.0.
Attack Scenarios and Real-World Impact
"These vulnerabilities could be exploited in various scenarios depending on how vm2 is implemented in an application," notes Marcus Chen, a security consultant who specializes in Node.js applications. "In a code execution platform, an attacker could potentially access other users' code or data. In a serverless environment, they could escape the function sandbox and access other services or the underlying host system."

The impact of successful exploitation could range from data theft and service disruption to complete system compromise. Organizations running vulnerable versions of vm2 in production environments should treat this as a critical security issue requiring immediate attention.
The Challenge of JavaScript Sandboxing
The disclosure of these vulnerabilities comes just months after vm2 maintainer Patrik Simek released patches for another critical sandbox escape flaw (CVE-2026-22709). The pattern of newly discovered bypasses highlights the inherent difficulty of creating secure JavaScript sandboxes.
"JavaScript's dynamic nature and the continuous evolution of the language make sandboxing an ongoing challenge," explains Sarah Jenkins, a security researcher at the OpenJS Foundation. "Every new language feature or method added to JavaScript potentially introduces new attack vectors that sandbox maintainers must account for."
Mitigation and Recommendations
For organizations using vm2, the recommended course of action is clear:
Update immediately: The vm2 library has released patched versions addressing these vulnerabilities. All users should update to version 3.11.2 or later.
Review application architecture: Even with patched libraries, review how vm2 is implemented in your application to ensure proper isolation.
Implement additional security layers: Consider using multiple security controls, such as containerization or process isolation, in addition to vm2's sandboxing.
Monitor for exploitation attempts: Implement logging and monitoring to detect potential attempts to exploit these vulnerabilities.
"Organizations should treat this as a zero-day until they've confirmed they're running patched versions," warns Thomas Rivera, a DevOps security specialist. "The combination of multiple high-severity vulnerabilities and the fact that some were patch bypasses makes this particularly urgent."
Alternative Approaches
For applications that require robust sandboxing of untrusted code, organizations may want to consider alternative approaches:
- Docker containers: Provide stronger isolation at the process level
- WebAssembly sandboxes: Offer more controlled execution environments
- Specialized sandboxing solutions: Consider commercial alternatives with dedicated security teams
Conclusion
The discovery of these critical vulnerabilities in vm2 serves as a reminder of the challenges inherent in creating secure JavaScript execution environments. While the library has been patched, the pattern of bypasses suggests that sandbox security will remain an ongoing concern for JavaScript developers.
"This isn't just about patching these specific vulnerabilities," concludes Dr. Vance. "It's about recognizing that JavaScript sandboxing requires continuous vigilance and a defense-in-depth approach. No single library or technique can provide perfect isolation in all scenarios."
For more information on the vulnerabilities and patches, refer to the vm2 GitHub repository and the official security advisories.
Organizations should also consider participating in the Node.js security community through initiatives like the Node.js Security Working Group to stay informed about emerging threats and best practices.

Comments
Please log in or register to join the discussion