//nefariousplan

CVE-2026-44001: vm2 Wrapped onRejected on `.then` and `.catch`. The Executor Was Not a Callback.

vendor

patterns

cve

proof of concept

The fix for CVE-2026-22709 in vm2 v3.10.2 wrapped the onRejected callback on the sandbox's Promise.prototype.then and Promise.prototype.catch. Both wrappers exist to convert a host-realm error, thrown from inside a sandbox-supplied rejection handler, into a sandbox-realm error before it becomes the next promise's rejection reason. A Promise becomes rejected at three call sites visible to sandbox code: the executor passed to new Promise(...), the onFulfilled of a .then, and the onRejected of a .then or .catch. The 3.10.2 patch covered the second and third. The first is CVE-2026-44001.

The exploit is four lines

The PoC published with GHSA-hw58-p9xv-2mjh is four lines of sandbox JavaScript:

const { VM } = require("vm2");
const vm = new VM({ timeout: 5000, allowAsync: false });

vm.run(`
  new Promise(function(r, j) {
    var e = new Error();
    e.name = Symbol();
    e.stack;
  });
`);
// Process exits with [UnhandledPromiseRejection: TypeError ...]

Read it from the inside out. The executor (the function passed to new Promise) constructs a host-realm Error instance. It assigns the Error's .name property to a fresh Symbol. Symbols are not strings; ECMAScript's ToString(Symbol) algorithm throws a TypeError unconditionally. The next line reads error.stack.

The .stack getter in V8 formats the stack trace by concatenating ${error.name}: ${error.message}\n with each captured frame. That formatting calls ToString on error.name. error.name is a Symbol. ToString(Symbol) throws TypeError. The throw originates inside V8's stack formatter, not inside any JavaScript callback the sandbox can wrap.

The TypeError propagates out of the .stack getter and out of the executor. ECMA-262 §27.2.3.1 specifies the behavior when an executor's body completes abruptly: the Promise is rejected with the completion's value as its rejection reason. The Promise the sandbox just constructed is now rejected with a host-realm TypeError. The sandbox holds no reference to the Promise. The constructor expression is the last statement; the Promise is never assigned, never chained, never awaited.

Node's default unhandledRejection mode in 15.0 and later is throw. The host process's microtask queue picks up the rejection, finds no handler attached, and terminates the process. Five tokens of sandbox JavaScript exit the host.

V8's stack formatter is the part the sandbox cannot wrap

vm2's bridge intercepts every host-to-sandbox boundary crossing it can see. The bridge is a Proxy over every host-realm value the sandbox is allowed to touch. When sandbox code reads a property on a host object, the proxy's get trap fires. When sandbox code calls a host function, the proxy's apply trap fires. The bridge's job, for years of CVE history, is converting host references into sandbox references on the way in and sandbox references into host references on the way out.

The bridge does not see V8's C++.

Error.prototype.stack's getter is implemented by the engine. The default formatter is Error.prepareStackTrace (when set) or V8's internal FormatStackTrace, which composes the string by calling ToString on error.name. The call site is inside libv8, not inside JavaScript the bridge can intercept. The TypeError that arises from ToString(Symbol) is constructed by V8 in the host realm and thrown into the JavaScript frame that triggered the formatter call.

This is the same shape as the species-bypass family the bridge has been adding named defenses for since 2023. resetPromiseSpecies exists in lib/setup-sandbox.js because Promise.prototype.then calls SpeciesConstructor in V8's C++, and the bridge cannot interpose. neutralizeArraySpeciesBatch exists in lib/bridge.js because ArraySpeciesCreate calls Get(O, "constructor") in V8's C++, and the bridge cannot interpose. The pattern is documented in the codebase as the V8-internal-bypass class, and vm2's own patch for CVE-2026-24118 names the category by citing its sibling.

The stack formatter is another instance. The bridge cannot interpose. The defense has to be elsewhere.

The 3.10.2 patch wrapped what the sandbox attached. The executor is what the sandbox passes.

CVE-2026-22709's fix lives in the sandbox's overrides of Promise.prototype.then and Promise.prototype.catch. The override replaces onRejected with a wrapper that converts any host-realm error thrown from inside the user's rejection handler into a sandbox-realm error before re-raising. The wrapper exists because the prior CVE's primitive was: throw a host-realm reference from inside an onRejected callback, and watch the bridge route the host reference straight into sandbox-visible code via the rejected promise's next handler.

The wrap location is the place the sandbox supplies a callback to V8's Promise machinery. .then(onFulfilled, onRejected) is a callback registration; the sandbox sees the registration call and wraps both arguments. .catch(onRejected) is the same registration with onFulfilled defaulted to identity; same wrap.

new Promise(executor) is not a callback registration. The sandbox does not register the executor with anything. The executor is the value the sandbox passes as the constructor's first argument, and the constructor calls it synchronously, before any object the sandbox can attach to exists. By the time the constructor returns the Promise to the sandbox, the executor has already finished. If the executor threw, the Promise is already rejected.

The 3.10.2 patch is correct for the threat model it was patched against. It blocks host-realm references thrown from the callbacks the patch knows about. It does not block host-realm references thrown from the call site that runs before any callback is registered, because no callback is involved.

The CVE description names this gap exactly:

The fix for CVE-2026-22709 (v3.10.2) only sanitized the onRejected callback in .then() and .catch() overrides and did not address the executor-to-unhandledRejection path.

executor-to-unhandledRejection is the path. The 3.10.2 patch wrapped two of three rejection paths the sandbox sees. The third is the one that ran before the sandbox saw anything.

allowAsync: false is the option that makes the exploit unblockable

The PoC sets allowAsync: false. vm2's documentation describes the flag as: when false, block async-related language features for stricter isolation. The implementation in lib/setup-sandbox.js:

if (!allowAsync) {
    overrideWithProxy(PromisePrototype, 'then', PromisePrototype.then, AsyncErrorHandler);
}

When allowAsync is false, the sandbox replaces Promise.prototype.then with an AsyncErrorHandler that throws whenever sandbox code calls it. .catch(...) is desugared by V8 to .then(undefined, onRejected); the call still reaches then, which is now the error handler. .catch therefore also throws.

new Promise(...) is not overridden. The Promise constructor is reachable.

For sandbox code under allowAsync: false:

  • new Promise(executor) still works.
  • The executor can throw.
  • The Promise becomes rejected.
  • The sandbox cannot call .then to attach a handler.
  • The sandbox cannot call .catch to attach a handler.
  • The rejection cannot be suppressed from inside the sandbox.
  • Node's unhandledRejection fires on the host.
  • The process dies.

Under allowAsync: true, sandbox code that wanted to suppress the rejection could write new Promise(badExecutor).catch(() => {}) and the executor's throw would land in the no-op handler. The bug would not become an unhandled rejection. The crash would not happen.

allowAsync: false is the option callers set when they want the strictest available isolation. It is also the option in which the exploit's last line of defense (a sandbox-attached .catch) is unreachable. The configuration that callers picked because the documentation labeled it stricter is the configuration in which the crash is guaranteed.

The 3.11.0 fix has to live in the constructor

vm2 3.11.0's release notes describe the fix as wrapping the Promise constructor's executor so the executor's throw is intercepted before it can become an unhandled rejection on the host. The shape this fix has to take, given the sandbox's existing localPromise class in lib/setup-sandbox.js:

const globalPromise = global.Promise;
class localPromise extends globalPromise {}

The fix has to extend localPromise's constructor to invoke the executor inside a try/catch, convert any host-realm completion to a sandbox-realm completion through the bridge's existing wrap functions, reject the Promise via its own reject capability, and (so the rejection does not propagate to the host) ensure a handler the host can see is attached before the microtask queue runs. The pattern is the same shape as resetPromiseSpecies, the same shape as neutralizeArraySpeciesBatch, the same shape as every other V8-internal-bypass defense vm2 has added: per-built-in, per-call-site, per-feature. The defense library grows by one entry.

The release that ships this fix is the same release that closed twelve other GHSA advisories on the same day. CVE-2026-44001 is one entry in the v3.11.0 batch. The builtin allowlist case is another. The util.inspect callback case is another. The Buffer.alloc opt-in case is another. Each of the thirteen is a distinct entry point to the same primitive: sandbox-influenced execution reaches host-realm state through a path the bridge could not interpose. Each patch enumerates one more path.

The CVE record calls this a "Sandbox Escape." It is a kill switch.

CVE-2026-44001 carries CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:N/A:H. Confidentiality:None, Integrity:None, Availability:High, Scope:Changed. The bug does not read host memory. The bug does not write host files. The bug terminates the host process. Scope:Changed because the impact crosses the trust boundary from the sandboxed component to the host's other tenants.

The cve.org title carries the phrase Sandbox Escape. The phrase is correct in the narrow sense that something synthesized inside the sandbox reaches the host. The thing that reaches the host is a TypeError. The TypeError reaches an unhandledRejection handler that, in Node 15.0 and later, terminates the process by default. The DoS is exhaustive across every consumer of the sandbox by virtue of the host process being shared.

A service that uses vm2 to evaluate user-submitted code, on a single host process serving every tenant, is killable by any tenant's four lines. Restart policies that respawn the process after exit interact with the bug perversely: a tenant who wants the host down can replay the four lines after every restart. The cost of the attack is the cost of one HTTP request. The cost of the recovery is the cost of one process spawn. The cost ratio is the design.

vm2 is the design-debt driver of this class

vm2 closed thirteen GHSA advisories in v3.11.0 on May 1, 2026. CVE-2026-44001 is one. The thirteen patches landed across three release files (lib/setup-sandbox.js, lib/bridge.js, lib/main.js) inside one branch tag. The repository's README at the same release adds two sentences to the existing security disclaimer, both restating the project's existing position: untrusted code should not be run in vm2; new bypasses will continue to be found.

vm2 is the design-debt driver of the JavaScript sandboxing space and a working exhibit of the detector is the target: the product's only input is, by definition, attacker-influenced JavaScript, and the only function the product provides is execution of that JavaScript. Every escape, every DoS, every unhandled rejection is a path the Proxy could not see, traverse, or wrap. Per-feature defenses (the resetPromiseSpecies of 2023, the neutralizeArraySpeciesBatch of 2026, the executor wrap of this CVE) accumulate in setup-sandbox.js and bridge.js because the bridge cannot become V8. The same shape across the v3.11.1 { nesting: true, require: false } configuration trap and across the v3.11.0 README admission that the bug class is the design: each entry the README warns the caller about, each entry the patch silently denies, is one more named hole in the same surface.

This CVE adds two specific entries to that vocabulary. The first is the executor wrap. The second is the recognition that allowAsync: false, the option vm2's documentation labels stricter, is the option that removes the only sandbox-side mechanism a defender could have used to absorb a rejection the sandbox cannot otherwise suppress. The unpatchable primitive here is the simplest yet: a single Promise constructor in the sandbox, an executor that triggers V8's stack formatter through Symbol-as-name, and a host that exits on the first unhandled rejection. Four lines. One HTTP request. Every tenant.

PoC: GHSA-hw58-p9xv-2mjh.

The 3.10.2 patch wrapped two of three rejection paths. The third runs synchronously inside the constructor, before any handler exists for the sandbox to wrap.