Skip to content
Disclosed report Advanced CVE-2026-12302

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.

lebr0nli Follow

Originally disclosed on Mozilla

  • 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

  1. Run python3 -m http.server 1337 to serve the attached index.html.
  2. Navigate to http://127.0.0.1:1337/.
  3. The shared worker, created with a blob: URL, will attempt to establish connections via fetch, EventSource, and WebSocket to http://127.0.0.1:1337/connect-src-bypass and execute importScripts('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.

The original report as published on Mozilla's Bugzilla, by lebr0nli. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

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

  1. Serve the provided index.html file using a local HTTP server.
  2. Navigate to the local server address in Firefox.
  3. 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.

More by lebr0nli

View all

3 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

Same bug class and techniques, clearest first.