Symmetry was the bug
The PoC in the GitHub Security Advisory database is six executable lines.
const {VM} = require("vm2");
const vm = new VM();
console.log(vm.run(`
const o = {__proto__: null};
try {
throw o;
} catch (e) {
e.f = Buffer.prototype.inspect;
o.f.constructor("return process")().mainModule.require('child_process').execSync('touch pwned');
}
`));
The sandbox creates an object with no prototype, throws it, catches it. Inside the catch, it writes Buffer.prototype.inspect (a sandbox-visible proxy of a host function) to a property on the caught value. Then it reads the same property through the original sandbox reference o, not the catch-clause binding e, and treats the result as a host-realm Function constructor's parent. Function("return process")() returns the host process object. child_process.execSync is the next call.
That last step works because of what handleException did between the throw and the catch.
vm2's bridge presents the sandbox with proxies of every host-realm object it can see. The sandbox treats Buffer.prototype.inspect as a proxy whose get and apply traps refuse any read that would surface a host-realm reference. Property access for .constructor on a host function returns a sandbox-realm sentinel; .apply is interposed; the prototype chain is rewritten on every read. The proxy is the membrane.
When sandbox code throws, the value reaches every catch clause through the vm2 transformer's instrumentation: catch (e) { e = handleException(e); ... }. handleException is the chokepoint for "every value entering a catch clause." Defense Invariant #2 in vm2's own docs/ATTACKS.md, in the same git tree:
All caught exceptions are sanitized. Every value entering a catch clause passes through handleException. Paths that bypass JS-level catch instrumentation (Wasm try_table, host-realm Promise.then rejection) are closed at the bridge.
The post-GHSA-mpf8 implementation of handleException honored that invariant by calling from(e). from is the bridge's general-purpose cross-realm wrapper: given any value the bridge cannot find in its identity WeakMaps, return a new bridge proxy. For a host-realm null-proto value, this is correct. The wrapped proxy intercepts every read, refuses dangerous protocol gets, and returns sandbox-safe surrogates.
For a sandbox-realm null-proto value, from is the bug. The bridge has no WeakMap entry for the sandbox object and treats the missing entry as evidence that the value came from the other realm. It constructs a proxy around o itself with the bridge treating the underlying target as host-side. When sandbox code does e.f = Buffer.prototype.inspect, the proxy's set trap interprets the assignment as a write of a sandbox value onto a host object, and runs the trap's host-side-store path: it unwraps the incoming sandbox proxy of Buffer.prototype.inspect back to the raw host function before storing.
o.f now holds the raw, unproxied host-realm Buffer.prototype.inspect.
The catch-clause binding e would still mediate the read through the proxy, and the read of e.f would re-wrap. The sandbox does not read through e. It reads through o, the original closure binding. o.f skips the trap entirely. o.f.constructor walks the raw host prototype chain to host Function. The host Function constructor compiles strings into functions executing in the host realm. The remainder of the PoC is the canonical pivot.
The patch's commit message names the path step by step:
from() builds a sandbox-side proxy whose target the bridge treats as host-realm; when called on a sandbox-realm null-proto value, the proxy's set trap unwraps incoming sandbox proxies of host references back to raw host originals and stores them on the underlying sandbox object. The original sandbox reference then yields the raw host fn → .constructor is host Function → RCE.
The chokepoint that cannot be one chokepoint
handleException has three sandbox-side callers, all wired up in lib/setup-sandbox.js:
- The transformer-instrumented JS
catch block: every catch (e) { ... } in user code becomes catch (e) { e = handleException(e); ... }.
- The sandbox-side
globalPromise.prototype.then onRejected wrap.
- The
localPromise executor's swallow tail, which runs handleException on errors thrown by the user-supplied executor.
All three deliver sandbox-realm values. The transformer instruments sandbox source; the Promise wraps run on sandbox-allocated Promises whose resolution values are sandbox objects by construction. Host-realm exceptions cross the bridge through a separate path entirely: the bridge's apply-trap interception of host Promise.prototype.then, which installs sanitizing wrappers at the boundary between host Promise machinery and sandbox callbacks.
That separation is what GHSA-mpf8 closed. The host-Promise apply-trap path was the asymmetry: rejection callbacks the sandbox registered on host-realm promises saw raw host rejection values. The fix added an install site, bridge.setHostPromiseSanitizers(handleException, from), that wrapped both fulfillment and rejection callbacks through the same sanitizers used by the sandbox-realm Promise overrides. Then the follow-on commit, b57ac2d, propagated the choice of from from the install site into handleException itself, on the reasoning that the function should treat every value as potentially cross-realm regardless of which caller invoked it.
Three months of advisories later, the propagation is reverted. The install site is rewritten so the cross-realm wrap happens outside handleException, at the one callsite where the value really is host-realm:
if (typeof bridge.setHostPromiseSanitizers === 'function') {
- bridge.setHostPromiseSanitizers(handleException, from);
+ bridge.setHostPromiseSanitizers(e => handleException(from(e)), from);
}
The from() call moves outside handleException and into a per-callsite closure. handleException itself becomes sandbox-realm-only. The chokepoint that was one function is now two contracts: every caller decides which realm its value comes from, and wraps accordingly. Defense Invariant #2 still reads "every value entering a catch clause passes through handleException." Its enforcement is now spread across the bridge boundary rather than concentrated at the function.
The fix is a revert because the boundary cannot be symmetric
The thing the GHSA-mpf8 fix and the GHSA-9vg3 fix have in common is that both call from(). The thing they cannot have in common is which null-proto value from() should be called on. Sandbox-realm null-proto values and host-realm null-proto values are indistinguishable from inside handleException: both have null prototypes, both fail the bridge's identity-WeakMap lookups, both arrive as caught exceptions. The two fixes alternated on the same line because the same line could not tell them apart.
handleException is a design-debt driver at the function level. A prior post in this series counted five fixes that touched this function across thirty-two months, all closing the same general shape (a cross-realm reference reaching sandbox code through a caught exception) by tightening the wrap at one of three boundaries: the function itself, the bridge install site, or the in-sandbox catch transformer. The current commit is the sixth fix. It moves the wrap from the function to the install site. The next fix will move it to the transformer, or back, or to a new boundary that does not exist yet. The maintainer's source comment for the new patch cites the previous commit by hash and labels its hardening as the vulnerability it is reverting: Reverts the b57ac2d "GHSA-mpf8 symmetry" change. Naming the prior CVE inside the patch for the next one is the maintainer's own concession that the function is the debt, not any one of its bug instances.
What no fix moves is the property the bridge's set trap exercises. The trap unwraps incoming sandbox proxies of host references when it believes its target is host-realm, because that is what set traps on bridge proxies are for. The trap does the right thing for every host-realm target. It does the wrong thing when an upstream chokepoint mislabels a sandbox-realm target. The fix is to stop mislabeling.
ATTACKS.md gains Category 26
vm2 maintains a 3,161-line internal document at docs/ATTACKS.md titled "Sandbox Escape Attack Patterns." Its preamble:
This document catalogs known attack patterns used to circumvent the vm2 sandbox. It is intended for AI agents and reviewers evaluating new code contributions. Each section describes a category of attack, provides canonical examples, explains why it is dangerous, and lists detection heuristics for spotting similar patterns in contributed code.
The document is the maintainer's working enumeration of the places the membrane has been or could be torn. There are 35 categories as of v3.11.5, organized into three tiers: Primitives (1 through 5), Techniques (6 through 15), Compound Attacks (16 and up). Each category cites the advisory that motivated it. The null-proto throw is Category 26. The 3.11.2 release that fixes it also adds Category 27 (computed-key probes of globalThis that surface bridge internal state) and Category 28 (sandbox-installed Array.prototype[N] setters that capture bridge saved state). Three release tags and two weeks later, the document is at Category 35.
The CHANGELOG documents the release cadence in vm2's own words:
[3.11.5] 2026-05-18 - two regression fixes
[3.11.4] 2026-05-16 - ten advisories closed
[3.11.3] 2026-05-13 - one advisory
[3.11.2] 2026-05-03 - three advisories (this one)
[3.11.1] 2026-04-22 - one advisory
[3.11.0] 2026-04-15 - six advisories
Twenty-three CVEs in five weeks. The README, in the same git tree as the CHANGELOG, in the same release:
Despite our best efforts, researchers and security professionals continuously discover new ways to escape the vm2 sandbox.
That sentence is the project's release-cycle disclaimer. It is also a public admission about an unpatchable primitive: the bug class is the design's purpose, the thing producing CVEs is the same thing that makes the component work, and patches close instances while the primitive remains. The catalog of fix functions in lib/setup-sandbox.js (resetPromiseSpecies, neutralizeArraySpeciesBatch, the WebAssembly.JSTag deletion, the AsyncGenerator wrap, the SuppressedError recursion, and now the handleException/setHostPromiseSanitizers rearrangement) is the formal enumeration of places the proxy bridge has conceded it cannot generally reach. Each entry is a per-feature, reactive patch. The vocabulary grows by one entry per advisory.
The architectural reason, in the maintainer's words
docs/ATTACKS.md opens its "Realm Separation" section with the design statement at the level the patches cannot reach:
vm2 runs untrusted code inside a V8 context created by Node.js's vm module. Host and sandbox share the same V8 isolate. They execute on the same thread, in the same heap. The sandbox gets its own set of global intrinsics (Object, Function, Array, Error, etc.), but these are all allocated from the same memory space as the host's intrinsics. There is no process boundary, no memory isolation, and no privilege separation at the OS level. If an attacker obtains a reference to any host-realm constructor, they can evaluate arbitrary code in the host context.
The bridge proxy model is the membrane. The membrane is a hand-written collection of Proxy traps with manually-maintained identity-preservation WeakMaps. Every trap is an attack surface. Every gap is a potential escape. The CVE record's description of GHSA-9vg3 is one gap of one method on one trap on one chokepoint where the chokepoint's realm-assumption could not match the value's actual realm.
CVE-2026-44009 is the latest published advisory against a design whose maintainer's README, ATTACKS.md, and CHANGELOG all describe the same structural property: the design grants the primitive that produces the CVEs.
PoC: GHSA-9vg3-4rfj-wgcm. Patch: c33c2bb. The prior fix it reverts: b57ac2d (GHSA-mpf8-4hx2-7cjg). Category 26 in docs/ATTACKS.md.
Some patches close a bug. The patch for CVE-2026-44009 closes the patch.