Critical

vm2: NodeVM builtin allowlist bypass via node:test.run() execArgv allows sandbox escape

  • Disclosed: 01.10.2026
  • Updated: 11.10.2026 10:22

Summary

On Node.js 24 and newer, vm2 can expose the host node:test module to sandboxed NodeVM code when the embedder explicitly allows the node:test builtin. Sandbox code can reach that module through require('node:node:test') and call run() with attacker-controlled execArgv.

node:test.run() starts a separate Node process for process-isolated test execution and forwards the supplied execArgv values to that process. Supplying --eval=<JavaScript> therefore executes arbitrary JavaScript in an unrestricted host Node process, outside the NodeVM sandbox.

The PoC confirms that direct sandbox imports of fs, child_process, module, and process remain denied before the spawned process imports host fs and writes a harmless marker.

Affected versions and environment

  • Package: vm2
  • Affected versions: >=3.9.6, <=3.11.5
  • Latest reproduced version: 3.11.5
  • Reproduced runtime: Node.js v24.18.0
  • Exact path is not present on Node.js 22 because module.builtinModules does not expose the scheme-only node:test entry there
  • Configuration prerequisite:
js
require: {
  builtin: ['node:test'],
  external: false
}

The lower version boundary was tested directly: vm2@3.9.5 blocks require('node:node:test'), while vm2@3.9.6 permits the exploit path. Representative releases through 3.11.5 were also reproduced.

Root cause

The issue is a combination of builtin admission, generic host passthrough, and prefix normalization:

  1. On Node.js 24+, module.builtinModules includes the scheme-only key node:test.
  2. lib/builtin.js builds BUILTIN_MODULES from that array. The family-based DANGEROUS_BUILTINS protection does not include test, so node:test remains eligible.
  3. When the embedder explicitly allows node:test, addDefaultBuiltin() stores it through the generic loader:
js
builtins.set(key, special ? special : vm => vm.readonly(hostRequire(key)));
  1. In lib/setup-node-sandbox.js, requireImpl() strips one node: prefix before builtin lookup:
js
if (localStringPrototypeStartsWith(filename, 'node:')) {
  id = localStringPrototypeSlice(filename, 5);
  nmod = loadBuiltinModule(id);
}
  1. Consequently, sandbox code requesting node:node:test is normalized to the stored key node:test and receives a readonly proxy to the host module.
  2. The readonly proxy does not make node:test.run() safe. Calls are forwarded to the host implementation, which accepts attacker-controlled execArgv for a newly spawned Node process.
  3. --eval=<attacker JavaScript> runs outside vm2 and has normal host builtin access.

The doubled prefix is the reachability mechanism, but the security boundary failure is broader: the generic host-passthrough loader treats the test builtin family as safe even though its run() API can launch unrestricted Node processes.

Proof of concept

From the poc directory:

bash
npm ci --ignore-scripts --no-audit --no-fund
node repro.js

Expected successful result on Node.js 24+ includes:

js
{
  "vm2Version": "3.11.5",
  "nodeVersion": "v24.18.0",
  "markerExists": true,
  "childIsDistinctProcess": true,
  "marker": {
    "hostCodeExecution": true
  }
}

The PoC writes only host-rce-marker.json in its own directory and does not invoke a shell, contact a network service, or access third-party data.

Impact

An attacker who is intentionally permitted to execute untrusted JavaScript in the affected NodeVM configuration can escape the sandbox and execute arbitrary JavaScript under the embedder's operating-system identity.

This provides the spawned process with the host user's filesystem, environment, network, and process-execution permissions. It can therefore result in complete confidentiality, integrity, and availability impact for the hosting service.

Suggested remediation

Treat the normalized test builtin family as dangerous before wildcard expansion and explicit builtin registration.

For example, add test to DANGEROUS_BUILTINS so the existing prefix and family checks reject both node:test and node:test/reporters:

js
const DANGEROUS_BUILTINS = new Set([
  // existing entries
  'test'
]);

If test helpers must be exposed, provide a sandbox-local wrapper through mock or override that does not expose run(), process isolation, execArgv, or other host process controls.

Recommended regression cases:

  • explicit builtin: ['node:test']
  • wildcard builtin configurations
  • require('node:test')
  • require('node:node:test')
  • node:test/reporters and prefixed variants
  • direct low-level builtin registration
  • attempts to pass --eval, --require, or --import through test-runner process options vm2-node-test-ghsa-submission.zip

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
npm package vm2 >= 3.9.6, < 3.11.7 3.11.7

References

CVSS score 9.9/10
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
Weakness (CWE)
CWE-693
Platform
npm
Package
vm2
Disclosed
01.10.2026
Updated
11.10.2026 10:22

