Creating a `SharedWorker` using a constructor that was saved prior to a same-origin navigation might bypass CSP
CSP is not enforced when a SharedWorker is created using a constructor saved before a same-origin navigation and invoked after the navigation. An attacker can create a SharedWorker without a worker-src allowance and execute code that would otherwise be blocked by connect-src and script-src.
- Fixed in 27 days
- Paid in 34 days
- Disclosed after 27 days
Created attachment 9572968 index.html
VULNERABILITY DETAILS
CSP is not properly enforced when creating a SharedWorker using a constructor that was saved prior to a same-origin navigation and invoked after the navigation completes. This allows an attacker to create a SharedWorker without a worker-src directive allowance and execute code in the context of the SharedWorker that would otherwise be blocked by the connect-src and script-src CSP directives.
VERSION
Firefox Version: 150.0
The vulnerability is also present in Firefox 152.0a1 (2026-04-23) nightly
REPRODUCTION CASE
- Run
python3 -m http.server 1337to serve the attachedindex.html. - Navigate to
http://127.0.0.1:1337/. - The shared worker, created with a
blob:URL, will attempt to establish connections viafetch,EventSource, andWebSockettohttp://127.0.0.1:1337/connect-src-bypassand executeimportScripts('http://127.0.0.1:1337/script-src-bypass?eval='+eval('21*2===42')).
Expected Behavior: worker-src, connect-src, and script-src should block the above operations. Or, new SharedWorker should probably throw an error just as Worker and navigator.serviceWorker.register do.
Actual Behavior: CSP is bypassed.
CREDIT INFORMATION
Reporter credit: lebr0nli of National Yang Ming Chiao Tung University, Dept. of CS, Security and Systems Lab.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Impact
An attacker could bypass worker-src, connect-src, and script-src CSP directives to run code and make network connections that should have been blocked.
What the attacker needed
Victim uses Firefox; attacker can run script on the page; same-origin navigation occurs
How it was found
- Serve the provided index.html file using a local HTTP server.
- Navigate to the local server address in Firefox.
- The page creates a SharedWorker from a blob URL that attempts fetch, EventSource, and WebSocket connections and runs importScripts with eval.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Content Security Policy (CSP) is a set of rules a website sends to the browser to say which scripts and connections are allowed. Normally, if a page tries to start a background script called a SharedWorker without permission, the browser should block it. Here, the browser forgets to apply those rules if the page first saves the way to start a worker, navigates to another page on the same site, and then uses the saved method.