vm2 host Promise rejection denial of service in construct trap

Severity: medium · CVSS 6.8 · Published 2026-09-27

vm2 is a Node.js virtual machine library that isolates untrusted code. A flaw in how it handles rejected Promises from exposed host constructors allows untrusted code to trigger an unhandled rejection that crashes the entire Node.js process. An attacker who can run code in the VM can terminate the application.

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?
Medium severity, with a CVSS score of 6.8, published 27 September 2026.
Which products and versions are affected?
vm2 (npm) < 3.12.2; Vm2 < 3.12.2.
Is there a fix for This vulnerability?
Yes: fixed in 3.12.2. 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.12.2

Technical details

The vulnerability exists in BaseHandler.construct, which does not apply the same host-side Promise rejection handling (markHostPromiseHandled) that BaseHandler.apply already performs. When an embedder exposes a constructable host function whose constructor returns a native rejected Promise, an untrusted script can invoke it with the `new` operator and ignore the result, allowing the unhandled rejection to cross the sandbox boundary and crash the Node.js host process under strict unhandled-rejection policy.

Affected products

  • vm2 < 3.12.2

Timeline

  • 2026-09-08: disclosed
  • 2026-09-27: patched

References

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