GHSA-QHWX-74W5-XHXQ
Vulnerability from github – Published: 2026-10-01 15:41 – Updated: 2026-10-01 15:41Summary
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.builtinModulesdoes not expose the scheme-onlynode:testentry there - Configuration prerequisite:
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:
- On Node.js 24+,
module.builtinModulesincludes the scheme-only keynode:test. lib/builtin.jsbuildsBUILTIN_MODULESfrom that array. The family-basedDANGEROUS_BUILTINSprotection does not includetest, sonode:testremains eligible.- When the embedder explicitly allows
node:test,addDefaultBuiltin()stores it through the generic loader:
builtins.set(key, special ? special : vm => vm.readonly(hostRequire(key)));
- In
lib/setup-node-sandbox.js,requireImpl()strips onenode:prefix before builtin lookup:
if (localStringPrototypeStartsWith(filename, 'node:')) {
id = localStringPrototypeSlice(filename, 5);
nmod = loadBuiltinModule(id);
}
- Consequently, sandbox code requesting
node:node:testis normalized to the stored keynode:testand receives a readonly proxy to the host module. - The readonly proxy does not make
node:test.run()safe. Calls are forwarded to the host implementation, which accepts attacker-controlledexecArgvfor a newly spawned Node process. --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:
npm ci --ignore-scripts --no-audit --no-fund
node repro.js
Expected successful result on Node.js 24+ includes:
{
"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:
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/reportersand prefixed variants- direct low-level builtin registration
- attempts to pass
--eval,--require, or--importthrough test-runner process options vm2-node-test-ghsa-submission.zip
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 3.11.6"
},
"package": {
"ecosystem": "npm",
"name": "vm2"
},
"ranges": [
{
"events": [
{
"introduced": "3.9.6"
},
{
"fixed": "3.11.7"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-92948"
],
"database_specific": {
"cwe_ids": [
"CWE-693"
],
"github_reviewed": true,
"github_reviewed_at": "2026-10-01T15:41:31Z",
"nvd_published_at": null,
"severity": "CRITICAL"
},
"details": "## Summary\n\nOn 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(\u0027node:node:test\u0027)` and call `run()` with attacker-controlled `execArgv`.\n\n`node:test.run()` starts a separate Node process for process-isolated test execution and forwards the supplied `execArgv` values to that process. Supplying `--eval=\u003cJavaScript\u003e` therefore executes arbitrary JavaScript in an unrestricted host Node process, outside the `NodeVM` sandbox.\n\nThe 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.\n\n## Affected versions and environment\n\n- Package: `vm2`\n- Affected versions: `\u003e=3.9.6, \u003c=3.11.5`\n- Latest reproduced version: `3.11.5`\n- Reproduced runtime: Node.js `v24.18.0`\n- Exact path is not present on Node.js 22 because `module.builtinModules` does not expose the scheme-only `node:test` entry there\n- Configuration prerequisite:\n\n```js\nrequire: {\n builtin: [\u0027node:test\u0027],\n external: false\n}\n```\n\nThe lower version boundary was tested directly: `vm2@3.9.5` blocks `require(\u0027node:node:test\u0027)`, while `vm2@3.9.6` permits the exploit path. Representative releases through `3.11.5` were also reproduced.\n\n## Root cause\n\nThe issue is a combination of builtin admission, generic host passthrough, and prefix normalization:\n\n1. On Node.js 24+, `module.builtinModules` includes the scheme-only key `node:test`.\n2. `lib/builtin.js` builds `BUILTIN_MODULES` from that array. The family-based `DANGEROUS_BUILTINS` protection does not include `test`, so `node:test` remains eligible.\n3. When the embedder explicitly allows `node:test`, `addDefaultBuiltin()` stores it through the generic loader:\n\n```js\nbuiltins.set(key, special ? special : vm =\u003e vm.readonly(hostRequire(key)));\n```\n\n4. In `lib/setup-node-sandbox.js`, `requireImpl()` strips one `node:` prefix before builtin lookup:\n\n```js\nif (localStringPrototypeStartsWith(filename, \u0027node:\u0027)) {\n id = localStringPrototypeSlice(filename, 5);\n nmod = loadBuiltinModule(id);\n}\n```\n\n5. Consequently, sandbox code requesting `node:node:test` is normalized to the stored key `node:test` and receives a readonly proxy to the host module.\n6. 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.\n7. `--eval=\u003cattacker JavaScript\u003e` runs outside vm2 and has normal host builtin access.\n\nThe 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.\n\n## Proof of concept\n\nFrom the `poc` directory:\n\n```bash\nnpm ci --ignore-scripts --no-audit --no-fund\nnode repro.js\n```\n\nExpected successful result on Node.js 24+ includes:\n\n```json\n{\n \"vm2Version\": \"3.11.5\",\n \"nodeVersion\": \"v24.18.0\",\n \"markerExists\": true,\n \"childIsDistinctProcess\": true,\n \"marker\": {\n \"hostCodeExecution\": true\n }\n}\n```\n\nThe 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.\n\n## Impact\n\nAn 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\u0027s operating-system identity.\n\nThis provides the spawned process with the host user\u0027s filesystem, environment, network, and process-execution permissions. It can therefore result in complete confidentiality, integrity, and availability impact for the hosting service.\n\n## Suggested remediation\n\nTreat the normalized `test` builtin family as dangerous before wildcard expansion and explicit builtin registration.\n\nFor example, add `test` to `DANGEROUS_BUILTINS` so the existing prefix and family checks reject both `node:test` and `node:test/reporters`:\n\n```js\nconst DANGEROUS_BUILTINS = new Set([\n // existing entries\n \u0027test\u0027\n]);\n```\n\nIf 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.\n\nRecommended regression cases:\n\n- explicit `builtin: [\u0027node:test\u0027]`\n- wildcard builtin configurations\n- `require(\u0027node:test\u0027)`\n- `require(\u0027node:node:test\u0027)`\n- `node:test/reporters` and prefixed variants\n- direct low-level builtin registration\n- attempts to pass `--eval`, `--require`, or `--import` through test-runner process options\n[vm2-node-test-ghsa-submission.zip](https://github.com/user-attachments/files/29930119/vm2-node-test-ghsa-submission.zip)",
"id": "GHSA-qhwx-74w5-xhxq",
"modified": "2026-10-01T15:41:31Z",
"published": "2026-10-01T15:41:31Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/patriksimek/vm2/security/advisories/GHSA-qhwx-74w5-xhxq"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-92948"
},
{
"type": "WEB",
"url": "https://github.com/patriksimek/vm2/commit/415339f698f0d52d3c5ad358b12b79c8072d5b4b"
},
{
"type": "PACKAGE",
"url": "https://github.com/patriksimek/vm2"
},
{
"type": "WEB",
"url": "https://github.com/patriksimek/vm2/releases/tag/v3.11.7"
},
{
"type": "WEB",
"url": "https://www.vulncheck.com/advisories/vm2-3.9.6-through-3.11.5-sandbox-escape-via-node-test"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "vm2: NodeVM builtin allowlist bypass via node:test.run() execArgv allows sandbox escape"
}
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
Related by attack behaviour
Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.