CVE-2026-92946: vm2: NodeVM `require.external` without an explicit `require.root` grants unrestricted host filesystem access and full RCE
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.
References
- github.com/advisories/GHSA-j3hm-6rg5-mchv
- github.com/patriksimek/vm2/commit/903017c8a1eae9aba947ec854468b48155e79f86
- github.com/patriksimek/vm2/releases/tag/v3.11.7
- github.com/patriksimek/vm2/security/advisories/GHSA-j3hm-6rg5-mchv
- nvd.nist.gov/vuln/detail/CVE-2026-92946
- www.vulncheck.com/advisories/vm2-before-3.11.7-remote-code-execution-via-require-external
Code Behaviors & Features
Detect and mitigate CVE-2026-92946 with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →