vm2 timeout option bypass via FinalizationRegistry cleanup callback

Severity: high · CVSS 7.5 · Published 2026-09-17

vm2 is a library that sandboxes JavaScript code execution with configurable resource limits, including timeout enforcement. This vulnerability allows sandboxed code to bypass the timeout protection by registering a FinalizationRegistry callback that executes outside the timeout accounting when the garbage collector later runs, enabling a denial-of-service attack that blocks the host event loop indefinitely.

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?
High severity, with a CVSS score of 7.5, published 17 September 2026.
Which products and versions are affected?
vm2 (npm) <= 3.11.6; Vm2 <= 3.11.6.
Is there a fix for This vulnerability?
Yes: fixed in 3.11.7. 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.7

Technical details

The vulnerability exists because vm2's timeout enforcement wraps only the synchronous VM#run() call but not asynchronous callbacks triggered by the V8 garbage collector. FinalizationRegistry and WeakRef are exposed unmodified to sandboxed code and not hardened, allowing an attacker to register a cleanup callback that executes outside any timeout protection when an object is garbage collected. A malicious cleanup callback can then execute a busy loop, causing denial of service by blocking the host event loop indefinitely.

Affected products

  • vm2 <= 3.11.6

Timeline

  • 2026-08-24: disclosed
  • 2026-09-17: advisory
  • 2026-10-05: other: Advisory withdrawn as duplicate of GHSA-r4fx-v8hh-22mv

References

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