The pre-patch BUILTIN_MODULES constant in lib/builtin.js was 64 names long. vm2's README documented require.builtin: ['*'] as the "allow everything" configuration and pointed callers at the -name syntax for pruning it. The canonical pruning was '-child_process'. Six of the 64 names the wildcard expanded to were loaders that called Node's module system in the host realm without consulting vm2's allowlist. module was one. Module._load('child_process') was three lines of sandbox code. The 3.11.0 patch is a hardcoded list of six names the wildcard is no longer allowed to grant.
CVE-2026-43999: vm2's Builtin Allowlist Granted `module`. `module` Granted The Rest.
vendor
patterns
cve
proof of concept
Module._load is not vm2's require().
The pre-patch lib/builtin.js defined BUILTIN_MODULES as one line:
const BUILTIN_MODULES = (nmod.builtinModules
|| Object.getOwnPropertyNames(process.binding('natives')))
.filter(s => !s.startsWith('internal/'));On Node 18 that resolves to 64 names. child_process, cluster, fs, http, module, vm, worker_threads, and 57 others. The same file's addDefaultBuiltin decided what each one would look like to the sandbox:
function addDefaultBuiltin(builtins, key, hostRequire) {
if (builtins.has(key)) return;
const special = SPECIAL_MODULES[key];
builtins.set(key, special ? special : vm => vm.readonly(hostRequire(key)));
}SPECIAL_MODULES covers three names: events, buffer, util. Each gets a sandbox-side reimplementation. The other 61 names fall through to vm.readonly(hostRequire(key)), which loads the builtin in the host realm and wraps the result in a Proxy whose handler is ReadOnlyHandler from lib/bridge.js.
The handler class in pre-patch source overrides exactly six traps: set, setPrototypeOf, defineProperty, deleteProperty, isExtensible, preventExtensions. Each refuses the mutation and returns. The get trap and the apply trap are not overridden. They fall through to BaseHandler, whose apply ends:
apply(target, context, args) {
// ...
return doApply(this, context, args);
}The proxy reads a property and returns the host's value, wrapped for re-entry. The proxy receives a call and forwards the call to the host function, with arguments unwrapped across the bridge. ReadOnly is the name vm2 gives a wrapper that blocks writes. Method calls are not writes.
require('module') enters this path. The user's builtin: ['*', '-child_process'] enumerates the wildcard, encounters module, sees no '-module' exclusion in the user's array, and adds it. module is not in SPECIAL_MODULES. The default handler runs: vm.readonly(hostRequire('module')). The sandbox receives a Proxy whose target is the host's Module constructor function.
Module._load(name) is a property read followed by a call. The proxy returns the host's Module._load, wrapped. The wrapper's apply trap is BaseHandler.apply. The function is invoked. The function does what it always does: it consults the host's module cache, runs Node's resolver, loads child_process from the host's builtin registry, and returns the host child_process module.
vm2's allowlist enforcement lives inside vm2's require() implementation. The sandbox did not call require(). The sandbox called the function that require() itself calls.
The full PoC is three lines:
const { NodeVM } = require('vm2');
const vm = new NodeVM({
require: { builtin: ['*', '-child_process'], external: false },
});
const out = vm.run(`
const Module = require('module');
const cp = Module._load('child_process');
module.exports = cp.execSync('id').toString();
`, 'poc.js');
console.log(out.trim());-child_process is honored. The user did not configure child_process to be reachable. child_process was loaded anyway, by a function the user did configure to be reachable.
The patch is a hardcoded list. The list is what the allowlist's grain could not see.
vm2 3.11.0's lib/builtin.js adds two changes that together close every reachable variant of the same primitive. The first is a new constant above BUILTIN_MODULES:
const DANGEROUS_BUILTINS = new Set([
'module',
'worker_threads',
'cluster',
'vm',
'repl',
'inspector'
]);
const BUILTIN_MODULES = (nmod.builtinModules
|| Object.getOwnPropertyNames(process.binding('natives')))
.filter(s => !s.startsWith('internal/') && !DANGEROUS_BUILTINS.has(s));The wildcard no longer expands to these names. A user who writes builtin: ['*', '-child_process'] after the patch gets 58 builtins instead of 63. The six are not in the iteration set.
The second change is inside addDefaultBuiltin:
function addDefaultBuiltin(builtins, key, hostRequire) {
if (builtins.has(key)) return;
const special = SPECIAL_MODULES[key];
if (!special && DANGEROUS_BUILTINS.has(key)) return;
builtins.set(key, special ? special : vm => vm.readonly(hostRequire(key)));
}A user who writes builtin: ['module'] explicitly, naming the builtin they want, gets nothing. The same denylist applies. SPECIAL_MODULES is the only escape hatch, and a developer who genuinely needs a module shim can register a sandbox-safe replacement under that key. The default loader is gone for these six names regardless of how the user names them.
A separate commit on the same branch (b3728f3) added trace_events to the same set six days later, this time for a host-process abort: trace_events.createTracing({categories: [...]}) asserts args[0]->IsArray() in V8 C++, and a sandbox-Proxy array fails the C++ check and aborts the entire host process. Same shape, different consequence. The denylist grew by one.
The maintainer's own commit message names the category the allowlist API does not have a word for:
Six Node builtins expose primitives whose primary capability is "reach host code regardless of the sandbox boundary".
And the same commit's docs/ATTACKS.md addition names it more plainly:
They're meta-builtins that load other builtins by name. The generic
vm.readonly()wrapper cannot make them safe because the sandbox-bypass primitive is the very thing the user is calling.
meta-builtin is a category the allowlist API has no syntactic place for. The patch establishes the category in the source code where the API surface could not. The configuration the user reads is still a flat list of names. The category that determines whether a name is safe to grant is hardcoded one layer below the surface.
The minus syntax operates on names. Loaders are not a category of name.
A user reading the pre-patch README chose '-child_process' because child_process is the name that appears in every Node tutorial about running untrusted code. The same user would have written '-fs' if they wanted to block filesystem access. The minus syntax filters by name match. It does what it says.
It cannot say "every builtin that can load child_process," because the allowlist API has no vocabulary for "loader." The user's mental model of ['*', '-child_process'] is "every builtin minus the dangerous one." The mental model assumes every builtin is either a leaf (does its thing, returns) or fully blocked (refuses, returns nothing). module is neither. module._load(name) is the name resolution that require() itself uses. Calling it is calling the loader.
Node's own documentation does not categorize its builtins as leaf or meta. The vm2 pre-patch README did not either. The only place the distinction now lives is the six-element Set in lib/builtin.js. The configuration surface the user writes against is still the same flat list. The patch is a hardcoded denylist underneath the configuration surface because the configuration surface cannot describe the category.
This is the allowlist-grain-is-the-method shape one level up. The pattern's first exhibit is Grav's Twig sandbox allowing Config::toArray at the method-name grain while the method's return value carries the merged secrets tree. The grain was wrong by one level: the allowlist could ask "is this method permitted to be called," and the security question was "is the data this method returns permitted to flow to this caller." Here the grain is wrong by the same level, with a different container: the allowlist can ask "is this builtin permitted to be loaded," and the security question is "is the data this builtin's methods return permitted to instantiate other builtins." Both fixes share a shape, replace the configured surface with a hardcoded layer underneath, because no allowlist whose grain is the container name can answer the data question.
A loader on the allowlist is a wildcard on the allowlist.
The six names in DANGEROUS_BUILTINS, each spelled out by what they grant:
| Name | Primitive the proxy forwarded |
|---|---|
module |
Module._load(name) loads any host builtin or external module. Module._cache is the host's cache. createRequire(filename) returns a new require bound to the host realm. |
worker_threads |
new Worker(src, { eval: true }) runs arbitrary JS in a fresh thread that has no vm2 sandbox attached. |
cluster |
cluster.fork() spawns a host child process. The child runs the parent's entry script. |
vm |
vm.runInThisContext(src) evaluates src in the host realm. The vm2 bridge is bypassed. |
repl |
repl.start({ eval, input, output }) constructs an interactive evaluator. The eval option is the evaluator function and accepts a sandbox closure that runs against host streams. |
inspector |
inspector.open() attaches the V8 inspector protocol to the host process. Session().post('Runtime.evaluate', { expression }) is host JS execution. |
Each one is a single-line bypass under the pre-patch wildcard. Module._load is the documented PoC; the other five are alternates that produce the same outcome through different host primitives. The patch's denylist treats them identically because the question is identical: the wrapper that vm2 puts around the host builtin cannot remove the host capability the builtin's methods are designed to expose.
This is the allowlist-API variant of vm2's unpatchable primitive.
vm2 v3.11.0 closed thirteen GitHub advisories on May 1, 2026. v3.11.1 cut forty-two minutes later closing one more. v3.11.2 closed three more on May 3. Eighteen advisories across three releases in three days. The CVE-2026-44007 post on the { nesting: true, require: false } configuration trap walked the v3.11.1 entry; the CVE-2026-24120 post on the Promise species lineage walked the V8-internal class.
GHSA-947f-4v7f-x2v8 is a third variant of the same unpatchable primitive. The V8-internal variant lives inside V8's C++ implementations of language features (Promise species, WebAssembly.JSTag, SuppressedError, %AsyncGeneratorPrototype%); vm2's Proxy bridge cannot trap those reads, and the defense is a per-feature wrap added to lib/setup-sandbox.js. The configuration-trap variant lives inside vm2's own option semantics; the defense is a refusal of a specific option pair at the constructor. This variant lives inside the allowlist API's expressive capacity; the defense is a hardcoded category that the API surface cannot encode.
The CVE-2026-43999 patch is the smallest of the three at the source-code level: 48 lines added to one file. It is also the variant with the most direct user-visible regression. A vm2 customer running builtin: ['*'] in production on v3.10.5 had the six meta-builtins reachable; on v3.11.0 they are not, and a sandbox that depended on require('vm') for nested compilation breaks at upgrade. The fix that closes the bypass is the fix that breaks the documented configuration. Six names disappear from a list the user did not know the names belonged to.
vm2 is the design-debt driver of the JavaScript sandboxing space and a working exhibit of the-detector-is-the-target: when the substrate's job is containment, every CVE is the containment failing, and the surface a defender adopts in order to execute hostile code safely is the surface that ends up executing hostile code unsafely. The recurring shape across the eighteen advisories is the same: the substrate (in-process JavaScript isolation via Proxy bridge plus configurable allowlist) lets attacker-influenced code reach host primitives through paths the defense layer did not enumerate ahead of time. Each patch enumerates one more path. This patch enumerates six.
The vm2 README's recommendation is in the same release.
vm2 3.11.0's README adds a new section above the require.builtin documentation:
Treat
require.builtin: ['*']as a non-sandbox configurationThe
'*'wildcard expands to most Node built-ins, includingchild_process,fs,dgram,net,http, anddns. These are full host-capability primitives,require('child_process').execSync('id')is reachable from the sandbox under'*'. vm2's'*'semantics are intentional (some embedders run trusted-but-isolated code), but it should not be used as a default for untrusted code. Prefer an explicit allowlist of the smallest set of modules your sandbox actually needs.
The section enumerates child_process, fs, dgram, net, http, dns. The six names the same release's patch added to DANGEROUS_BUILTINS (module, worker_threads, cluster, vm, repl, inspector) do not appear in this list. They are not mentioned, because after the patch they are not reachable under '*' regardless of the user's exclusion list. The README's warning is about the configuration the user can write that vm2 will still honor. The patch's denylist is about the configuration the user can write that vm2 silently overrides. The two paragraphs are two parts of the same admission: the allowlist's expressive capacity is not what a vm2 caller writing untrusted-code defenses needs it to be. Use it for trusted-but-isolated code, or use isolated-vm.
The README's "More Robust Alternatives" section, three paragraphs further down, is the maintainer's running recommendation across every recent vm2 advisory: isolated-vm, Worker threads with restricted permissions, containers, managed services. Six names removed from the allowlist's effective coverage do not change the recommendation. The recommendation is the same because the substrate is the same.
PoC: GHSA-947f-4v7f-x2v8.
vm2's allowlist named modules. Six of the names named the rest.