Storybook preview accepts channel events from any origin
0-click script execution on the React renderer via element revival. Demonstrated against a live deployment: satellite-storybook.algolia.com
Root cause — two defects
1. No origin validation on the preview branch.PostmsgTransport.handleEvent handles any
message whose payload carries key === "storybook-channel". Its only guard is
if (!event.source) return, and on the preview branch event.source is assigned the
sender's origin string — never falsy for a real postMessage. The origin comparison exists
only on the manager branch.
2. The preview broadcasts with a wildcard target.send calls
f.postMessage(data, '*'), so the preview also leaks its channel traffic to whatever page embeds it.
Why React is 0-click (this is the new part)
It is widely assumed only the Angular renderer is 0-click, because Angular interpolates args into
template source that it then compiles, while React/Vue escape args as text — leaving only a
javascript: URI in an href-like arg, which needs a click.
That is not the ceiling. telejson's parser defaults include allowSymbol: true, so a string
"_gsymbol_react.element" is revived into a real Symbol.for('react.element'). That defeats
the $$typeof guard React uses to reject untrusted element-shaped objects, so
updateStoryArgs can deliver a forged React element:
React renders it as <iframe srcDoc> with no sandbox ⇒ execution is automatic. The sink is
the element rendering itself, not an href arg — so no click is required.
Verification gotcha. The payload runs in about:srcdoc, so location.origin reads
null. Do not use that to judge the result. The valid proof is document.domain equal to
the target host, parent.location.origin equal to https://<target>, and a DOM node written
into the parent document — same-origin access that only succeeds if execution really is in the target origin.
Safety. Non-destructive. The payload writes one marker <div> into the preview's own DOM,
reads origin-scoped values, and reports them back to this page. It exfiltrates nothing and modifies no account.
Run it
Mitigation
Fix
Effect
Validate sender origin on the preview branch (as the manager branch already does)
Closes the root cause
Replace postMessage(data,'*') with an explicit target origin
Stops channel leakage to embedders
Disable allowSymbol in the channel's telejson options
Kills the element-revival variant specifically
Serve the preview with a strict CSP (no unsafe-inline)
Verified mitigation — srcdoc iframes inherit the parent CSP, so the payload is blocked