Sandbox Escape in vm2 via NodeVM Module Resolver
CVE-2026-100721 is a sandbox escape vulnerability in vm2 versions before 3.12.2, allowing untrusted guest code to execute arbitrary code in the host context via an authorization bypass in the external-module resolver.
CVE search metadata
CVE search record: CVE-2026-100721. Severity: critical. CVSS: 9.0. EPSS: 0.40%. KEV: no. Product: vm2 (< 3.12.2). Brief: Sandbox Escape in vm2 via NodeVM Module Resolver. Brief link: https://feed.craftedsignal.io/briefs/2026-09-27-vm2-sandbox-escape/
CVE search record: CVE-2026-100723. Severity: high. CVSS: 7.5. EPSS: 0.32%. KEV: no. Product: vm2 (< 3.12.2). Brief: Sandbox Escape in vm2 via NodeVM Module Resolver. Brief link: https://feed.craftedsignal.io/briefs/2026-09-27-vm2-sandbox-escape/
Triage facts
Revision 2- Applicability
- vm2 (< 3.12.2)
- Evidence
- Unknown
- Severity
- High
- Action
- Elevated
- Sources
- 3 public sources
- Freshness
- Revision 2Sep 27, 05:03 UTC
- Vulnerabilities
- 2 CVEs
- Source quality
- A1Likely
Revision history 1 entry · Revision 2
- Revision 2
Repaired a legacy canonical identity collision
Changed: slug
CVE-2026-100721 identifies a critical sandbox escape vulnerability in the vm2 library (versions prior to 3.12.2). The vulnerability resides in the NodeVM external-module resolver when configured with a custom resolver and context: 'host'. The LegacyResolver.customResolve function in lib/resolver-compat.js improperly validates module paths by creating a regular expression that lacks path separators or end-of-string boundaries.
This flaw allows an attacker to bypass security restrictions by providing a path that shares a prefix with an allowlisted module. For example, if 'foo' is allowlisted, an attacker can require a sibling module 'foo2' located in an absolute path that starts with the same prefix. The vulnerable resolver treats this as authorized, loading the non-allowlisted module into the host process. The top-level code of the malicious module executes before the guest exports are wrapped, enabling full host-context code execution. This is particularly dangerous for applications using vm2 to sandboxing untrusted scripts.
Impact
Successful exploitation allows arbitrary code execution on the host machine hosting the Node.js application. This bypasses the intended security boundaries of the vm2 sandbox, potentially leading to full server compromise, data exfiltration, or lateral movement within the environment. Any application leveraging vm2 for processing user-supplied code is highly susceptible to this sandbox escape.
Recommendation
- Upgrade the vm2 dependency to version 3.12.2 or higher to include the fix for the resolver path validation logic.
- Audit applications currently utilizing the NodeVM 'context: host' configuration and a custom 'require.external' resolver to identify potential exposure.
- Implement strict path sanitization or validation wrappers if immediate library updates are not feasible, though upgrading remains the primary defense.
Immediate actions
Upgrade vm2 to 3.12.2 or later in all Node.js projects
Mitigations
Patch vm2 to 3.12.2 or later
CVE-2026-100721