Strip dangerous cross-realm symbols at bridge boundary

fix(GHSA-47x8-96vw-5wg6): strip dangerous cross-realm symbols at bridge boundary
Strip dangerous cross-realm symbols at bridge boundaryc1db60-fix-strip-dangerous-cross-realm-symbols-at-bridge-cve-2026-43997fixstrip dangerous cross realm symbols bridge

Committed by patriksimek

commit message
fix(GHSA-47x8-96vw-5wg6): strip dangerous cross-realm symbols at bridge boundary

Closes GHSA-47x8-96vw-5wg6.
Duplicate of: GHSA-qcp4-v2jj-fjx8, GHSA-f539-x546-3726.
 
Sandbox code reaches host `Object.getOwnPropertySymbols(Buffer.prototype)`
(and equivalent reflection paths) to extract the real
`Symbol.for('nodejs.util.inspect.custom')`, registers it as a key on a
plain sandbox object, then triggers host util.inspect via
`WebAssembly.compileStreaming(obj).catch(...)` — invoking the attacker's
function with the raw host `inspect` and reaching host Function.
 
The existing `isDangerousCrossRealmSymbol` filter only fired at
key-access sites; the four `this*Other*` conversion functions passed
symbol primitives through unchanged.
 
Three-layer defense in lib/bridge.js:
- Symbol-boundary filter: `case 'symbol':` branches in
  thisFromOtherWithFactory / thisEnsureThis / thisFromOtherForThrow now
  return undefined for dangerous cross-realm symbols.
- Pre-wrap container scrub: apply/construct traps invoke
  stripDangerousSymbolsFromHostResult(ret) before wrapping.
- ownKeys trap rewrite: iterates the raw host array via otherReflectGet
  to drop dangerous keys directly, preserving Proxy ownKeys invariant.

Editor assessment

This commit patches CVE-2026-43997. The body traces a complete exploit: extracting Symbol.for('nodejs.util.inspect.custom') via getOwnPropertySymbols on Buffer.prototype, keying it onto a sandbox object, and triggering host util.inspect through WebAssembly.compileStreaming to reach host Function. It then explains why the existing isDangerousCrossRealmSymbol filter missed the symbol case and lists the three boundary fixes. Closes and duplicate-advisory footers are properly formed. The only defect is the header, where GHSA-47x8-96vw-5wg6 is used as a scope even though it names no codebase section, and the subject stretches to keep the description. Acceptable rather than strong because of that scope misuse.

Browse categories

More fix examples · Back to search