Refuse host prototype mutators and severed host values at the bridge

fix(GHSA-cfcw-xp6x-25gj): refuse host prototype mutators and severed host values at the bridge
Refuse host prototype mutators and severed host values at the bridgea85acb-fix-refuse-host-prototype-mutators-and-severed-cve-2026-47698fixrefuse host prototype mutators severed values

Committed by patriksimek-bot

commit message
fix(GHSA-cfcw-xp6x-25gj): refuse host prototype mutators and severed host values at the bridge

Root cause: the GHSA-v6mx-mf47-r5wg apply-trap defense peeled exactly one
layer of Function.prototype.{call,apply,bind} / Reflect.{apply,construct}
indirection. Stacking two layers -- Buffer.call.call(Buffer.call, setProto,
target, null) -- moved the dangerous host prototype mutator out of the
inspected argument position, letting the sandbox sever a host intrinsic's
prototype chain and then escape through the canonical
e.constructor.constructor pivot.
 
A follow-up bypass avoided the bridge entirely: composing
Function.prototype.apply.bind(call, call) over a genuine host array's .map
ran the __proto__ setter wholly in the host realm, so no identity-based
check at the boundary ever fired.
 
Fix: two independent, mechanism-independent chokepoints, either of which
blocks the escape on its own.
 
  lib/bridge.js -- thisFromOtherWithFactory, thisFromOtherForThrow, and
  thisEnsureThis consult isDangerousHostProtoMutator after the
  mappingOtherToThis cache check and return the frozen sentinel for raw,
  uncached host references. The sandbox never obtains a callable reference
  to a host prototype mutator, however many indirection wrappers it stacks.
  Cache-first ordering preserves connect()-registered sandbox surrogates for
  __defineGetter__ / __defineSetter__ (issue #176).
 
  lib/setup-sandbox.js -- handleException (isForeignSeveredHostValue) and
  the bridge's proto-walk fall-through both refuse any host-realm object
  whose prototype chain reaches null without passing through the sandbox
  Object.prototype, the universal signature of a severed host carrier. This
  targets the payoff rather than the mechanism, so it holds regardless of
  how the severance was performed. The sandbox Object.prototype is
  unforgeable host-side (it crosses as a proxy), so the discriminator cannot
  be spoofed; Object.create(null) is exempt.
 
Conflict resolution: docs/ATTACKS.md -- this branch and
GHSA-v836-6xw4-9cx3 both claimed Category 36. v836 landed first and keeps
36; this category is renumbered to 37, with its header, cross-references,
and anchors updated. The two additions are otherwise disjoint and both are
kept in full. CHANGELOG: the branch filed its entry under the released
[3.11.5] heading; moved to [Unreleased] alongside the other three landings.
 
Tests: test/ghsa/GHSA-cfcw-xp6x-25gj/repro.js covers the stacked-call,
map/bind laundering, and forEach variants; all fail without the patch.
 
docs/ATTACKS.md: new Category 37.
 
Known follow-up, pre-dating this change: the Summary tables ("How The Bridge
Defends", "Compound Attack Patterns") have no rows for Categories 25-37.
Left for a dedicated documentation pass rather than partially filled here.
 
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

Editor assessment

This commit patches CVE-2026-47698. The body explains the two-layer indirection bypass—Buffer.call.call moving the mutator out of the inspected position—and the entirely host-realm map and bind laundering, then describes two mechanism-independent chokepoints: refusing dangerous host proto mutators after the cache check, and rejecting severed host values by prototype shape. It notes the issue #176 cache-first ordering and the ATTACKS.md Category 36 to 37 renumbering. The closing admission that summary tables lack rows for Categories 25-37 is candid. The GHSA-in-scope header and dense prose are the only issues, keeping this at acceptable.

Browse categories

More fix examples · Back to search