vm2 Sandbox Escape Vulnerability Leading to RCE
A sandbox escape vulnerability exists in the vm2 npm package, specifically in versions 3.10.5 and earlier, allowing an attacker to reach BaseHandler.getPrototypeOf via util.inspect, potentially leading to arbitrary prototype access and remote code execution (RCE).
CVE search metadata
CVE search record: CVE-2026-44006. KEV: no. Product: vm2 (<= 3.10.5). Brief: vm2 Sandbox Escape Vulnerability Leading to RCE. Brief link: https://feed.craftedsignal.io/briefs/2024-01-02-vm2-sandbox-escape/
Triage facts
Revision 2- Applicability
- vm2 (<= 3.10.5)
- Evidence
- Unknown
- Severity
- Critical
- Sources
- 1 public source
- Freshness
- Revision 2May 7, 03:54 UTC
- Detection
- 2 rules
- Vulnerabilities
- 1 CVE
Revision history 1 entry · Revision 2
- Revision 2
Repaired a legacy canonical identity collision
Changed: slug
The vm2 npm package, a sandbox for executing untrusted JavaScript code, is vulnerable to a sandbox escape that can lead to remote code execution (RCE). This vulnerability, affecting versions 3.10.5 and earlier, stems from the ability to reach BaseHandler.getPrototypeOf through manipulation of util.inspect. By exploiting this flaw, an attacker can gain access to arbitrary prototypes within the vm2 sandbox, bypassing security restrictions and ultimately executing arbitrary code on the host system. The vulnerability was reported on May 7, 2026, and poses a significant risk to applications relying on vm2 for secure JavaScript execution. Successful exploitation allows attackers to break out of the sandbox environment and compromise the underlying system.
Attack Chain
- The attacker crafts a malicious JavaScript payload designed to exploit the
util.inspectfunction within the vm2 sandbox. - The payload leverages the
subarrayandsliceproperties of theBuffer.prototypeto trigger theinspectfunction. - The
showHiddenandshowProxyoptions are enabled inutil.inspectto expose internal properties and proxies. - Within the
stylizefunction, the attacker gains access to theBaseHandler.getPrototypeOfmethod. - Using
getPrototypeOf, the attacker retrieves the prototype of theBufferobject multiple times to reach theHObjectProtoand subsequently its constructorHObject. - The attacker retrieves a symbol from the
Buffer.prototypeusingHObject.getOwnPropertySymbols. - A new object is created with the retrieved symbol as a key, whose value is a function that retrieves the
child_processmodule. - Finally, the attacker uses
child_process.execSyncto execute arbitrary commands on the host system, escaping the vm2 sandbox and achieving RCE.
Impact
Successful exploitation of this vulnerability allows attackers to bypass the vm2 sandbox and execute arbitrary commands on the host system. This can lead to complete system compromise, including data theft, malware installation, and denial of service. The vulnerability affects any application using vm2 versions 3.10.5 or earlier, potentially impacting a wide range of projects that rely on secure JavaScript execution. Given the severity (critical) and the potential for RCE, immediate action is required to mitigate this risk.
Recommendation
- Upgrade the
vm2npm package to a version greater than 3.10.5 to patch the vulnerability (CVE-2026-44006). - Monitor application logs for suspicious activity related to
util.inspectandBuffermanipulation, which may indicate exploitation attempts. - Implement strict input validation and sanitization to prevent attackers from injecting malicious JavaScript code into the vm2 sandbox.
Detection coverage 2
Detect vm2 Sandbox Escape - Suspicious util.inspect Usage
highDetects suspicious usage of util.inspect with showHidden and showProxy options, which is indicative of attempts to exploit the vm2 sandbox escape vulnerability.
Detect vm2 Sandbox Escape - child_process.execSync in WebAssembly
criticalDetects the execution of child_process.execSync within a WebAssembly module, which is a strong indicator of a sandbox escape attempt in vm2.
Detection queries are available on the platform. Get full rules →