Sources and licenses

OSV / GitHub Advisory Database - GHSA-qhwx-74w5-xhxq - CC BY 4.0

Vulnerability history: vm2

All published vulnerabilities of this package (npm package), newest first. Shows whether this is a one-off slip or a package that needs watching.

All (78) in the archive
Total entries
78
First → latest
10.2021 10.2026
Without a fix
1
Exploited in attacks
0

Severity breakdown

  • Critical 51
  • High 14
  • Medium 12
  • Low 1

Disclosures per year

  1. 2021: 1
  2. 2022: 4
  3. 2023: 7
  4. 2024: 0
  5. 2025: 0
  6. 2026: 66
Severity:
  1. Critical · 10.0 CVE-2026-93605 < 3.12.1 3.12.1
  2. Critical · 10.0 CVE-2026-100721 < 3.12.2 3.12.2
  3. Critical · 10.0 CVE-2026-92955 < 3.11.8 3.11.8
  4. Critical · 10.0 CVE-2026-92956 >= 3.10.1, < 3.11.7 3.11.7
  5. vm2: NodeVM builtin allowlist bypass via node:test.run() execArgv allows sandbox escape this entry
    Critical · 9.9 CVE-2026-92948 >= 3.9.6, < 3.11.7 3.11.7
  6. Critical · 10.0 CVE-2026-92940 >= 3.11.3, < 3.11.7 3.11.7
  7. Critical · 9.0 CVE-2026-92935 >= 3.11.4, < 3.11.7 3.11.7
  8. Critical · 10.0 CVE-2026-92937 >= 3.11.6, < 3.11.7 3.11.7
  9. Critical · 9.9 CVE-2026-92938 >= 3.11.3, < 3.11.7 3.11.7
  10. Critical · 9.9 CVE-2026-92939 >= 3.11.3, < 3.11.7 3.11.7
  11. Critical · 9.8 CVE-2026-92944 >= 3.10.2, < 3.11.7 3.11.7
  12. Critical · 10.0 CVE-2026-92941 >= 3.11.3, < 3.11.7 3.11.7
  13. High · 7.5 CVE-2026-92961 < 3.11.6 3.11.6
  14. Critical · 9.8 CVE-2026-47698 < 3.11.6 3.11.6
  15. Critical · 9.8 CVE-2026-47210 < 3.11.4 3.11.4
  16. Critical · 10.0 CVE-2026-47208 < 3.11.4 3.11.4
  17. Critical · 10.0 CVE-2026-47131 < 3.11.4 3.11.4
  18. Critical · 9.8 CVE-2026-45411 < 3.11.3 3.11.3
  19. Critical · 9.8 CVE-2026-44009 < 3.11.2 3.11.2
  20. Critical · 9.8 CVE-2026-44008 < 3.11.2 3.11.2
  21. Critical · 10.0 CVE-2026-44005 >= 3.9.6, < 3.11.0 3.11.0
  22. Critical · 10.0 CVE-2026-43997 < 3.11.0 3.11.0
  23. Critical · 10.0 CVE-2026-44006 < 3.11.0 3.11.0
  24. Critical · 9.8 CVE-2026-26956 < 3.10.5 3.10.5
  25. Critical · 9.8 CVE-2026-26332 < 3.11.0 3.11.0
  26. Critical · 9.8 CVE-2026-24781 < 3.11.0 3.11.0
  27. Critical · 9.8 CVE-2026-24120 < 3.10.5 3.10.5
  28. Critical · 9.8 CVE-2026-24118 < 3.11.0 3.11.0
  29. Critical · 9.8 CVE-2026-22709 < 3.10.2 3.10.2
  30. Critical · 9.8 CVE-2023-37466 < 3.10.0 3.10.0
  31. Critical · 9.8 CVE-2023-37903 <= 3.9.19 no fix
  32. Critical · 9.8 CVE-2023-32314 < 3.9.18 3.9.18
  33. Critical · 9.8 CVE-2023-30547 < 3.9.17 3.9.17
  34. Critical · 9.8 CVE-2023-29199 < 3.9.16 3.9.16
  35. Critical · 9.8 CVE-2023-29017 < 3.9.15 3.9.15
  36. Critical · 9.8 CVE-2022-25893 < 3.9.10 3.9.10
  37. Critical · 10.0 CVE-2022-36067 < 3.9.11 3.9.11
  38. High · 8.3 CVE-2019-10761 < 3.6.11 3.6.11
  39. Critical · 9.8 CVE-2021-23555 < 3.9.6 3.9.6
  40. Critical · 9.8 CVE-2021-23449 < 3.9.4 3.9.4

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.