-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 NEFARIOUSPLAN-CANONICAL-V1 {"body_md":"## The exploit is four lines\n\nThe PoC published with GHSA-hw58-p9xv-2mjh is four lines of sandbox JavaScript:\n\n```javascript\nconst { VM } = require(\"vm2\");\nconst vm = new VM({ timeout: 5000, allowAsync: false });\n\nvm.run(`\n new Promise(function(r, j) {\n var e = new Error();\n e.name = Symbol();\n e.stack;\n });\n`);\n// Process exits with [UnhandledPromiseRejection: TypeError ...]\n```\n\nRead 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`.\n\nThe `.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.\n\nThe 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.\n\nNode'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.\n\n## V8's stack formatter is the part the sandbox cannot wrap\n\nvm2'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.\n\nThe bridge does not see V8's C++.\n\n`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.\n\nThis 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](/posts/vm2-cve-2026-24118-resetpromisespecies-has-a-sibling).\n\nThe stack formatter is another instance. The bridge cannot interpose. The defense has to be elsewhere.\n\n## The 3.10.2 patch wrapped what the sandbox attached. The executor is what the sandbox passes.\n\nCVE-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.\n\nThe 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.\n\n`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.\n\nThe 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.\n\nThe CVE description names this gap exactly:\n\n> 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.\n\n`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.\n\n## `allowAsync: false` is the option that makes the exploit unblockable\n\nThe 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`:\n\n```javascript\nif (!allowAsync) {\n overrideWithProxy(PromisePrototype, 'then', PromisePrototype.then, AsyncErrorHandler);\n}\n```\n\nWhen `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.\n\n`new Promise(...)` is not overridden. The Promise constructor is reachable.\n\nFor sandbox code under `allowAsync: false`:\n\n- `new Promise(executor)` still works.\n- The executor can throw.\n- The Promise becomes rejected.\n- The sandbox cannot call `.then` to attach a handler.\n- The sandbox cannot call `.catch` to attach a handler.\n- The rejection cannot be suppressed from inside the sandbox.\n- Node's unhandledRejection fires on the host.\n- The process dies.\n\nUnder `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.\n\n`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.\n\n## The 3.11.0 fix has to live in the constructor\n\nvm2 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`:\n\n```javascript\nconst globalPromise = global.Promise;\nclass localPromise extends globalPromise {}\n```\n\nThe 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.\n\nThe 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](/posts/vm2-cve-2026-43999-module-was-every-other-module) is another. The [util.inspect callback case](/posts/vm2-cve-2026-43997-inspect-still-calls-the-sandbox) is another. The [Buffer.alloc opt-in case](/posts/vm2-cve-2026-44004-fix-is-off-by-default) 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.\n\n## The CVE record calls this a \"Sandbox Escape.\" It is a kill switch.\n\nCVE-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.\n\nThe 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.\n\nA 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.\n\n## vm2 is the design-debt driver of this class\n\nvm2 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.\n\nvm2 is the [design-debt driver](/patterns/design-debt-driver) of the JavaScript sandboxing space and a working exhibit of [the detector is the target](/patterns/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](/posts/vm2-cve-2026-44007-readme-is-the-patch-for-the-rest) and across [the v3.11.0 README admission that the bug class is the design](/posts/vm2-cve-2026-24120-readme-already-admits): each entry the README warns the caller about, each entry the patch silently denies, is one more named hole in the same surface.\n\nThis 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](/patterns/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.\n\nPoC: [GHSA-hw58-p9xv-2mjh](https://github.com/patriksimek/vm2/security/advisories/GHSA-hw58-p9xv-2mjh).","closing_line":"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.","hook_md":"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.","post_id":378,"slug":"vm2-cve-2026-44001-executor-was-not-a-callback","title":"CVE-2026-44001: vm2 Wrapped onRejected on `.then` and `.catch`. The Executor Was Not a Callback.","type":"initial","unreadable_sentence":"`allowAsync: false` is the configuration vm2's documentation labels stricter. It is the configuration in which the exploit's last line of defense is unreachable."} -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQRf0htP5+SjynlxywneZjl4jgkQJgUCalKhlAAKCRDeZjl4jgkQ JpBpAQC/Usd9SpAyrbEvz+gurJlcVW9hp9w6lkQUOtPN6vZTKQD+MAy8NGGIcKbO HeGtznm/K4gUFJfPcTdWmcEOdmlGwQ4= =nh6/ -----END PGP SIGNATURE-----