Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
ReconSubmit untrusted code to vm2 sandbox
-
Deliveryrequire allowlisted module 'foo'
-
Exploitrequire sibling path .../node_modules/foo2/index.js
-
Installprefix passes isPathAllowedForModule check
-
C2sibling loaded via hostRequire
-
Executetop-level code runs in host
-
Impactarbitrary code execution outside sandbox
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V8 - Authorization Authorization logic validation
MITRE ATT&CK
1 technique across 1 tactic: Privilege Escalation The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Requires the embedder to have configured NodeVM with require.external using a CUSTOM resolver AND context:'host' - this is a non-default deployment mode, which is why the vendor sets AT:P (attack requirement present). There must also be at least one allowlisted external module and a filesystem-adjacent, non-allowlisted sibling package whose resolved path shares the allowlisted module's prefix (e.g. node_modules/foo allowlisted, node_modules/foo2 present; scoped @scope/pkg vs @scope/pkg-evil equally affected). Given those conditions, exploitation needs no authentication or user interaction - the attacker simply supplies untrusted guest code to the sandbox (PR:N/UI:N). Deployments not using the external-module host-passthrough resolver, or without a prefix-sharing sibling package installed, are not exploitable via this vector. |
| Impact | This is a genuine sandbox-escape-to-RCE in vm2, the class of bug vm2 exists to prevent, so on technical severity it is top-tier. The vendor CVSS 4.0 is 9.5 (AV:N/AC:L/AT:P/PR:N/UI:N with full VC/VI/VA:H and SC/SI/SA:H), and CWE-863 (Incorrect Authorization) matches the description: an unanchored RegExp/startsWith prefix test lets guest code load a prefix-sharing sibling package whose top-level code runs in the host before vm.readonly wrapping. However, the AT:P (Attack Requirement Present) is the pivotal signal and is well-justified: exploitation is NOT default - the embedder must have configured require.external with a custom resolver AND context:'host'. That configuration gate meaningfully narrows real-world exposure and is the main reason the raw 9.5 overstates blanket risk. On exploitation signals, no EPSS score, no CISA KEV entry, and no public POC were provided; a fix is confirmed available from the vendor and the advisory ships regression tests (test/ghsa/GHSA-7q3f-wx44-378m/) that demonstrate the technique, so weaponization is low-effort for a capable attacker even though no in-the-wild use is indicated. Note also a minor source discrepancy: the description attributes the flaw to LegacyResolver.customResolve recording externals without a path boundary, while the linked commit/CHANGELOG describes the fix to LegacyResolver.isPathAllowedForModule's raw startsWith test - these are the two composed layers (specifier-space and filename-space) of the same allowlist and are consistent, not conflicting. Bottom line: real priority for anyone running vm2 with the external-module + host-context configuration; lower urgency for the many deployments that do not use that mode. vm2 is also deprecated upstream, so migration off vm2 is the durable fix. |
| Exploit ScenarioDerived | An application embeds vm2's NodeVM to run untrusted plugins/user code and has configured require.external with a custom resolver and context:'host', allowlisting a package such as 'foo'. Guest code first requires the allowlisted 'foo', then requires the absolute path of a non-allowlisted sibling like .../node_modules/foo2/index.js, which passes the unanchored prefix check and is loaded via hostRequire, executing the sibling's top-level code in the host process and escaping the sandbox. No public exploit was provided, but vendor regression tests demonstrate the technique. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Sep 27, 2026
Sandbox escape leading to arbitrary host code execution in vm2 (the npm sandbox library, CPE cpe:2.3:a:patriksimek:vm2) affects all versions before 3.12.2 when NodeVM is configured with a custom require.external resolver and context: 'host'. Because the resolver records the allowed module directory as an unanchored prefix pattern, untrusted guest code can require an allowlisted package (e.g. foo) and then require a non-allowlisted sibling sharing that prefix (e.g. node_modules/foo2/index.js), whose top-level code is loaded via hostRequire in the host process before vm.readonly wrapping, yielding code execution outside the sandbox. Exploitation requires the non-default host-passthrough external-resolver deployment plus a prefix-sharing sibling package, but needs no authentication or user interaction (CVSS:4.0 9.5, AT:P/PR:N/UI:N; assessed CVSS:3.1 AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H); no public exploit code was identified at time of analysis and the flaw is not in CISA KEV, though the vendor has published patched commits and version 3.12.2.
RemediationAI
Upgrade vm2 to 3.12.2 or later - vendor-released patch: 3.12.2, corresponding to upstream commits https://github.com/patriksimek/vm2/commit/6ac3916da84e060c403e407b6b6318fcc66b0e72 (adds a required path boundary after the module path so foo2 no longer matches foo, including scoped names), https://github.com/patriksimek/vm2/commit/ab4ee7d803e8c80155e9eb3672226bddbca4aa9c and https://github.com/patriksimek/vm2/commit/91034466bfb7f56b95fd48083ec6ca36d058f164; see the advisory at https://github.com/patriksimek/vm2/security/advisories/GHSA-5h3f-q97h-ccvc. If immediate upgrade is impossible, the exposure can be removed by eliminating the specific configuration prerequisite: drop the custom require.external resolver (use the default resolver or a context: 'sandbox' execution mode), or replace custom host-passthrough resolution with an explicit exact-module allowlist that refuses any specifier not matching a normalized, boundary-checked path - the trade-off is broken legitimate external requires in multi-package configurations. A supplemental control is to ensure no non-allowlisted package shares a path prefix with an allowlisted one (no foo2 alongside foo, no pkg-evil alongside pkg) and to audit the installed dependency tree for such siblings; this is a lower-confidence mitigation since any future dependency addition can reintroduce the prefix collision, and it does not protect against separately tracked specifier-space (..) variants of the same resolver weakness. Treat any host that previously ran untrusted guest code under a vulnerable configuration as potentially compromised, since top-level module code of the loaded sibling executes in the host process before sandbox wrapping.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in npm
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
vm2 provides a Node.js sandbox; NodeVM controls module access through require options, including an external allowlist whose resolution can be delegated to a custom resolver. The vulnerability (CWE-863, improper authorization) sits in lib/resolver-compat.js, where LegacyResolver.customResolve stores resolved directories as new RegExp('^' + escapeRegExp(resolvedPath)) and LegacyResolver.isPathAllowedForModule originally authorized loads with a raw path.startsWith(mod.path) containment test. Neither check enforces a path boundary (exact match, trailing separator, or separator as next character), so a request for .../node_modules/foo2/index.js satisfies the prefix .../node_modules/foo, and the node_modules guard on the remainder does not apply because a sibling's remainder (2/index.js) contains no node_modules segment - that guard only blocks genuinely nested dependencies like foo/node_modules/bar. The bypassed path flows into hostRequire, so the sibling package's top-level module code executes in the host process before any vm.readonly export wrapping is applied, converting an allowlist flaw into a full sandbox escape. The vendor's fix anchors the check to a real path boundary and adds regression coverage under test/ghsa/GHSA-7q3f-wx44-378m/ (ATTACKS.md Category 46), composing with the specifier-side fix described as Category 45 and the require.root symlink TOCTOU fix as Category 24. Scoped packages are affected identically (@scope/pkg vs @scope/pkg-evil).
Know when Vm2 gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H
Untrusted guest code needs no privileges (PR:N) but the non-default custom-resolver + context:'host' precondition warrants AC:H; sandbox escape to host is a scope change (S:C) with full RCE (C/I/A:H).
Primary rating from Vendor (VulnCheck).
CVSS VectorVendor: VulnCheck
DescriptionCVE.org
vm2 before 3.12.2 contains an authorization bypass in the NodeVM external-module resolver. When an embedder configures require.external with a custom resolver (and context: 'host'), LegacyResolver.customResolve in lib/resolver-compat.js records the resolved module directory in this.externals as new RegExp('^' + escapeRegExp(resolvedPath)), without requiring a path separator or end-of-string boundary. Untrusted guest code can therefore require the allowlisted module (e.g. foo) and then require the absolute path of a non-allowlisted sibling whose path merely shares the resolved prefix (e.g. .../node_modules/foo2/index.js); the sibling passes isPathAllowedForModule and is loaded through hostRequire, so its top-level code runs in the host process before the exports are wrapped with vm.readonly, resulting in a sandbox escape and arbitrary code execution in the host context.
Blast Radius
ecosystem impact- 4,327 npm packages depend on vm2 (1,159 direct, 3,200 indirect)
Ecosystem-wide dependent count for version 3.12.2.
Technical POC Analysis
CWE-863 (Incorrect Authorization) in LegacyResolver.customResolve in lib/resolver-compat.js.
Full technical POC analysis - root cause, step-by-step exploitation and patch breakdown - is part of the Pro and Business plans.
Executive ViewAI
CVE-2026-100721 is a critical sandbox-escape vulnerability in the widely used vm2 npm library (all versions before 3.12.2) that can allow untrusted code to break out of the sandbox and execute with the full privileges of the host Node.js process. Exposure is limited to deployments that use vm2's non-default host-passthrough external module resolver, which is typically found in platforms that execute customer- or partner-supplied JavaScript; where present, a successful escape could expose application credentials, data, and any systems reachable from that server. There is no public exploit identified at time of analysis, and a vendor patch is available, so leadership should focus on confirming which services use this configuration and driving the upgrade to completion.
Apply vendor patch.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Authentication bypass attacks exploit flaws in the verification mechanisms that control access to systems and applications.
Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.
Related Vulnerabilities in vm2 Sandbox Escape and Authorization Bypass
View all 3vm2 is an advanced vm/sandbox for Node.js. Rated critical severity (CVSS 10.0), this vulnerability is remotely exploitab
vm2 is a sandbox that can run untrusted code with Node's built-in modules. Rated critical severity (CVSS 10.0), this vul
vm2 is a sandbox that can run untrusted code with whitelisted Node's built-in modules. Rated critical severity (CVSS 10.
There exists a vulnerability in source code transformer (exception sanitization logic) of vm2 for versions up to 3.9.15,
vm2 is a sandbox that can run untrusted code with whitelisted Node's built-in modules. Rated critical severity (CVSS 10.
This affects the package vm2 before 3.9.4 via a Prototype Pollution attack vector, which can lead to execution of arbitr
Full sandbox escape with arbitrary code execution allows remote attackers to break out of vm2's Node.js sandbox environm
Sandbox escape in vm2 for Node.js allows remote unauthenticated attackers to execute arbitrary commands on the host syst
Sandbox escape in vm2 (patriksimek/vm2) versions prior to 3.11.3 enables remote code execution on the host Node.js proce
Sandbox escape in vm2 Node.js sandbox before 3.10.2 via Promise.prototype.then/catch callback sanitization bypass. PoC a
vm2 is a sandbox that can run untrusted code with whitelisted Node's built-in modules. Rated critical severity (CVSS 9.8
The package vm2 before 3.9.10 are vulnerable to Arbitrary Code Execution due to the usage of prototype lookup for the We
EUVD-2026-87858
GHSA-c9wr-qm7p-p6vc
NVD
CVE.org
EPSS
Vulnrichment
Exploit-DB