vm2 CVE-2026-44003
MEDIUMAttack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
ReconCraft code without catch/import/async keywords
-
DeliverySubmit to vm2 runtime
-
ExploitTransformer fast-path skips AST analysis
-
InstallCode executes unmodified
-
C2Access VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL
-
ExecuteEnumerate internal functions
-
ImpactChain to secondary RCE gadget
-
Step 8Escape sandbox
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A06:2025 - Insecure Design
ASVS 5.0
V15 - Secure Coding and Architecture Protection mechanism completeness
|
| Exploitation Conditions | The vulnerability is exploitable without special conditions on default vm2 configurations. The ONLY prerequisite is that the attacker can control code passed to vm.run() or vm2.NodeVM.run(). Exploitation does NOT require: (1) any specific vm2 configuration options, (2) sandbox escaping to host filesystem, (3) network access, (4) user interaction, or (5) elevated privileges. The attack is blocked ONLY if: (1) the executing code contains one or more of the keywords catch, import, or async (either in a functional context or as a string literal), (2) the code explicitly includes the full identifier VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL in a context that triggers the transformer's INTERNAL_STATE_NAME check (in patched versions), or (3) vm2 version 3.11.0 or later is deployed. Code samples avoiding all three keywords (e.g., var x = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL; or arrow functions without try-catch) are trivially exploitable against versions <= 3.10.5. |
| Impact | The CVSS 5.3 vector (AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N) accurately reflects a network-accessible information disclosure with no interaction required, but understates the real risk. While the immediate impact is limited to reading internal state (C:L - confidentiality loss), the vulnerability is a complete bypass of vm2's core security architecture. The release notes for v3.11.0 explicitly state this advisibility (GHSA-wp5r-2gw5-m7q7) also closes an RCE vector via transformer fast-path bypass, indicating that under certain conditions (possibly combined with other gadgets), this disclosure chains to code execution. The public proof-of-concept demonstrates trivial exploitation: any code without catch/import/async keywords can access forbidden state, and the control test confirms that adding a single catch keyword re-enables the security check. EPSS data is not provided, but the combination of zero exploitation complexity (AC:L), no authentication (PR:N), and a vendor-released patch strongly suggests this will see targeted exploitation by sophisticated attackers. The real-world risk is HIGH because: (1) the vulnerability is trivial to exploit, (2) internal functions are immediately accessible, (3) the release notes reference 13 coordinated security fixes including RCE primitives, and (4) this is one component of a broader sandbox-escape attack surface. Organizations running untrusted code in vm2 must treat this as a critical priority, not a moderate issue. No conflicting signals detected - CVSS, vendor advisory, and POC all align. |
| Exploit ScenarioDerived | An attacker running code inside a vm2 sandbox (for example, in a code-review tool, live-coding platform, or serverless function runtime) crafts a simple script lacking catch, import, and async keywords: var x = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL; Object.keys(x). The transformer fast-path is taken, AST analysis is skipped, and the code executes unmodified. The attacker gains direct access to the internal state object and can enumerate its methods (handleException, wrapWith, import). A sophisticated attacker can then combine this information leak with other gadgets (as hinted by the v3.11.0 release notes mentioning 13 coordinated RCE fixes) to escape the sandbox and execute arbitrary code on the host process. The public POC demonstrates the attack takes less than 50 bytes of code. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – May 07, 2026
Security control bypass in vm2 sandbox allows direct access to internal VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL variable by exploiting a performance optimization in the code transformer that skips AST analysis when code lacks catch, import, or async keywords. Affected versions <= 3.10.5 expose internal security functions (handleException, wrapWith, import) and enable with-statement scope manipulation, creating a latent attack surface for future sandbox escapes. All applications using vm2 to execute untrusted code are affected; exploitation requires no special configuration or authentication.
RemediationAI
Upgrade vm2 to version 3.11.0 or later immediately. The patch adds 'with' keyword and INTERNAL_STATE_NAME string checks to the fast-path condition in transformer.js line 55, ensuring that any code containing with statements or the internal state variable identifier is subjected to full AST transformation regardless of catch/import/async presence. Apply the upgrade via npm: npm install vm2@3.11.0 or npm audit fix. Verify the upgrade: require('vm2/package.json').version should return 3.11.0 or higher. No workarounds are available short of abandoning vm2; organizations unable to upgrade immediately should disable execution of untrusted code or use an alternative sandbox (e.g., worker threads with strict capability restrictions). Note: v3.11.0 also fixes 12 additional security advisories including full RCE primitives, so upgrade is critical for all threat models. See https://github.com/patriksimek/vm2/releases/tag/v3.11.0 for release notes.
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 is a Node.js sandbox that isolates untrusted code execution through AST transformation and scope wrapping. The vulnerability exists in lib/transformer.js lines 55-57, where a regex pattern /\b(?:catch|import|async)\b/ gates whether the code undergoes full AST transformation to strip access to internal identifiers. When the fast-path is taken (code lacking those keywords), the transformer returns code unmodified, completely bypassing the INTERNAL_STATE_NAME identifier visitor that normally blocks access to the VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL variable. Additionally, with-statement instrumentation is skipped, preventing the wrapWith() wrapper that enforces scope boundaries. The root cause is CWE-693 (Protection Mechanism Failure) - a security check (AST visitor) is conditionally disabled based on insufficient pattern matching, allowing an attacker to craft code avoiding three keywords to reach the sanitization bypass. The affected CPE is pkg:npm/vm2 versions <= 3.10.5.
Know when Node.js 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
AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:N/A:N
Primary rating from NVD.
CVSS VectorNVD
Lifecycle Timeline
2DescriptionNVD
Summary
vm2's code transformer has a performance optimization that skips AST analysis when the code does not contain catch, import, or async keywords. This fast-path bypass allows sandboxed code to directly access the internal VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL variable, which exposes internal security functions (handleException, wrapWith, import).
Details
In lib/transformer.js:55-57, a regex check /\b(?:catch|import|async)\b/ determines whether AST transformation is needed. If the code does not contain any of these keywords, the transformer returns the code unmodified.
When the fast-path is taken:
- INTERNAL_STATE_NAME identifier check is bypassed: The AST visitor that blocks access to
VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAILnever runs withstatement instrumentation is bypassed:with()statements are not wrapped withwrapWith(), enabling scope manipulation- The internal state object exposes:
handleException(e),wrapWith(x),import(what)
While these methods are currently defensive utilities (not direct escape vectors), this represents a complete bypass of a security control. Any future addition of a sensitive method to the internal state object would be immediately exploitable.
PoC
Library-level PoC (Node.js script - primary):
const { VM } = require("vm2");
const vm = new VM();
// Access internal state (bypassed - no catch/import/async keywords)
const result = vm.run(`
var x = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL;
Object.keys(x).join(",")
`);
console.log(result); // "wrapWith,handleException,import"
// Control test - blocked when catch keyword is present
try {
vm.run(`
try {
var x = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL;
} catch(e) { e.message }
`);
} catch(e) {
console.log(e.message); // "Use of internal vm2 state variable"
}HTTP demonstration:
# Internal state access (bypassed)
curl -s -X POST http://localhost:3000/api/execute \
-H "Content-Type: application/json" \
-d '{"code":"var x = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL; Object.keys(x).join(\",\")"}'
# Result: "wrapWith,handleException,import"
# Control test - blocked when catch keyword is present
curl -s -X POST http://localhost:3000/api/execute \
-H "Content-Type: application/json" \
-d '{"code":"try { var x = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL; } catch(e) { e.message }"}'
# Result: {"errors":["Use of internal vm2 state variable"]}Suggested fix:
// transformer.js:55 - add 'with' keyword and INTERNAL_STATE_NAME check
if (!/\b(?:catch|import|async|with)\b/.test(code) && code.indexOf(INTERNAL_STATE_NAME) === -1) {
return {__proto__: null, code, hasAsync: false};
}Impact
- Security Control Bypass: The INTERNAL_STATE_NAME access restriction is completely ineffective when the code avoids 3 specific keywords.
- Defense-in-Depth Violation: Internal security functions are exposed, creating a latent attack surface for future code changes.
- Scope: All applications using vm2. No special configuration required.
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
Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.
Affected Products (CPE)NVD
Related Vulnerabilities in vm2 Sandbox Escape Vulnerabilities
View all 11Remote code execution in n8n's workflow expression evaluation system allows an authenticated user with workflow creation
A vulnerability in the NuPoint Unified Messaging (NPM) component of Mitel MiCollab through 9.8 SP1 FP2 (9.8.1.201) could
FortiOS and FortiProxy contain an authentication bypass via the Node.js websocket module allowing unauthenticated remote
Denial of service against HTTP/2 server implementations allows remote unauthenticated attackers to exhaust server resour
Eval injection vulnerability in the internals.batch function in lib/batch.js in the bassmaster plugin before 1.5.2 for t
Flowise version 3.0.5 contains a remote code execution vulnerability in the CustomMCP node. The mcpServerConfig paramete
Node.js 8.5.0 before 8.6.0 allows remote attackers to access unintended files, because a change to ".." handling was inc
An issue was discovered in the node-serialize package 0.0.4 for Node.js. Rated critical severity (CVSS 9.8), this vulner
OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph
Directory traversal vulnerability in the st module before 0.2.5 for Node.js allows remote attackers to read arbitrary fi
Multiple SQL injection vulnerabilities in the Manage Accounts page in the AccountManagement.asmx service in the Solarwin
The JS-YAML module before 2.0.5 for Node.js parses input without properly considering the unsafe !!js/function tag, whic
GHSA-wp5r-2gw5-m7q7
NVD
CVE.org
EPSS
Vulnrichment
Exploit-DB