Storybook: Missing origin validation in Storybook preview allows code injection from malicious websites
Summary
A malicious website may be able to cause unauthorized file changes in a developer’s project while an affected Storybook development server is running. Under additional conditions, a changed file could be executed by a local runtime with the developer’s privileges. We are not aware of exploitation in the wild.
Who is impacted?
You are impacted if you run a Storybook dev server in the affected versions.
You are not impacted if:
- You run a dev server that you never open in a web browser (e.g. headless automation, MCP clients)
- You run or visit a built version of Storybook
Recent versions of Chrome and Firefox may ask for permission before a website can connect to a localhost service. This reduces the risk, but does not remove it. Do not grant this permission to websites you don’t trust.
Review potentially breaking changes
Due to the exceptional nature of the reported vulnerabilities, the Storybook team has decided to change the default behavior of Storybook, including versions 8 and 9, for several network-related features that are not essential to most Storybook users' workflow. If your team relies on the affected features, feature flags have been added that can disable specific security updates to support your existing workflows.
Please carefully read the introduced flags and the consequences of using them:
- Iframe embedding over the network is disabled by default: Storybook no longer allows the manager or preview to be embedded as an iframe on a website with a different host name. Built versions of Storybook are unaffected and can be freely embedded. If you rely on embedding a Storybook dev server through a separate web app, run that separate app on
localhost. You may also use thesecurity.insecureRemoteIframeEmbedfeature flag to re-enable iframe embedding from any origin. - The preview iframe rejects messages sent by an unknown host: Both the Storybook preview and manager now restrict the origin of iframes and parent windows that they can send messages to and receive messages from using the
postMessageAPI. By default, Storybook in dev mode only accepts communication with its own origin and otherlocalhostservices. Built Storybooks continue to accept communication from unknown origins. A Storybook addon or integration could hypothetically rely onpostMessageto update a live story's args; if you do that, reach out to the Storybook team to explore safer alternatives. Storybook composition also relies onpostMessage, so a composed Storybook on a different origin now fails to load unless it has been built. Thesecurity.insecureIframeMessagingfeature flag disables this protection, but building composed Storybooks is recommended instead. - The
highlightevent signature has changed: Storybook’s own accessibility addon uses thehighlightevent to inject highlights into the preview, which a user can click. Clicking the highlight opens a menu with a link to a documentation page. The API for that event was too permissive and could be used to trigger arbitrary events, including events processed by the user’s dev server. The API has been reworked to prevent abuse. Besides the accessibility addon, Chromatic's Visual Tests addon uses this API to link to documentation from highlighted ignored elements. Update the Visual Tests addon to version 5.5.1 or later to keep that link working. Because no other addons use this API as far as known, no feature flag has been added to restore the old API.
Disclosure timeline
On September 30th, the Storybook team received a responsible disclosure showing how a malicious website can embed a Storybook dev server's preview iframe and send events to the dev server on the developer's machine.
They combined this information with findings from an ongoing security audit to come up with a worst-case-scenario exploitation of the disclosed vulnerability, and the ones independently discovered. They then worked to address all layers necessary for this worst-case scenario to happen. Evidence of exploitation in real Storybook projects has not been received. The attack outlined in this advisory relies on correctly exploiting a sequence of many vulnerabilities, some of which were never disclosed to the Storybook team.
Worst-case attack scenario
An attacker-controlled website can interact with the preview of a running Storybook dev server. With user interaction, it may cause the dev server to make unauthorized changes to story files. If a malicious file is subsequently executed by a local runtime, the attack could lead to arbitrary code execution with the developer’s permissions.
What to do
Upgrade Storybook to a patched version before running storybook dev again:
- 11.0.0-alpha.6
- 10.6.2
- 9.1.21
- 8.6.19
If you cannot upgrade immediately, do not run an affected Storybook dev server until you can apply the fix.
Additionally, update Chromatic's Visual Tests addon to version 5.5.1 or later to maintain documentation linking functionality.
Affected software
Click a technology to see all vulnerabilities affecting it.
| Platform | Package | Vulnerable versions | Fixed in |
|---|---|---|---|
| npm package | storybook | >= 8.0.0, < 8.6.19, >= 9.0.0, < 9.1.21, >= 10.0.0, < 10.6.2, >= 11.0.0-alpha.0, < 11.0.0-alpha.6 | 8.6.19, 9.1.21, 10.6.2, 11.0.0-alpha.6 |
| npm package | @storybook/addon-mcp | >= 10.6.0, < 10.6.2, >= 11.0.0-alpha.0, < 11.0.0-alpha.6 | 10.6.2, 11.0.0-alpha.6 |
| npm package | @storybook/addon-vitest | >= 9.0.0, < 9.1.21, >= 10.0.0, < 10.6.2, >= 11.0.0-alpha.0, < 11.0.0-alpha.6 | 9.1.21, 10.6.2, 11.0.0-alpha.6 |
| npm package | @storybook/core | >= 8.0.0, < 8.6.19 | 8.6.19 |
| npm package | @storybook/core-server | >= 8.0.0, < 8.6.19 | 8.6.19 |
| npm package | @storybook/experimental-addon-test | >= 8.0.0, < 8.6.19 | 8.6.19 |
References
- https://github.com/storybookjs/storybook/security/advisories/GHSA-f2ph-cmg5-wxc8
- https://github.com/storybookjs/storybook/pull/36726
- https://github.com/storybookjs/storybook/commit/243c06bf8f1e2f09446c44868ea100261e1374da
- https://github.com/storybookjs/storybook/commit/3be03ec6f11f4616471cebc3fc65c13e1bf8c178
- https://github.com/storybookjs/storybook/commit/a9ef9345d73224c73e0b81dc2701ec5b465ea9bb
- https://github.com/storybookjs/storybook/commit/d9b09e332510a88689c71ecc081bbbc2d072476e
- https://github.com/storybookjs/storybook/commit/df3fed468c9b4830605f00068c4bc6b7e1e215ed
- https://github.com/storybookjs/storybook
- https://github.com/storybookjs/storybook/releases/tag/v10.6.2
- https://github.com/storybookjs/storybook/releases/tag/v11.0.0-alpha.6
- https://github.com/storybookjs/storybook/releases/tag/v8.6.19
- https://github.com/storybookjs/storybook/releases/tag/v9.1.21
- CVSS vector
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H- Weakness (CWE)
CWE-1021, CWE-22, CWE-346, CWE-441, CWE-749, CWE-862, CWE-94, CWE-96- Platform
- npm
- Package
storybook, @storybook/addon-mcp, @storybook/addon-vitest- Disclosed
- 21.10.2026
- Updated
- 21.10.2026 20:26
Sources and licenses · Edited or translated by DockRay; source rights and applicable licenses are retained.
OSV / GitHub Advisory Database - GHSA-f2ph-cmg5-wxc8 - CC BY 4.0
Vulnerability history: storybook
All published vulnerabilities of this package (npm package), newest first. Shows whether this is a one-off slip or a package that needs watching.
- Total entries
- 3
- First → latest
- 12.2025 10.2026
- Without a fix
- 0
- Exploited in attacks
- 0
Severity breakdown
- Critical 1
- High 2
Disclosures per year
- 2025: 1
- 2026: 2
-
Storybook: Missing origin validation in Storybook preview allows code injection from malicious websites this entry
Know which vulnerabilities affect your application
With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.