VM2 Sandbox Escape via JSPI Promise .finally() Species Bypass (CVE-2026-47210)
A sandbox escape vulnerability, CVE-2026-47210, in `vm2` allows arbitrary code execution in the host process when untrusted code is executed with async support on runtimes exposing WebAssembly JSPI, bypassing Promise-species hardening and exposing a host-originated rejection object to attacker-controlled species logic.
A critical sandbox escape vulnerability exists in vm2 (versions 3.11.3 and earlier) that allows for arbitrary code execution on the host system. This vulnerability, assigned CVE-2026-47210, occurs when vm2 is used with Node.js runtimes (specifically Node 26) that expose WebAssembly JSPI features (WebAssembly.promising / WebAssembly.Suspending). By exploiting the interaction between JSPI-backed Promises and the .finally() method, an attacker can bypass the intended sandbox protection and gain access to the host process. This bypass exposes a host-originated TypeError during JSPI processing which exposes a usable host constructor chain within attacker-controlled species logic. This can lead to full compromise of services relying on vm2 isolation.
Attack Chain
- Attacker provides untrusted JavaScript code to the
vm2sandbox environment. - The JavaScript code leverages WebAssembly JSPI features, specifically
WebAssembly.promisingandWebAssembly.Suspending, to create JSPI-backed Promises. - The attacker manipulates the JSPI-backed Promise to reach the
Promise.prototype.finally()method. - The
finally()method is triggered, leading to execution of attacker-controlled species logic. - A host-originated
TypeErroris generated during JSPI processing due to the Promise rejection. - The rejection object from the TypeError exposes a host constructor chain to the attacker.
- The attacker utilizes the host constructor chain to gain access to the host
processobject. - The attacker leverages the
processobject (e.g.,process.mainModule.require('child_process').execSync) to execute arbitrary commands on the host system, escaping the sandbox.
Impact
This vulnerability allows for a complete sandbox escape, leading to arbitrary code execution in the host process. This poses a significant risk to applications relying on vm2 for security isolation. Successful exploitation can result in arbitrary command execution, unauthorized file access (read/write), theft of sensitive data (secrets, tokens, credentials), and full compromise of services utilizing vm2. This issue affects applications using vm2 to execute untrusted JavaScript, especially those running on Node.js 26.
Recommendation
- Upgrade
vm2to a version greater than 3.11.3 to patch CVE-2026-47210. - Apply the following rules to detect potential exploitation attempts targeting
vm2sandboxes. - Monitor process creation events for unexpected child processes spawned from Node.js processes, especially if they involve command execution (Rule: "Detect Suspicious Child Process from Node.js").
- Monitor
vm2for suspicious activity related to WebAssembly and Promise handling (Rule: "Detect vm2 WebAssembly Promise .finally()").
Detection coverage 2
Detect Suspicious Child Process from Node.js
highDetects unusual child processes spawned from Node.js processes, potentially indicating command execution after a vm2 sandbox escape.
Detect vm2 WebAssembly Promise .finally()
mediumDetects vm2 activity involving WebAssembly, Promises, and the .finally() method, indicating potential exploitation of CVE-2026-47210.
Detection queries are available on the platform. Get full rules →