vm2 sandbox escape to RCE via AggregateError Error.cause sanitization bypass

Severity: critical · CVSS 9 · Published 2026-09-17

vm2 is a JavaScript sandbox that isolates untrusted code from the host environment. An incomplete fix in Error handling allows attackers to escape the sandbox and execute arbitrary code on the host system by exploiting how AggregateError objects are processed. This gives attackers full control over the host system and access to sensitive information like environment variables.

Technologies: vm2 (npm), Vm2. Vendors: npm.

Quick answers

Is This vulnerability exploited in the wild?
No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.
How severe is This vulnerability?
Critical severity, with a CVSS score of 9, published 17 September 2026.
Which products and versions are affected?
vm2 (npm) <= 3.11.7; Vm2 <= 3.11.7.
Is there a fix for This vulnerability?
Yes: fixed in 3.11.8. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is This vulnerability attacked?
It is attacked over the network, in a software library.
Am I affected?
Check whether you run vm2 (npm) or Vm2 at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • Fixed in: 3.11.8

Technical details

vm2 3.11.7 and earlier fail to properly sanitize revisited host-wrapped AggregateError objects during exception handling. The handleException function uses a visited weakmap to detect cycles but returns the raw host proxy on revisit instead of the sanitized version; sanitizeAggregateError rebuilds errors into fresh LocalAggregateError objects but does not seal the original host carrier, allowing re-embedding of unsanitized host proxies. An attacker with the ability to throw a host AggregateError from an exposed host function can craft one with self-cycles or duplicate references to leak live host proxies and achieve RCE via child_process.execSync.

Affected products

  • vm2 <= 3.11.7

Timeline

  • 2026-08-27: disclosed
  • 2026-09-17: advisory

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.