Skip to main content

vm2 Again: Sandbox Escapes and the Incomplete Fix Problem

· 8 min read
Ankush K
Co-founder and CTO, Dwaar
vm2 Again: Sandbox Escapes and the Incomplete Fix Problem

If any of your services runs code it did not write inside vm2, upgrade to 3.11.6 today. The release closes two critical escapes from the sandbox to the host, and one of them gets past a fix the project shipped in May. If you upgraded for that fix, you did the right thing and were still exposed.

At a glanceCVE-2026-47686CVE-2026-47698
AdvisoryGHSA-m283-3h24-438vGHSA-cfcw-xp6x-25gj
Affectednpm vm2 before 3.11.6npm vm2 before 3.11.6
Fixed in3.11.63.11.6
SeverityCVSS 3.1 9.9 Critical, scored by GitHubCVSS 3.1 9.8 Critical, scored by GitHub
Exploited as of 2026-08-18No report in the advisory or NVD, PoC in advisoryNo report in the advisory or NVD, PoC in advisory
DisclosedAdvisory 2026-08-14, NVD 2026-08-17Advisory 2026-08-14, NVD 2026-08-17

NVD lists both scores as Secondary, supplied by GitHub, with no score of its own. The range needs a note too: the text of the 47686 advisory says <= 3.11.3, its package metadata says <= 3.11.5, and NVD says before 3.11.6. Since 3.11.5 listed no security fixes, treat everything before 3.11.6 as affected. 3.11.6 closes five advisories in all; the others cover os and dns builtin exposure and two bufferAllocLimit denial of service issues.

Two bugs with one shape​

vm2 passes host objects into the sandbox through proxies. The sandbox holds only while raw host objects never reach sandbox code.

CVE-2026-47686 starts with a missed property. handleException() in lib/setup-sandbox.js walks an error's prototype chain looking for SuppressedError and AggregateError, and recursively sanitises their sub-errors. Any other error is returned without a look at .cause. So if the embedder exposes a host function that throws an error whose cause is a host object such as process, sandbox code catches it, reads e.cause, and can run host commands. The advisory adds that docs/ATTACKS.md claimed Error.cause was sanitised.

The 3.11.6 release notes go further: the SuppressedError and AggregateError slots, arbitrary own properties such as err.detail = process, and the carrier's prototype chain also leaked. The advisory and NVD describe those two slots as sanitised. The fix commit explains the gap: the read-then-assign sanitising them "silently no-ops against a getter-only accessor".

So search wider than cause. You are looking for any host function you expose that throws an error carrying a host reference. cause is one example:

// Illustration only, not from the advisory.
const sandbox = {
lookup(id) {
// The cause is a live host object that sandbox code can catch.
throw new Error("lookup failed", { cause: process });
},
};

The reporter argues this is common because { cause } chaining is standard in database adapters and HTTP clients. That is an argument, not a measurement.

CVE-2026-47698 is a missed composition. Host prototype mutators such as __proto__ must never reach the sandbox raw, because calling them on a host intrinsic severs its prototype chain and exposes the host Function constructor. The fix for GHSA-v6mx-mf47-r5wg, CVE-2026-47131 with a CVSS of 10.0, shipped in 3.11.4 on 18 May. It unwrapped one layer of call, apply, bind or Reflect indirection. The new advisory says plainly that the fix "is insufficient": stack the indirection through Function.prototype.call and the check misses it. Its PoC reaches the mutators on a host Buffer, gets to the host Function constructor and process, and runs a shell command.

The advisory, the fix commit and the 3.11.6 release notes all name GHSA-v6mx-mf47-r5wg as the fix that was bypassed.

The score points the wrong way​

The 9.9 is the bug with the precondition: it needs a host function you chose to expose. The 9.8 needs only attacker code running inside the sandbox. CISA's SSVC entries on the NVD records, timestamped 18 August, mark 47698 as poc and automatable, and 47686 as none and not automatable, although the 47686 advisory attaches a PoC file.

Triage on preconditions, not on the score. The question for any vm2 finding is who writes the code that runs in that sandbox.

Patched is not fixed​

Both bugs are the same failure: a list of dangerous things that was almost complete. A language-level sandbox shares a process with its host, so every object, error and intrinsic is a possible crossing. The defender has to enumerate all of them, and the attacker needs one.

The 47698 fix commit also closes a route where the __proto__ setter ran entirely in the host realm through a host array's .map, without crossing the bridge. A check at the bridge cannot see what never crosses it. So 3.11.6 changes approach: bridge functions refuse raw host mutators, a second check rejects host objects with a severed prototype chain, and host errors reach sandbox catch blocks as sandbox-realm errors.

Those are better fixes, and I would still not bet on them being the last. 3.11.4 closed ten advisories and 3.11.6 closed five, under three months apart.

If an agent executes JavaScript a model wrote, treat that code as attacker controlled, because whatever steers the model through a prompt, a document or a tool output also steers the code. Run it in vm2 and you meet the 47698 precondition by design. Check whether your framework does. My position is that the boundary belongs in the harness and outside the language runtime: a separate process in a container or VM, with no ambient credentials.

What to do now​

  1. Find it. List vm2 in each project's dependency tree, and check lockfiles and SBOMs for any entry at 3.11.5 or lower, direct or transitive. NVD only carried these from 17 August, so a process keyed on it started three days late.
  2. Upgrade. Move vm2 to 3.11.6 or later. For a transitive copy, update the parent package or force the version through your package manager. The advisories list no workaround.
  3. Test the behaviour changes. builtin: ['*'] in NodeVM no longer exposes os and dns, a finite bufferAllocLimit now also covers Buffer.concat, Buffer.from and the ArrayBuffer family, and non-primitive properties on caught host errors are gone.
  4. If you cannot upgrade today, rethrow host errors as plain strings. That is my inference, not official guidance, and it addresses 47686 only. For 47698, stop sending untrusted code to that sandbox.
  5. Hunt. The sources publish no indicators of compromise. Both PoCs end in a host command, so look for the Node process hosting the sandbox spawning children or writing files it normally never touches.

Then take the service where vm2 runs your least trusted code and write down who authors that code, which host functions you pass in, and which credentials and networks the process can reach. If that last list bothers you, move the boundary before the next advisory.

References​