Skip to main content

vm2 CVE-2026-44003

MEDIUM
Protection Mechanism Failure (CWE-693)
2026-05-07 https://github.com/patriksimek/vm2 GHSA-wp5r-2gw5-m7q7
5.8
CVSS 3.1 · NVD
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Recon
    Craft code without catch/import/async keywords
  2. Delivery
    Submit to vm2 runtime
  3. Exploit
    Transformer fast-path skips AST analysis
  4. Install
    Code executes unmodified
  5. C2
    Access VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL
  6. Execute
    Enumerate internal functions
  7. Impact
    Chain to secondary RCE gadget
  8. Step 8
    Escape 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.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – 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

npm vm2 fix: 3.11.0

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

NVD PRIMARY 5.8 MEDIUM
AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:N/A:N
Red Hat 5.3 MEDIUM

Primary rating from NVD.

CVSS VectorNVD

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Changed
Confidentiality
Low
Integrity
None
Availability
None

Lifecycle Timeline

2
CVSS changed
Oct 26, 2026 - 17:23 NVD
5.3 (MEDIUM) 5.8 (MEDIUM)
CVE Published
May 07, 2026 - 04:32 nvd
MEDIUM 5.3

DescriptionNVD

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:

  1. INTERNAL_STATE_NAME identifier check is bypassed: The AST visitor that blocks access to VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL never runs
  2. with statement instrumentation is bypassed: with() statements are not wrapped with wrapWith(), enabling scope manipulation
  3. 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):

javascript
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:

bash
# 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:

javascript
// 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

EPSS Score
0.0%
Top 89% exploitable
Threat Intel
1
1 source
Data Quality
6 sources
Confidence: High
NVD CVE.org EPSS Vulnrichment GHSA Vendor GitHub

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.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation
Poc
System Exposure· derived
Open
Automatable
Yes
Human Impact· derived
Medium
Technical Impact
Partial

Priority Score

29
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +29
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

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

pkg:npm/vm2
CVE-2025-68613 HIGH POC
8.8 Dec 19

Remote code execution in n8n's workflow expression evaluation system allows an authenticated user with workflow creation

CVE-2024-41713 CRITICAL POC
9.1 Oct 21

A vulnerability in the NuPoint Unified Messaging (NPM) component of Mitel MiCollab through 9.8 SP1 FP2 (9.8.1.201) could

CVE-2024-55591 CRITICAL POC
9.8 Jan 14

FortiOS and FortiProxy contain an authentication bypass via the Node.js websocket module allowing unauthenticated remote

CVE-2023-44487 HIGH POC
7.5 Oct 10

Denial of service against HTTP/2 server implementations allows remote unauthenticated attackers to exhaust server resour

CVE-2014-7205 CRITICAL POC
10.0 Oct 08

Eval injection vulnerability in the internals.batch function in lib/batch.js in the bassmaster plugin before 1.5.2 for t

CVE-2025-59528 CRITICAL POC
10.0 Sep 22

Flowise version 3.0.5 contains a remote code execution vulnerability in the CustomMCP node. The mcpServerConfig paramete

CVE-2017-14849 HIGH POC
7.5 Sep 28

Node.js 8.5.0 before 8.6.0 allows remote attackers to access unintended files, because a change to ".." handling was inc

CVE-2017-5941 CRITICAL POC
9.8 Feb 09

An issue was discovered in the node-serialize package 0.0.4 for Node.js. Rated critical severity (CVSS 9.8), this vulner

CVE-2014-0224 HIGH POC
7.4 Jun 05

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

CVE-2014-3744 HIGH POC
7.5 Oct 23

Directory traversal vulnerability in the st module before 0.2.5 for Node.js allows remote attackers to read arbitrary fi

CVE-2014-9566 HIGH POC
7.5 Mar 10

Multiple SQL injection vulnerabilities in the Manage Accounts page in the AccountManagement.asmx service in the Solarwin

CVE-2013-4660 MEDIUM POC
6.8 Jun 28

The JS-YAML module before 2.0.5 for Node.js parses input without properly considering the unsafe !!js/function tag, whic

Vendor StatusVendor

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy