Skip to content

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

Description

@1688mengdie

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 32f2427 (origin/main).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions