[Security]: generative widget accepts postMessage updates from any window (HTML injection via forged bitfun-widget:update)
- 主要言語
- Rust
- スター
- 2.3k
- フォーク
- 231
- 平均マージ
- 2時間 49分
- マージ済み PR(30日)
- 589
説明
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).
コントリビューションガイド
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- frontend, security
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 活発
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 78/100