Severity by source
AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:N
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
Lifecycle Timeline
3Blast Radius
ecosystem impact- 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):
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.customnodejs.stream.readablenodejs.stream.writablenodejs.stream.duplexnodejs.stream.transformnodejs.webstream.isClosedPromisenodejs.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
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.writableto a host Readable stream, altering its duck-typing identity Object.assignpropagates unblocked symbols from sandbox source to host targetObject.definePropertywith unblocked symbol key succeeds on host objectsdelete hostObj[unblocked_symbol]succeeds, removing host-set symbol properties
Impact
- Semantic confusion: Sandbox controls host
util.promisifybehavior, 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
setup-sandbox.js: Block allnodejs.*prefixed symbols:
Symbol.for = function (key) {
const keyStr = '' + key;
if (keyStr.startsWith('nodejs.')) return Symbol(keyStr);
return originalSymbolFor(keyStr);
};bridge.js: Add check to write traps:
set(target, key, value, receiver) {
if (isDangerousCrossRealmSymbol(key)) throw new VMError(OPNA);
// ...
}setup-sandbox.js: SyncisDangerousSymbol,Object.getOwnPropertyDescriptors,Object.assignto 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.
FortiOS and FortiProxy contain an authentication bypass via the Node.js websocket module allowing unauthenticated remote
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
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
Directory traversal vulnerability in lib/app/index.js in Geddy before 13.0.8 for Node.js allows remote attackers to read
Credential-harvesting malware compromised 84 versions of 42 TanStack npm packages on 2026-05-11 via chained GitHub Actio
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
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
Same weakness CWE-693 – Protection Mechanism Failure
View allSame technique Authentication Bypass
View allVendor StatusVendor
Share
External POC / Exploit Code
Leaving vuln.today
EUVD-2026-36442
GHSA-m5q2-4fm3-vfqp