VM2 Sandbox Breakout Vulnerability via Promise Species Manipulation (CVE-2026-47208)
VM2 is vulnerable to a sandbox breakout vulnerability (CVE-2026-47208) that allows attackers to execute arbitrary commands on the host system by manipulating Promise species and escaping the sandbox context.
A critical sandbox breakout vulnerability (CVE-2026-47208) has been identified in vm2 versions 3.11.3 and earlier. This flaw allows an attacker with the ability to execute arbitrary code within the vm2 sandbox to escape the sandbox and achieve arbitrary code execution on the host system. The vulnerability arises due to a missing resetPromiseSpecies call within the localPromise constructor when handling rejected promises, leading to the possibility of injecting a custom promise with a specially crafted reject method. This bypasses the intended security boundaries of the vm2 sandbox.
Attack Chain
- Attacker gains initial code execution within the vm2 sandbox environment.
- Attacker defines a custom
FakePromiseclass with a getter forSymbol.speciesthat returns a custom constructorct. - Attacker defines a function
doCatchthat takes a functionfas input and creates a new Promise usingPromise.withResolvers(). - The custom constructor
ctis assigned to theSymbol.speciesof theFakePromiseclass within thedoCatchfunction. Thectconstructor defines how the promise will be resolved or rejected, intercepting errors. - The
FakePromiseconstructor is called with a resolver function, allowing the custom reject method inctto get called when a promise is rejected. - The attacker triggers an error within the sandbox (e.g., a
RangeErrorby overflowing the stack). The custom reject method inctintercepts the error, determines if it is aRangeErrorand not a standard Error object, and then executes host commands usingchild_process.execSync('touch pwned'). - A file named
pwnedis created on the host system, demonstrating successful code execution outside the sandbox. - The attacker now has arbitrary code execution on the host system.
Impact
Successful exploitation of CVE-2026-47208 allows an attacker to bypass the vm2 sandbox and execute arbitrary code on the host system. This can lead to complete system compromise, data theft, or denial-of-service. The severity is critical due to the ease of exploitation and the potential for widespread impact on applications relying on vm2 for sandboxing untrusted code. The number of victims depends on the adoption of the vulnerable vm2 package.
Recommendation
- Upgrade to vm2 version 3.11.4 or later to patch CVE-2026-47208.
- Deploy the Sigma rule "Detect VM2 Sandbox Escape via Promise Species Manipulation" to detect exploitation attempts by monitoring for the execution of
child_process.execSyncwithin the vm2 sandbox. - Review and restrict the use of vm2 in environments where untrusted code execution is a significant risk.
Detection coverage 2
Detect VM2 Sandbox Escape via Promise Species Manipulation
criticalDetects CVE-2026-47208 exploitation - execution of `child_process.execSync` within the vm2 sandbox indicating a sandbox escape attempt.
Detect VM2 Sandbox Escape via Promise Species Manipulation (Windows)
criticalDetects CVE-2026-47208 exploitation - execution of `child_process.execSync` within the vm2 sandbox on Windows, indicating a sandbox escape attempt.
Detection queries are available on the platform. Get full rules →