Deny os and dns NodeVM builtins

fix(GHSA-m5w8-4gq2-6f8x): deny os and dns NodeVM builtins
Deny os and dns NodeVM builtins768bcf-fix-deny-os-and-dns-nodevm-builtins-cve-2026-92960fixdeny dns nodevm builtins ghsa m5w8

Committed by patriksimek-bot

commit message
fix(GHSA-m5w8-4gq2-6f8x): deny os and dns NodeVM builtins

Root cause: `os` and `dns` were the two remaining members of the
process-wide builtin class closed by GHSA-9g8x-92q2-p28f. Under
`builtin: ['*']` they loaded through the default
`vm.readonly(hostRequire(key))` path, which cannot localise host-process
state -- and both carry write APIs (`dns.setServers`,
`dns.setDefaultResultOrder`, `os.setPriority`) that mutate global host
state from one line of sandbox code.
 
Fix: add 'os' and 'dns' to DANGEROUS_BUILTINS in lib/builtin.js. The
existing family-prefix matcher `isDangerousBuiltin` extends this to
`node:os`, `node:dns`, and `dns/promises` with no further change, and both
enforcement layers (the `BUILTIN_MODULES` wildcard filter and
`addDefaultBuiltin` rejection) apply automatically. Restores Defense
Invariant #13 -- the NodeVM builtin allowlist is a closed system. The
`mock` / `override` escape hatch is preserved for embedders needing a
sandbox-local subset.
 
Tests: test/ghsa/GHSA-m5w8-4gq2-6f8x/repro.js. Also updates
test/ghsa/GHSA-rp36-8xq3-r6c4/repro.js, whose "safe siblings still load"
case used `dns/promises` as an example of a permitted subpath; it now uses
`fs/promises` and `stream/promises`, since `dns/promises` is denied by
this change.
 
docs/ATTACKS.md: Category 35 extended with the os/dns read and write
primitives. No version bump.
 
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

Editor assessment

This commit patches CVE-2026-92960. The body explains that os and dns were the remaining process-wide builtins, that both carry write APIs such as dns.setServers and os.setPriority, and how adding them to DANGEROUS_BUILTINS covers the node: prefixes and subpaths while preserving the mock/override escape hatch. The reasoning is clear and tested. The GHSA-id scope is the sole formal issue under CCv1, capping the score at 3. A note on why os and dns counted as process-wide, rather than merely stateful, would make the denylist rationale easier to generalize.

Browse categories

More fix examples · Back to search