Skip to main content

vm2 CVE-2026-47135

| EUVDEUVD-2026-36442 HIGH
Protection Mechanism Failure (CWE-693)
2026-05-29 https://github.com/patriksimek/vm2 GHSA-m5q2-4fm3-vfqp
8.7
CVSS 3.1 · Vendor: https://github.com/patriksimek/vm2
Share

Severity by source

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

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

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

CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:N
Attack Vector
Network
Attack Complexity
High
Privileges Required
None
User Interaction
None
Scope
Changed
Confidentiality
High
Integrity
High
Availability
None

Lifecycle Timeline

3
Source Code Evidence Fetched
May 29, 2026 - 18:18 vuln.today
Analysis Generated
May 29, 2026 - 18:18 vuln.today
CVE Published
May 29, 2026 - 17:44 nvd
HIGH 8.7

Blast Radius

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

Ecosystem-wide dependent count for version 3.11.4.

DescriptionCVE.org

Summary

vm2 3.11.2 Symbol.for override in setup-sandbox.js only intercepts 2 of 9 dangerous Node.js cross-realm symbols. Combined with the bridge's set/defineProperty/deleteProperty traps having no isDangerousCrossRealmSymbol key check, sandbox code can obtain real cross-realm symbols, write them to host objects, and control host-side behavior - verified with a full util.promisify hijack chain.

Root Cause

1. Incomplete Symbol.for override (setup-sandbox.js:132-142):

js
Symbol.for = function (key) {
    const keyStr = '' + key;
    if (keyStr === 'nodejs.util.inspect.custom') return blockedSymbolCustomInspect;
    if (keyStr === 'nodejs.rejection') return blockedSymbolRejection;
    return originalSymbolFor(keyStr); // everything else passes through
};

Only inspect.custom and rejection are blocked. The following 7 Node.js internal symbols pass through as real cross-realm symbols:

  • nodejs.util.promisify.custom
  • nodejs.stream.readable
  • nodejs.stream.writable
  • nodejs.stream.duplex
  • nodejs.stream.transform
  • nodejs.webstream.isClosedPromise
  • nodejs.webstream.controllerErrorFunction

Note: bridge.js isDangerousCrossRealmSymbol covers promisify.custom on reads, but the Symbol.for override in setup-sandbox does not block it at the source.

2. Missing symbol check in bridge write traps (bridge.js):

The get trap (line 1148) and ownKeys trap (line 1541) both check isDangerousCrossRealmSymbol(key), but set (line 1231), defineProperty (line 1427), and deleteProperty (line 1493) have no such check. Sandbox code can write/define/delete properties with dangerous symbol keys on any non-protected host object.

3. Incomplete filters in setup-sandbox.js:

isDangerousSymbol(), Object.getOwnPropertyDescriptors override, and Object.assign override only filter inspect.custom and rejection - missing promisify.custom and all stream/webstream symbols.

Verified Exploitation: util.promisify Hijack

js
const { VM } = require('vm2');
const util = require('util');

const vm = new VM();
const hostFn = function readFile(path, cb) { cb(null, 'real data'); };
vm.setGlobal('hostFn', hostFn);

// Sandbox writes promisify.custom to host function
vm.run(`
  const kPromisify = Symbol.for('nodejs.util.promisify.custom');
  hostFn[kPromisify] = function(path) {
    return Promise.resolve('HIJACKED by sandbox');
  };
`);

// Host-side: promisified function now returns sandbox-controlled value
const asyncRead = util.promisify(hostFn);
asyncRead('/etc/passwd').then(console.log);
// Output: "HIJACKED by sandbox"

Additional verified attacks:

  • Writing nodejs.stream.writable to a host Readable stream, altering its duck-typing identity
  • Object.assign propagates unblocked symbols from sandbox source to host target
  • Object.defineProperty with unblocked symbol key succeeds on host objects
  • delete hostObj[unblocked_symbol] succeeds, removing host-set symbol properties

Impact

  • Semantic confusion: Sandbox controls host util.promisify behavior, host stream type checks, and WebStream internals for any non-frozen host object exposed to the sandbox.
  • Data integrity: Host code relying on promisified function results gets sandbox-controlled values.
  • Defense bypass: Combined with specific host API patterns, sandbox-provided fake streams could bypass host-side input validation.

This is not a direct RCE - the bridge still wraps sandbox functions crossing the boundary - but it grants the sandbox control over host-side control flow decisions that depend on these symbol-keyed properties.

