GCWing / GCWing/OpenBitFun

[Security]: generative widget accepts postMessage updates from any window (HTML injection via forged bitfun-widget:update)

Aperta Adatta ai principianti
#2,603 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Rust
Stelle
2.2k
Fork
229
Merge medio
2h 46m
PR unite (30g)
577

Descrizione

Summary: The generative widget iframe shell processes `message` events without verifying the sender. Any window that can postMessage into the host page can forge a `bitfun-widget:update` event, causing arbitrary attacker-controlled HTML to be written into the widget document via `setContent`.

Area: Web UI

Reproduction or evidence: `src/web-ui/src/tools/generative-widget/GenerativeWidgetFrame.tsx:862` registers `window.addEventListener('message', ...)` whose handler reads `event.data` and, for `type === 'bitfun-widget:update'`, calls `setContent(String(data.html || ''), Boolean(data.runScripts))` with no `event.source` check — while the reverse (iframe→parent) direction already validates `event.source` against the iframe content window (:921/:922).

Environment: BitFun version/commit 32f2427697ee16f253ee6119860a03255c0b3e47 (origin/main).

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start in src/web-ui/src/tools/generative-widget/GenerativeWidgetFrame.tsx around lines 862 and 921-922. Compare the incoming message handler with the existing iframe-to-parent source validation, then verify that updates from unrelated windows cannot reach setContent while valid widget updates still work. Done means forged bitfun-widget:update messages no longer control the widget HTML.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
typescript
Ambito
frontend, security
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Attiva
Chiarezza
Specificata chiaramente
Idoneità per principianti
78/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.