Skip to content
Disclosed report Intermediate CVE-2023-23602

connect-src CSP header does not apply to WebWorker initiated WebSocket connections

A Content Security Policy (CSP) with connect-src 'none' failed to block a WebSocket connection initiated from a Web Worker in Firefox, whereas Chrome correctly blocked it. An attacker could potentially bypass CSP restrictions to exfiltrate data or communicate with unauthorised servers.

Dave Vandyke Follow

Originally disclosed on Mozilla

  • Fixed in 14 days
  • Paid in 2 months
  • Disclosed after 14 days
Text
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:107.0) Gecko/20100101 Firefox/107.0

Steps to reproduce:

1. Navigate to https://testpages.kzar.co.uk/csp/?csp=connect-src+%27none%27


Actual results:

"WebSocket (third-party via WebWorker via inline script)" is listed as Loaded.


Expected results:

"WebSocket (third-party via WebWorker via inline script)" is listed as Failed. (Which happens with Chrome 107.0.5304.87)

The original report as published on Mozilla's Bugzilla, by Dave Vandyke. 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

What the attacker needed

Victim visits a malicious page; page uses a Web Worker; CSP with connect-src 'none'

The fix

The browser should be fixed to enforce the connect-src directive for WebSocket connections initiated from Web Workers, matching the behaviour of other browsers.

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.

A Content Security Policy (CSP) is a rule set that tells the browser which external resources a page may load. Here, the rule said no connections should be allowed, but Firefox still allowed a WebSocket (a two-way live connection) started from a background script called a Web Worker. This means a malicious page might sneak data out even when the site owner tried to block it.