Affected Versions

  • vm2 <= 3.11.2 (all 3.x versions)

Environment

  • Node.js v24.14.0
  • macOS (Darwin 25.4.0)

Suggested Fix

  1. setup-sandbox.js: Block all nodejs.* prefixed symbols:
js
Symbol.for = function (key) {
    const keyStr = '' + key;
    if (keyStr.startsWith('nodejs.')) return Symbol(keyStr);
    return originalSymbolFor(keyStr);
};
  1. bridge.js: Add check to write traps:
js
set(target, key, value, receiver) {
    if (isDangerousCrossRealmSymbol(key)) throw new VMError(OPNA);
    // ...
}
  1. setup-sandbox.js: Sync isDangerousSymbol, Object.getOwnPropertyDescriptors, Object.assign to cover all dangerous symbols.

AnalysisAI

Sandbox escape in vm2 versions 3.11.2 and earlier (through 3.11.3) allows sandboxed JavaScript to obtain real Node.js cross-realm symbols and write them onto host objects, hijacking host-side control flow such as util.promisify, stream duck-typing, and WebStream internals. The flaw stems from an incomplete Symbol.for override that blocks only 2 of 9 dangerous nodejs.* symbols and from bridge write traps that lack the dangerous-symbol guard present on read traps. A working proof-of-concept hijacking util.promisify is published in the GHSA advisory, and a vendor patch (3.11.4) is available; no entry in CISA KEV at time of analysis.

Technical ContextAI

vm2 is a popular Node.js sandboxing library (pkg:npm/vm2) historically used to execute untrusted JavaScript with a Proxy-based bridge separating sandbox-realm and host-realm references. The vulnerability is a CWE-693 (Protection Mechanism Failure) defect across two files: setup-sandbox.js intercepts Symbol.for() to neutralize Node.js cross-realm symbols but only filters nodejs.util.inspect.custom and nodejs.rejection, while leaving nodejs.util.promisify.custom, the four stream brand symbols (readable/writable/duplex/transform), and two webstream symbols (isClosedPromise/controllerErrorFunction) reachable as real cross-realm symbols. In parallel, bridge.js applies isDangerousCrossRealmSymbol on get and ownKeys traps but omits it on set, defineProperty, and deleteProperty, so even symbols that are filtered on reads can be written onto any non-protected host object exposed via vm.setGlobal or vm.sandbox.

RemediationAI

Vendor-released patch: upgrade vm2 to 3.11.4 or later, available at https://github.com/patriksimek/vm2/releases/tag/v3.11.4 with the structural fix committed in https://github.com/patriksimek/vm2/commit/928aef51898b5c52a05f05a40c4cfeb52e172878, which denies the entire nodejs.* namespace at Symbol.for and adds the isDangerousCrossRealmSymbol guard to the bridge's set, defineProperty, and deleteProperty traps. If immediate upgrade is not possible, the only realistic compensating control is to stop passing untrusted code to vm2 - there is no reliable configuration toggle that closes this primitive, because the defect is structural to the sandbox bridge. Operators who cannot stop accepting untrusted code should consider switching to isolated-vm or running vm2 inside a separate OS-level sandbox (container with seccomp, gVisor, or a separate user namespace with no network) so that a successful escape does not reach the parent service's filesystem, credentials, or network identity; trade-off is increased deployment complexity and per-invocation startup cost. Reviewing host code that exposes non-frozen objects, functions, or streams via vm.setGlobal or vm.sandbox and freezing or deep-wrapping them where feasible reduces the available write targets, but does not eliminate the class of attack. Refer to GHSA-m5q2-4fm3-vfqp for full advisory context.

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

CVE-2015-5688 MEDIUM POC
5.0 Sep 04

Directory traversal vulnerability in lib/app/index.js in Geddy before 13.0.8 for Node.js allows remote attackers to read

CVE-2026-45321 CRITICAL POC
9.6 May 12

Credential-harvesting malware compromised 84 versions of 42 TanStack npm packages on 2026-05-11 via chained GitHub Actio

CVE-2014-7192 CRITICAL POC
10.0 Dec 11

Eval injection vulnerability in index.js in the syntax-error package before 1.1.1 for Node.js 0.10.x, as used in IBM Rat

CVE-2013-4450 MEDIUM POC
5.0 Oct 21

The HTTP server in Node.js 0.10.x before 0.10.21 and 0.8.x before 0.8.26 allows remote attackers to cause a denial of se

Vendor StatusVendor

Share

CVE-2026-47135 vulnerability details – vuln.today

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