Storybook CVE-2026–114125: From Cross-Origin Messaging to Code Injection
Storybook's preview message transport accepted postMessage events from any origin without checking the sender, and the highlight feature let attacker-controlled data choose which event was emitted over the preview's privileged server-channel WebSocket. A malicious website could therefore make a running Storybook development server create or overwrite project files, write outside the project root via path traversal, and enumerate source files, with two genuine user clicks needed for the demonstrated file-write path.
Published on medium.com
Storybook
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
Storybook is a development tool for building and testing UI components in isolation. It runs a development server and serves two main parts in the browser: a manager (the UI shell with the sidebar and panels) and a preview (the iframe that renders the actual components). The two communicate with each other using postMessage, and the preview also keeps a WebSocket connection open to the Storybook development server, called the server channel.
The vulnerability described here, tracked as CVE-2026-114125 and published under GHSA-f2ph-cmg5-wxc8, is a missing origin check in the preview side of that message transport. A malicious website could send crafted messages to a running Storybook development environment. By chaining this with the preview's highlight functionality and privileged server-channel handlers, the researcher was able to create and overwrite project files, write outside the project root, and enumerate source files. The advisory rates it Critical with CVSS 9.4.
The interesting part is that the attacker never needs to connect directly to Storybook's privileged WebSocket endpoint. The attack uses the legitimate preview running in the developer's browser as a bridge to the development server.
Setup
The researcher reproduced the issue against Storybook 10.6.0 using a minimal React/Vite Storybook project. The test environment contained a basic component and story file:
src/├── Button.tsx└── Button.stories.tsx
The development server was started with:
./node_modules/.bin/storybook dev -p 6155 --no-open --ci
A separate page was then served from another origin, http://[redacted]:8099, and the Storybook preview was embedded in it:
<iframe src="http://[redacted]:6155/iframe.html?id=example-button--primary&viewMode=story"></iframe>
In the tested configuration, the development server did not send X-Frame-Options or a CSP frame-ancestors policy that prevented this embedding.
Finding it
Storybook uses postMessage to communicate between its manager and preview, and the preview maintains a connection to the Storybook development server through a server-channel WebSocket. While examining the preview's message transport, the researcher found that it accepted incoming messages containing:
{ key: "storybook-channel", event: { }}
The preview transport in code/core/src/channels/postmessage/index.ts did not validate the origin of the incoming message before accepting it. The manager-side implementation performed sender-origin validation, but the corresponding preview path did not enforce the same trust boundary. That was the first problem: a message from an unrelated website could be accepted as a legitimate Storybook channel message.
The consequences became more significant when tracing how those messages were processed.
Exploitation
Step 1: The preview has a privileged server-channel connection
Storybook's createBrowserChannel, implemented in code/core/src/channels/index.ts, establishes a WebSocket connection to the development server:
ws://<host>:<port>/storybook-server-channel?token=...
This connection is used for communication between the preview and the local development environment. The important distinction is that the browser's preview already has a legitimate connection to the server. The attacker does not need to independently establish that connection or obtain its token. If attacker-controlled input can cause the preview to emit arbitrary server-channel events, the preview effectively becomes a confused deputy: it uses its own authority to carry out actions initiated by another origin.
Step 2: The highlight functionality provides the bridge
The next piece was in:
code/core/src/highlight/useHighlights.ts
The highlight functionality allows elements in the preview to be highlighted and associated with interactive menu items. The menu renderer effectively performs the following operation:
channel.emit(event, id, getEventDetails(target));
Both the event name and the first argument can be influenced by the highlight payload. This mattered because the preview was not merely accepting an untrusted message. It was allowing data from that message to influence which event would be emitted over its privileged server channel. By crafting the highlight payload, the researcher could reach server-side handlers that were never intended to be exposed through an arbitrary cross-origin message.
Step 3: The server processes the emitted events
The server registers handlers for various operations, including:
saveStoryRequestfileComponentSearchRequestcreateNewStoryfileRequestghostStoriesopenInEditorRequest
These handlers perform actions against the developer's project or interact with local development tools. The resulting attack chain was:
Attacker-controlled website | | postMessage vStorybook preview | | Unvalidated channel message vHighlight functionality | | Crafted event name and arguments vPrivileged server-channel WebSocket | vStorybook development server | + + + + +
The issue was therefore not simply missing origin validation in isolation. The impact came from combining that validation failure with a message-processing path that allowed attacker-controlled data to reach privileged server-side operations.
Step 4: Sending the crafted highlight payload
From the foreign-origin page, the researcher sent a crafted message to the iframe. The following is a shortened representation of the highlight payload used in the test:
{ "key": "storybook-channel", "event": { "type": "storybook/highlight/add", "args": [ { "id": "<hl>", "selectors": ["button"], "styles": { "outline": "2px dashed #f0f" }, "menu": [ { "id": { "id": "pwn-1", "payload": { "componentFilePath": "src/PWNED.tsx", "componentExportName": "PWNED", "componentIsDefaultExport": true, "componentExportCount": 1 } },
"title": "Open component docs", "clickEvent": "createNewStoryfileRequest" } ] } ] }}
The message creates a highlight with a menu item whose event name is attacker-controlled.
Step 5: Two genuine clicks
To activate the demonstrated path, the researcher performed two genuine clicks inside the preview: one to open the menu associated with the highlighted element, and another to activate the menu item. The preview then emitted a WebSocket message to the Storybook development server, and the server created:
src/PWNED.stories.tsx
This confirmed that the cross-origin message could influence an operation performed by the local development server.
An important detail of this proof of concept is that the demonstrated attack required two genuine user clicks inside the preview. Sending the same highlight payload without performing those clicks did not emit the relevant WebSocket event or create the file. This distinction matters when assessing exploitability: the issue allowed a malicious origin to prepare the interaction, but the demonstrated file-write path was not interaction-free.
Step 6: Creating and overwriting project files
Once it was established that the server was processing attacker-controlled event names and arguments, other reachable handlers were tested. Using createNewStoryfileRequest, a new story file could be created. Using saveStoryRequest, an existing story file could be overwritten, including:
src/Button.stories.tsx
This was more serious than simply creating an unexpected file. An existing project file could be modified without the developer intentionally initiating the corresponding operation.
Step 7: Writing outside the project root
The most notable result came from tracing the server-side implementation of save-story.ts. The code used the attacker-controlled importPath when constructing the destination path:
join(process.cwd(), importPath)
In the test, the researcher supplied:
../../../../tmp/csf-target.stories.tsx
This resulted in a file being written to:
/tmp/csf-target.stories.tsx
The destination was outside the Storybook project root. The underlying issue is that joining a path to the current working directory does not, by itself, guarantee that the resolved destination remains inside that directory. Traversal components such as .. can escape the intended location unless the application performs appropriate validation. This expanded the impact from unauthorised modifications within the project to writes elsewhere on the filesystem, subject to the development server process's filesystem permissions.
Step 8: Enumerating source files
The researcher also reached fileComponentSearchRequest. This allowed enumeration of project source files and exported component names through the server's registered handler. Although this operation did not itself modify files, it demonstrated that the attack could access information about the developer's project through a channel the attacker should not have been able to control.
Step 9: Reaching the editor-launch handler
Finally, openInEditorRequest was tested with an attacker-controlled absolute path:
{ "file": "/etc/hostname", "line": 1, "column": 1}
This reached the server-side editor-launch handler. Reaching the handler is not, by itself, proof of arbitrary code execution. The ultimate effect depends on the implementation, editor configuration, and surrounding conditions. The researcher treats it as evidence of access to another privileged operation rather than claiming that this particular test independently established code execution.
Root cause
The preview transport in code/core/src/channels/postmessage/index.ts accepted messages with the storybook-channel key without validating the sender's origin. The manager side did the check; the preview side did not. That asymmetry is the core defect: the trust boundary that the manager enforced was absent on the path that matters for cross-origin embedding.
The highlight menu renderer passes an attacker-influenced event name and arguments into channel.emit, bridging the message to the server channel. The preview already holds a legitimate connection to the server, so the attacker does not need to establish it or obtain its token. The preview becomes a confused deputy.
In save-story.ts, the destination is built with join(process.cwd(), importPath), so .. segments can escape the project root. Path traversal via .. therefore escapes the intended directory.
Existing defences did not stop the chain. In the tested configuration the development server sent neither X-Frame-Options nor a CSP frame-ancestors policy, so the preview could be embedded by a foreign origin. Do not rely solely on browser protections or the fact that the server is bound to localhost.
Impact
The vulnerability breaks the trust boundary between an arbitrary website and a locally running Storybook development environment. The reproduction demonstrated:
- Unauthorised file creation: create new story files in the project.
- File overwrite: modify existing project files.
- Path traversal: write files outside the project root.
- Source enumeration: discover project files and exported component names.
- Editor-launch handler access: reach a server-side operation with an attacker-controlled path.
The ability to modify source files is particularly concerning because Storybook projects commonly run development tooling that processes those files. Depending on the contents of a modified file and the developer's subsequent workflow, the changes could become a route to code execution with the developer's privileges. The distinction between demonstrated impact and worst-case impact is important: the reproduction established the message-to-server attack chain and the file operations above, while the broader public advisory describes a worst-case scenario in which unauthorised file changes, combined with additional conditions and vulnerabilities, could result in arbitrary code execution with the developer's privileges. The advisory also states that the maintainers were not aware of exploitation in the wild.
The demonstrated file-write path required two genuine clicks inside the preview. The issue allowed a malicious origin to prepare the interaction, but it was not interaction-free.
Fix
According to the GitHub Security Advisory, affected releases include:
| Major line | Affected | Fixed in |
|---|---|---|
| Storybook 8.x | versions before 8.6.19 |
8.6.19 or later |
| Storybook 9.x | versions before 9.1.21 |
9.1.21 or later |
| Storybook 10.x | versions before 10.6.2 |
10.6.2 or later |
| Storybook 11.x (alpha) | versions before 11.0.0-alpha.6 |
11.0.0-alpha.6 or later |
Other affected packages include @storybook/core, @storybook/core-server, @storybook/experimental-addon-test, @storybook/addon-vitest, and @storybook/addon-mcp. Check the advisory for the exact ranges applicable to your dependencies, and upgrade to a patched release before running the development server again. If an immediate upgrade is not possible, avoid running an affected Storybook development server.
Variants to test
- Other
postMessagetransports in dev tooling. Look for preview or iframe-side listeners that accept a channel-shaped message without checkingevent.origin. A positive result is a message from a foreign origin that produces a visible state change or a server-channel emission. - Menu or action renderers that take an event name from data. Search for
emit(calls where the first argument comes from a payload rather than a constant. A positive result is a crafted payload that reaches a handler you did not intend to expose. - Path joins with user-controlled segments. Grep for
join(process.cwd(), ...)and similar patterns in dev-server handlers. A positive result is a write to a path outside the project root using..segments. - Editor-launch handlers. Test
openInEditorRequest-style handlers with absolute paths outside the project. A positive result is the handler accepting the path; whether that becomes code execution depends on the editor and configuration. - Frame embedding of dev servers. Check whether the dev server sends
X-Frame-Optionsor a CSPframe-ancestorspolicy. A positive result is a foreign page that can embed the preview iframe. - Interaction requirements. Replay the payload without the clicks. A positive result is a file write or server event with no user interaction, which would raise the severity beyond what was demonstrated here.
What happened, in plain words
Storybook is a tool that web developers use while building a website or a web app. Instead of running the whole app to look at one button, they run Storybook, which shows each piece of the interface (each "component") on its own page. It is a workshop for parts.
When a developer starts Storybook on their own computer, it opens a small web server on that machine. The browser shows two things: a manager (the outer frame with the sidebar and panels) and a preview (an inner frame that draws the actual component). The two talk to each other, and the preview also keeps a live line open to the Storybook server on the computer.
Ajith Prabhu found that the preview would listen to messages from any website, not just from its own manager. A malicious page could therefore talk to a Storybook running on the same computer. By sending a carefully built message, and with two genuine clicks inside the preview, the researcher could make the Storybook server create files, overwrite existing files, write files outside the project folder, and list the project's source files.
The flaw is tracked as CVE-2026-114125 and published as GHSA-f2ph-cmg5-wxc8. The advisory rates it Critical, with a CVSS score of 9.4. CVSS is a standard 0 to 10 scale for how bad a security flaw is; 9.4 is near the top.
The clever part: the attacker never has to connect to Storybook's protected server connection directly. The preview already has that connection, and the attack borrows it. Think of a hotel guest who is allowed into the staff corridor. If you can hand that guest a note that says "please deliver this to room service", the guest will walk past the door you could never open yourself.
The pieces you need to know first
A few ideas come up again and again, so here they are from zero.
- A web server on your computer. When you run a development tool, it starts a small server listening on a numbered port (like a door number) on your machine. Your browser connects to it at an address such as
http://[redacted]:6155. The address[redacted]is a special name that always means "this same computer". - An iframe. A web page can contain another web page inside a rectangle. That inner page is called an iframe. Storybook's preview is an iframe inside the manager page.
- Origin. The origin of a page is its scheme, host and port together, for example
http://[redacted]:8099. Two pages with different origins are treated by the browser as strangers, even if they run on the same computer. Security rules are built around origins. postMessage. Browsers let two pages send each other small text messages with a function calledpostMessage. It is like passing notes between windows. The receiving page is supposed to check who sent the note before acting on it.- WebSocket. A normal web request is one question and one answer. A WebSocket is a line that stays open in both directions, so the server can push updates at any time. Storybook uses one to keep the preview and the server in sync.
- Token. A token is a long random string that acts like a password or a wristband. Whoever holds it is treated as allowed. Storybook's server connection uses one.
- Handler. A handler is a named piece of code on the server that does one job when asked, for example "save this story file". You can think of it as a labelled button on a control panel.
- Path traversal. Files on a computer are named by paths such as
src/Button.tsx. The two dots..mean "go up one folder". If a program glues a user-supplied path onto a folder without checking,..can walk the program out of that folder. That trick is called path traversal. - Cross-origin message. A message sent from a page of one origin to a page of another origin. It is exactly the situation where the receiver must be suspicious.
The setup: a small project and a second website
The researcher reproduced the issue against Storybook 10.6.0, using a minimal React/Vite Storybook project. React is a popular way to build interfaces; Vite is a tool that serves the project during development. The test project had one component and one story file:
src/├── Button.tsx└── Button.stories.tsx
This is a folder listing. src is the source folder. Inside it, Button.tsx is the component (the button itself) and Button.stories.tsx is the story file, which tells Storybook how to display that button. A story file is a recipe card for the workshop.
The development server was started with:
./node_modules/.bin/storybook dev -p 6155 --no-open --ci
Line by line:
./node_modules/.bin/storybookruns the Storybook program installed inside the project'snode_modulesfolder, which is where downloaded libraries live.devstarts the development server.-p 6155picks port 6155, the door number the server listens on.--no-openstops it from opening a browser window automatically.--ciruns it in a non-interactive mode suited to automated environments.
A separate page was then served from another origin, http://[redacted]:8099, and the Storybook preview was embedded in it:
<iframe src="http://[redacted]:6155/iframe.html?id=example-button--primary&viewMode=story"></iframe>
This is one HTML tag. <iframe> creates the inner rectangle. src is the address of the page to load inside it: the Storybook preview at port 6155, showing the story called example-button--primary in story view. The outer page lives at port 8099, so the two pages have different origins. That is the whole point of the test: a stranger page is loading the preview.
In the tested configuration, the development server did not send X-Frame-Options or a CSP frame-ancestors policy that prevented this embedding. Those are two standard browser instructions a server can send to say "no other site may put me in an iframe". Without them, the browser allows the embedding.
Finding it: a note with no return address check
Storybook uses postMessage to communicate between its manager and preview, and the preview keeps a connection to the Storybook development server through a server-channel WebSocket. While examining the preview's message transport, the researcher found that it accepted incoming messages containing:
{ key: "storybook-channel", event: { }}
This is a small message in a format called JSON, which is just labelled data. key is the label that says which kind of message this is; storybook-channel tells the preview "this is a Storybook channel message". event is the body, here empty. The preview accepted messages shaped like this.
The preview transport in code/core/src/channels/postmessage/index.ts did not validate the origin of the incoming message before accepting it. In plain words: it never asked who sent the note. The manager-side implementation performed sender-origin validation, but the corresponding preview path did not enforce the same trust boundary. So the manager checked the sender and the preview did not. That was the first problem: a message from an unrelated website could be accepted as a legitimate Storybook channel message.
Why does this matter so much? Because the preview is not a passive display. It is connected to the server. Once a stranger can talk to the preview, the question becomes what the preview can be made to do. The consequences became more significant when tracing how those messages were processed.
Exploitation, step by step
Step 1: The preview has a privileged server-channel connection
Storybook's createBrowserChannel, implemented in code/core/src/channels/index.ts, establishes a WebSocket connection to the development server:
ws://<host>:<port>/storybook-server-channel?token=...
Reading it: ws:// means a WebSocket (the always-open line). <host> and <port> are placeholders for the computer and door number. /storybook-server-channel is the name of the endpoint, the specific address on the server that handles this line. ?token=... is the wristband: a token that proves the caller is allowed.
This connection is used for communication between the preview and the local development environment. The important distinction is that the browser's preview already has a legitimate connection to the server. The attacker does not need to independently establish that connection or obtain its token. If attacker-controlled input can cause the preview to emit arbitrary server-channel events, the preview effectively becomes a confused deputy: it uses its own authority to carry out actions initiated by another origin.
A confused deputy is a well-known idea in security: someone with real authority is tricked into using it on a stranger's behalf. A receptionist allowed to open staff doors, who opens one because a stranger asked politely, is a confused deputy. The preview holds the wristband; the attacker only has to make it walk.
Step 2: The highlight functionality provides the bridge
The next piece was in:
code/core/src/highlight/useHighlights.ts
This is a file path inside Storybook's source code. The highlight functionality allows elements in the preview to be highlighted and associated with interactive menu items. In the Storybook interface, you can point at a component and get a little menu of actions for it. The menu renderer effectively performs the following operation:
channel.emit(event, id, getEventDetails(target));
Line by line: channel.emit means "send a message on the channel". The first thing passed is event, the name of the event, which decides what the server will do. id identifies the item. getEventDetails(target) collects details about the element the menu belongs to. Both the event name and the first argument can be influenced by the highlight payload.
That is the bridge. The preview was not merely accepting an untrusted message. It was allowing data from that message to influence which event would be emitted over its privileged server channel. By crafting the highlight payload, the researcher could reach server-side handlers that were never intended to be exposed through an arbitrary cross-origin message. In everyday terms: the stranger's note did not just get read, it got copied onto the preview's own letterhead and posted to the server.
Step 3: The server processes the emitted events
The server registers handlers for various operations, including:
saveStoryRequestfileComponentSearchRequestcreateNewStoryfileRequestghostStoriesopenInEditorRequest
These are the labelled buttons on the server's control panel. saveStoryRequest saves a story file. createNewStoryfileRequest creates a new one. fileComponentSearchRequest searches project files. openInEditorRequest asks the developer's code editor to open a file. ghostStories is another registered operation; the report does not describe what it does. These handlers perform actions against the developer's project or interact with local development tools.
The resulting attack chain was:
Attacker-controlled website | | postMessage vStorybook preview | | Unvalidated channel message vHighlight functionality | | Crafted event name and arguments vPrivileged server-channel WebSocket | vStorybook development server | + + + + +
This is a diagram of the journey, read top to bottom. The attacker's website sends a postMessage down to the Storybook preview. The preview passes an unvalidated channel message down to the highlight functionality. The highlight code sends a crafted event name and arguments down the privileged server-channel WebSocket. The Storybook development server receives it and acts.
The issue was therefore not simply missing origin validation in isolation. The impact came from combining that validation failure with a message-processing path that allowed attacker-controlled data to reach privileged server-side operations. One weak lock is a nuisance; a weak lock in front of a corridor of unlocked doors is a break-in.
Step 4: Sending the crafted highlight payload
From the foreign-origin page, the researcher sent a crafted message to the iframe. The following is a shortened representation of the highlight payload used in the test:
{ "key": "storybook-channel", "event": { "type": "storybook/highlight/add", "args": [ { "id": "<hl>", "selectors": ["button"], "styles": { "outline": "2px dashed #f0f" }, "menu": [ { "id": { "id": "pwn-1", "payload": { "componentFilePath": "src/PWNED.tsx", "componentExportName": "PWNED", "componentIsDefaultExport": true, "componentExportCount": 1 } },
"title": "Open component docs", "clickEvent": "createNewStoryfileRequest" } ] } ] }}
This is one JSON message. Read it from the outside in:
"key": "storybook-channel"is the label that makes the preview treat it as a Storybook channel message."event"holds the body."type": "storybook/highlight/add"says "add a highlight"."args"is the list of arguments for that action. The first argument describes the highlight."id": "<hl>"is a name for the highlight."selectors": ["button"]says which element to highlight: the button."styles"sets how it looks: a two-pixel dashed outline in the colour#f0f(magenta)."menu"is the list of menu items attached to the highlight. There is one item."id"inside the menu item carries an"id"ofpwn-1and a"payload"object. The payload names a component filesrc/PWNED.tsx, an export namePWNED, says it is the default export, and gives an export count of 1. These are the arguments that will be handed to the server handler."title": "Open component docs"is the text the developer will see in the menu. It looks harmless."clickEvent": "createNewStoryfileRequest"is the important line. It is the event name that will be sent to the server when the item is clicked. The attacker chose it.
The message creates a highlight with a menu item whose event name is attacker-controlled. The menu says "Open component docs" but the server is asked to create a story file.
Step 5: Two genuine clicks
To activate the demonstrated path, the researcher performed two genuine clicks inside the preview: one to open the menu associated with the highlighted element, and another to activate the menu item. The preview then emitted a WebSocket message to the Storybook development server, and the server created:
src/PWNED.stories.tsx
That is a new story file inside the project's source folder, named after the payload. This confirmed that the cross-origin message could influence an operation performed by the local development server.
An important detail of this proof of concept is that the demonstrated attack required two genuine user clicks inside the preview. Sending the same highlight payload without performing those clicks did not emit the relevant WebSocket event or create the file. This distinction matters when assessing exploitability: the issue allowed a malicious origin to prepare the interaction, but the demonstrated file-write path was not interaction-free. In other words, the stranger could set the trap, but a person still had to step on it. That makes the attack less automatic than it might first sound, and it is the kind of detail that decides how serious a finding really is.
Step 6: Creating and overwriting project files
Once it was established that the server was processing attacker-controlled event names and arguments, other reachable handlers were tested. Using createNewStoryfileRequest, a new story file could be created. Using saveStoryRequest, an existing story file could be overwritten, including:
src/Button.stories.tsx
That is the project's original story file, the recipe card the developer wrote. This was more serious than simply creating an unexpected file. An existing project file could be modified without the developer intentionally initiating the corresponding operation. Creating a stray file is litter; silently rewriting a file the developer trusts is tampering.
Step 7: Writing outside the project root
The most notable result came from tracing the server-side implementation of save-story.ts. The code used the attacker-controlled importPath when constructing the destination path:
join(process.cwd(), importPath)
Line by line: process.cwd() is the folder the server is currently working in, normally the project folder. importPath is a path supplied by the caller, which here means the attacker. join(...) glues the two together into one path. The problem is that gluing does not check where the result ends up.
In the test, the researcher supplied:
../../../../tmp/csf-target.stories.tsx
Each .. means "go up one folder". Four of them climb four levels above the project folder, and then the path goes into tmp and names a file csf-target.stories.tsx. This resulted in a file being written to:
/tmp/csf-target.stories.tsx
The destination was outside the Storybook project root. The underlying issue is that joining a path to the current working directory does not, by itself, guarantee that the resolved destination remains inside that directory. Traversal components such as .. can escape the intended location unless the application performs appropriate validation. This expanded the impact from unauthorised modifications within the project to writes elsewhere on the filesystem, subject to the development server process's filesystem permissions. The last part matters: the server can only write where its own user account is allowed to write, so the reach is real but bounded by the permissions the developer gave the tool.
Step 8: Enumerating source files
The researcher also reached fileComponentSearchRequest. This allowed enumeration of project source files and exported component names through the server's registered handler. Enumeration means making a list: the attacker learns which files exist and which components they export. Although this operation did not itself modify files, it demonstrated that the attack could access information about the developer's project through a channel the attacker should not have been able to control. Knowing the layout of a project is the reconnaissance step that makes later, more damaging actions easier.
Step 9: Reaching the editor-launch handler
Finally, openInEditorRequest was tested with an attacker-controlled absolute path:
{ "file": "/etc/hostname", "line": 1, "column": 1}
This JSON asks the server to open a file in the developer's editor. "file": "/etc/hostname" is an absolute path, starting from the root of the filesystem, pointing at a system file that holds the computer's name. "line": 1 and "column": 1" say where to put the cursor. The path is entirely the attacker's choice.
This reached the server-side editor-launch handler. Reaching the handler is not, by itself, proof of arbitrary code execution. The ultimate effect depends on the implementation, editor configuration, and surrounding conditions. The researcher treats it as evidence of access to another privileged operation rather than claiming that this particular test independently established code execution. That is a careful distinction: getting a door to open is not the same as proving what is behind it.
Root cause
Three separate defects combined.
First, the preview transport in code/core/src/channels/postmessage/index.ts accepted messages with the storybook-channel key without validating the sender's origin. The manager side did the check; the preview side did not. That asymmetry is the core defect: the trust boundary that the manager enforced was absent on the path that matters for cross-origin embedding.
Second, the highlight menu renderer passes an attacker-influenced event name and arguments straight into channel.emit. The preview's server-channel WebSocket is authenticated by a token that the preview already holds, so the server has no reason to question the event's provenance. The preview becomes a confused deputy.
Third, save-story.ts builds the destination with join(process.cwd(), importPath) and does not verify that the resolved path stays inside the project root. Path traversal via .. therefore escapes the intended directory.
Existing defences did not stop the chain. In the tested configuration the development server sent neither X-Frame-Options nor a CSP frame-ancestors policy, so the preview could be embedded by a foreign origin. Do not rely solely on browser protections or the fact that the server is bound to localhost. That last point is worth pausing on: "it only listens on my own machine" feels safe, but the browser on that machine will happily fetch from it, and a web page can make the browser do so.
Impact
The vulnerability breaks the trust boundary between an arbitrary website and a locally running Storybook development environment. The reproduction demonstrated:
- Unauthorised file creation: create new story files in the project.
- File overwrite: modify existing project files.
- Path traversal: write files outside the project root.
- Source enumeration: discover project files and exported component names.
- Editor-launch handler access: reach a server-side operation with an attacker-controlled path.
The ability to modify source files is particularly concerning because Storybook projects commonly run development tooling that processes those files. Depending on the contents of a modified file and the developer's subsequent workflow, the changes could become a route to code execution with the developer's privileges. Code execution means running the attacker's instructions as if the developer had typed them, with all the developer's access to files and accounts.
The distinction between demonstrated impact and worst-case impact is important. The reproduction established the message-to-server attack chain and the file operations above, while the broader public advisory describes a worst-case scenario in which unauthorised file changes, combined with additional conditions and vulnerabilities, could result in arbitrary code execution with the developer's privileges. The advisory also states that the maintainers were not aware of exploitation in the wild. "In the wild" means real attackers using it against real targets, as opposed to a researcher in a test setup.
The demonstrated file-write path required two genuine clicks inside the preview. The issue allowed a malicious origin to prepare the interaction, but it was not interaction-free.
Fix
According to the GitHub Security Advisory, affected releases include:
| Major line | Affected | Fixed in |
|---|---|---|
| Storybook 8.x | versions before 8.6.19 |
8.6.19 or later |
| Storybook 9.x | versions before 9.1.21 |
9.1.21 or later |
| Storybook 10.x | versions before 10.6.2 |
10.6.2 or later |
| Storybook 11.x (alpha) | versions before 11.0.0-alpha.6 |
11.0.0-alpha.6 or later |
A version line like 8.x means any 8.something release. "Alpha" means an early test release. The table says: if you are on one of these lines and your version is older than the number in the middle column, upgrade to the number in the right column or newer.
Other affected packages include @storybook/core, @storybook/core-server, @storybook/experimental-addon-test, @storybook/addon-vitest, and @storybook/addon-mcp. Check the advisory for the exact ranges applicable to your dependencies, and upgrade to a patched release before running the development server again. If an immediate upgrade is not possible, avoid running an affected Storybook development server.
Variants to test
Each one is a question you can ask about a program, not a promise that it is broken.
- Other
postMessagetransports in dev tooling. Look for preview or iframe-side listeners that accept a channel-shaped message without checkingevent.origin. A positive result is a message from a foreign origin that produces a visible state change or a server-channel emission. In plain words: does the receiver ask who sent the note? - Menu or action renderers that take an event name from data. Search for
emit(calls where the first argument comes from a payload rather than a constant. A positive result is a crafted payload that reaches a handler you did not intend to expose. In plain words: can the label on a button be rewritten by a stranger? - Path joins with user-controlled segments. Grep for
join(process.cwd(), ...)and similar patterns in dev-server handlers. A positive result is a write to a path outside the project root using..segments. In plain words: does the program check where a glued path actually lands? - Editor-launch handlers. Test
openInEditorRequest-style handlers with absolute paths outside the project. A positive result is the handler accepting the path; whether that becomes code execution depends on the editor and configuration. - Frame embedding of dev servers. Check whether the dev server sends
X-Frame-Optionsor a CSPframe-ancestorspolicy. A positive result is a foreign page that can embed the preview iframe. In plain words: can a stranger put your page in a picture frame on their site? - Interaction requirements. Replay the payload without the clicks. A positive result is a file write or server event with no user interaction, which would raise the severity beyond what was demonstrated here. In plain words: does the trap need a person to step on it, or does it spring by itself?
Glossary
- API: a defined set of requests a program accepts, like a menu of things you can ask it to do.
- CSP
frame-ancestors: a browser instruction sent by a server that lists which sites may embed its pages in an iframe. - Component: a reusable piece of a user interface, such as a button.
- Confused deputy: someone with real authority who is tricked into using it for a stranger.
- Cross-origin: coming from a different scheme, host or port than the page being talked to.
- CVSS: a standard 0 to 10 score for the severity of a security flaw; higher is worse.
- CVE: a public identifier for a specific security vulnerability.
- Development server: a small web server a developer runs on their own computer while building software.
- Endpoint: a specific address on a server that handles a particular kind of request.
- Enumeration: making a list of things that exist, such as files or component names.
- Event: a named message that tells a program something happened or asks it to do something.
- Exploitability: how practical it is for an attacker to actually use a flaw.
- Handler: a piece of server code that performs one named job when asked.
- Highlight: a Storybook feature that outlines an element in the preview and attaches a menu of actions to it.
- HTML: the language web pages are written in.
- Iframe: a web page embedded inside a rectangle within another web page.
- JSON: a text format for labelled data, made of names and values.
- localhost / [redacted]: names that mean "this same computer".
- Manager: the outer Storybook interface with the sidebar and panels.
- Origin: the combination of scheme, host and port that identifies where a page came from.
- Path traversal: using
..in a supplied path to escape the folder a program intended to stay in. - Payload: the data carried inside a message, as opposed to its label.
- Port: a numbered door on a computer that a server listens on.
postMessage: a browser function that lets pages send each other text messages.- Preview: the inner Storybook frame that draws the actual component.
- Proof of concept: a working demonstration that a flaw can be used.
- React: a popular library for building user interfaces.
- Server channel: Storybook's always-open connection between the preview and the development server.
- Story file: a file that tells Storybook how to display a component.
- Token: a long random string that acts like a password or wristband proving you are allowed.
- Vite: a tool that serves a web project during development.
- WebSocket: a connection that stays open in both directions so either side can send at any time.
X-Frame-Options: a browser instruction sent by a server that says whether its pages may be embedded in an iframe.