vm2 Sandbox Escape Vulnerability (CVE-2026-47131)
A sandbox escape vulnerability exists in vm2 versions 3.11.3 and earlier, allowing attackers to execute arbitrary code on the host system by manipulating the prototype chain and exploiting Node.js error handling.
CVE search metadata
CVE search record: CVE-2026-47131. KEV: no. Product: vm2 (<= 3.11.3). Brief: vm2 Sandbox Escape Vulnerability (CVE-2026-47131). Brief link: https://feed.craftedsignal.io/briefs/2026-05-29-vm2-sandbox-escape/
Triage facts
Revision 2- Applicability
- vm2 (<= 3.11.3)
- Evidence
- Unknown
- Severity
- Critical
- Sources
- 2 public sources
- Freshness
- Revision 2May 29, 17:34 UTC
- Detection
- 2 rules
- Vulnerabilities
- 1 CVE
Revision history 1 entry · Revision 2
- Revision 2
Repaired a legacy canonical identity collision
Changed: slug
A critical sandbox escape vulnerability, tracked as CVE-2026-47131, has been identified in vm2, a popular Node.js sandbox environment. This flaw allows malicious code executed within the vm2 sandbox to break out and execute arbitrary commands on the host system. The vulnerability stems from the ability to manipulate JavaScript prototypes within the sandbox, specifically targeting the Buffer object and Node.js's error handling mechanisms. The exploit leverages the combination of Buffer.call.call({}.__lookupGetter__, Buffer, "__proto__"), Buffer.call.call({}.__lookupSetter__, Buffer, "__proto__"), and the ERR_INVALID_ARG_TYPE error to gain access to the host's TypeError constructor, ultimately leading to code execution outside the sandbox. This vulnerability impacts vm2 versions 3.11.3 and earlier.
Attack Chain
- The attacker injects malicious JavaScript code into the vm2 sandbox.
- The injected code uses
Buffer.call.call({}.__lookupGetter__, Buffer, "__proto__")to obtain the prototype getter of theBufferobject. - The injected code uses
Buffer.call.call({}.__lookupSetter__, Buffer, "__proto__")to obtain the prototype setter of theBufferobject. - The code triggers a
TypeErrorby attempting an invalid WebAssembly compilation viaWebAssembly.compileStreaming(). - The prototype of the
TypeErrorobject is then manipulated using the previously obtained getter and setter methods. - A second attempt to compile invalid WebAssembly triggers another
TypeError. - The constructor of this second
TypeErroris used to access theHostFunctionconstructor. - The
HostFunctionconstructor is used to create a function that returns theprocessobject, which is then used to execute arbitrary commands on the host system, bypassing the sandbox.
Impact
Successful exploitation of this vulnerability allows attackers to execute arbitrary code on the host system running the vm2 sandbox. This could lead to complete system compromise, data theft, or denial of service. Given the widespread use of vm2 in various applications, including CI/CD pipelines and online code execution environments, this vulnerability poses a significant risk. The vulnerability affects all users of vm2 versions 3.11.3 and earlier.
Recommendation
- Upgrade vm2 to a version greater than 3.11.3 to patch CVE-2026-47131.
- Monitor for suspicious process creation events originating from Node.js processes to detect potential exploitation attempts using the Sigma rule "Detect vm2 Sandbox Escape - Process Creation".
- Implement strict input validation and sanitization to prevent the injection of malicious JavaScript code into the vm2 sandbox.
- Review and restrict the use of
WebAssembly.compileStreaming()to prevent abuse, as demonstrated in the PoC.
Detection coverage 2
Detect vm2 Sandbox Escape - Process Creation
criticalDetects CVE-2026-47131 exploitation — creation of suspicious processes by node.js after sandbox escape
Detect vm2 Sandbox Escape - WASM CompileStreaming Error
highDetects CVE-2026-47131 exploitation — WASM compile streaming error followed by prototype manipulation attempts in node.js
Detection queries are available on the platform. Get full rules →