Deny raw host proto-readers and divert callable writes off host prototypes

fix(GHSA-88hf-g992-jg85): deny raw host proto-readers and divert callable writes off host prototypes
Deny raw host proto-readers and divert callable writes off host prototypes22a437-fix-deny-raw-host-proto-readers-and-divert-cve-2026-92955fixdeny raw host proto readers divert

Committed by patriksimek-bot

commit message
fix(GHSA-88hf-g992-jg85): deny raw host proto-readers and divert callable writes off host prototypes

Root cause: the bridge flattens the host prototype chain, but classified only
the host `__proto__` *setter* as dangerous, not the *getter*. Sandbox code under
NodeVM `console: 'inherit'` extracted the raw host `Object.prototype.__proto__`
getter (the GHSA-v6mx/cfcw primitive) and invoked it to pierce the flattened
view, climbing `console._stdout`'s chain to the non-intrinsic, unprotected
`EventEmitter.prototype`, overwriting `emit`, and having the host call it with
`this === process` → host RCE.
 
Fix (two independent layers in lib/bridge.js):
- Read side (primary): the raw host proto-readers (`__proto__` getter,
  `Object.getPrototypeOf`, `Reflect.getPrototypeOf`) are recorded in
  `dangerousHostProtoReaders` and denied delivery at the read chokepoints
  (`thisFromOtherWithFactory`, the ensureThis re-entry path, the throw path) —
  each check placed immediately after the existing cache check and the sibling
  `isDangerousHostProtoMutator` denial, collapsing the reader to a non-callable
  `emptyFrozenObject`. The apply trap refuses reader invocation (direct,
  `Function.prototype.{call,apply,bind}` peel, and `Reflect.{apply,construct}`)
  as defense-in-depth.
- Write side (payoff): host `[[Prototype]]` objects are marked eagerly at
  delivery (`looksLikeHostPrototype` -> `hostObjectsUsedAsPrototype`) and
  sandbox function/accessor writes to them are diverted onto the sandbox-side
  proxy target in `BaseHandler.set` / `defineProperty`, so no callable can be
  planted on a shared host prototype even if some future read path reaches one.
 
Legitimate `Object.getPrototypeOf(hostProxy)` via the `getPrototypeOf` trap,
data writes, and writes to leaf host objects are unchanged (embedder contract
preserved). Restores the flattened-prototype-view invariant against reader-side
extraction, symmetric to the mutator-side GHSA-v6mx/cfcw defenses.
 
Tests: test/ghsa/GHSA-88hf-g992-jg85/repro.js (getter climb, stacked
call-indirection variants, write-diversion, and preserved-contract cases). The
now-stronger raw-getter denial also changes the exact outcome asserted by the
published proto-walk regressions, so their assertions are widened to accept the
harder denial while still failing on any real host leak: test/vm.js and
test/ghsa/GHSA-{47x8-96vw-5wg6,55hx-c926-fr95,grj5-jjm8-h35p,v37h-5mfm-c47c}/.
 
docs/ATTACKS.md: new Category 50 (Host Prototype-Chain Climb via Raw
`__proto__` Getter, reader side) plus a How The Bridge Defends row.

Editor assessment

This commit patches CVE-2026-92955. The body explains the raw __proto__ getter being classified as a reader, the console._stdout climb to EventEmitter.prototype, and the two-layer fix: deny raw proto-readers and divert callable writes. The subject is precise but 100 characters, and the scope is a GHSA id, which is not a codebase area. Those two formal issues - length and scope semantics - are what keep a technically strong message at 3. The two-layer structure is clear; one concrete example of the getter climb would make the attack memorable for reviewers.

Browse categories

More fix examples · Back to search