vm2 NodeVM require.external RCE via unrestricted path traversal

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

vm2 is a JavaScript sandbox that isolates untrusted code execution. When the require.external option is enabled without explicitly restricting require.root to exclude node_modules, sandboxed code can load vm2's own package, instantiate an unrestricted VM instance, and execute arbitrary host system commands via child_process, leading to full remote code execution.

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

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 10, published 17 September 2026.
Which products and versions are affected?
vm2 (npm) <= 3.11.6; Vm2 before 3.11.7.
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.
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 occurs in lib/resolver-compat.js where require.root defaults to unrestricted (all paths allowed) and require.context defaults to 'host' (using real Node.js require, not sandboxed execution). When require.external is enabled, sandboxed code can traverse the filesystem to load vm2's own package from node_modules, obtain the real unprotected NodeVM/VM classes, create a nested unrestricted VM instance, and execute arbitrary commands. This affects all versions before 3.11.7; the fix restricts require.root validation to prevent this code path.

Affected products

  • vm2 vm2 before 3.11.7

Timeline

  • 2026-08-24: advisory: Original advisory GHSA-j3hm-6rg5-mchv published
  • 2026-09-17: disclosed: Duplicate advisory GHSA-29x6-9qh5-83gg published
  • 2026-10-05: other: Duplicate advisory withdrawn

References

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