Skip to content
CORS Disclosed report Advanced CVE-2026-8948

SOP bypass: SW FollowSyntheticRedirect leaks tainting flag, bypasses CORS

A Service Worker could respond to a fetch with a redirect to a cross-origin URL, and the browser followed it while carrying over an internal flag that tells the CORS check the response was synthesised by the Service Worker. As a result, the calling page could read the full body of a cross-origin response that had no CORS headers.

satyamasd Follow

Originally disclosed on Mozilla

  • Fixed in 43 hours
  • Paid in 30 days
  • Disclosed after 43 hours
Text
Created attachment 9585326
standalone-server.js

When a Service Worker responds to a fetch with a 3xx redirect pointing at a cross-origin URL, the browser follows the redirect and lets the calling page read the full response body. CORS is completely bypassed.

I traced the problem to FollowSyntheticRedirect() in InterceptedHttpChannel.cpp.


  Walkthrough
  -----------
  When a SW calls respondWith() with a redirect response (e.g. a 302), the interception code sets mServiceWorkerTaintingSynthesized=true on the channel's LoadInfo. This happens in FetchEventOpChild.cpp at line 458 via LoadInfo::SynthesizeServiceWorkerTainting().

 Next, StartSynthesizedResponse() (InterceptedHttpChannel.cpp:870) calls ShouldRedirect() at line 911, which returns true because the synthesized response has a 3xx status and a Location header. This calls FollowSyntheticRedirect() at line 195.

At lines 229-230 it clones the LoadInfo:

    nsCOMPtr<nsILoadInfo> redirectLoadInfo =
        CloneLoadInfoForRedirect(redirectURI, redirectFlags);

  CloneLoadInfoForRedirect (HttpBaseChannel.cpp:4525) calls LoadInfo::Clone() (LoadInfo.cpp:895), which invokes the copy constructor (LoadInfo.cpp:703).
  The copy constructor uses the LOADINFO_FOR_EACH_FIELD macro at lines 727-728:

    #define DEFINE_INIT(_t, name, _n, _d) m##name(rhs.m##name),
          LOADINFO_FOR_EACH_FIELD(DEFINE_INIT, LOADINFO_DUMMY_SETTER)

  ServiceWorkerTaintingSynthesized is listed in that macro (LoadInfo.h:142), so the expansion copies the flag as true to the new LoadInfo.
  FollowSyntheticRedirect never resets it. A new nsHttpChannel is created for the cross-origin target with this leaked flag.

  When the cross-origin response arrives, nsCORSListenerProxy::CheckRequestApproved() runs. At nsCORSListenerProxy.cpp:747:

    if (loadInfo->GetServiceWorkerTaintingSynthesized()) {
      return NS_OK;
    }

  It sees the leaked flag, assumes the response is SW-synthesized (it isn't — it came from a real cross-origin HTTP server), and returns NS_OK. All CORS validation is skipped. The calling page reads the body.

  The flag also blocks MaybeIncreaseTainting() (LoadInfo.cpp:1675-1678), so the response stays at Basic tainting even though it crossed origins. This has downstream effects on canvas tainting and Fetch response types.

  Compare with RedirectForResponseURL() at line 258 in the same file, which has a comment at lines 292-297 explaining the intended design:

    "Normally we don't propagate the LoadInfo's service worker tainting
     synthesis flag on redirect. A real redirect normally will want to allow
     normal tainting to proceed from its starting taint."

  RedirectForResponseURL then explicitly re-sets the flag because that particular redirect "still represents the synthetic response." FollowSyntheticRedirect performs a real redirect to an external origin but has no equivalent handling.


  Regression of Bug 1467852
  -------------------------
  This is a regression of Bug 1467852 (CVE-2018-12358), which had the same root cause: the flag surviving through the copy constructor on redirect. That fix removed the automatic copy and initialized to false. A later refactoring introduced the LOADINFO_FOR_EACH_FIELD macro (LoadInfo.h:58) which auto-generates copy constructor initializers for all listed fields; ServiceWorkerTaintingSynthesized was included, reintroducing the auto-copy.


  Steps to Reproduce
  ------------------
  Tested on Firefox 150.0.2 (Build ID 20260506140522).

  Live PoC at https://satytestattack.xyz:8443/ — two HTTPS ports on the same
  domain (8443 = attacker, 9443 = victim). Same host, different port = different
  origin under SOP.

  1. Open Firefox, navigate to https://satytestattack.xyz:8443/
  2. Click "Register Service Worker" and wait for "activated"
  3. Click "Run Exploit"

  The SW intercepts a same-origin fetch and responds with:
    new Response(null, {status:302, headers:{Location:'https://satytestattack.xyz:9443/api/secret'}})

  The victim server on port 9443 serves JSON with no Access-Control-Allow-Origin header.

  Expected: fetch() throws a NetworkError (CORS blocks the cross-origin read).
  Actual: attacker page reads the entire JSON response body.

  All redirect status codes work: 301, 302, 307, 308.

  For local reproduction, the three attached JS/HTML files work with self-signed certs. Generate certs with:
    openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem \
      -days 365 -nodes -subj '/CN=localhost'
  Then: node standalone-server.js
  Visit https://localhost:9443/ first to accept the cert, then
  https://localhost:8443/.



  Impact
  ------
  - Full SOP/CORS bypass: any cross-origin resource readable by attacker JS
  - No user interaction beyond visiting the attacker page
  - SW persists after registration, survives page reloads
  - All redirect codes: 301, 302, 307, 308

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

Root cause

Likely the LoadInfo copy constructor auto-copies the ServiceWorkerTaintingSynthesized flag via the LOADINFO_FOR_EACH_FIELD macro, and FollowSyntheticRedirect does not reset it, so the CORS proxy wrongly treats a real cross-origin response as Service-Worker-synthesised.

Impact

Any cross-origin resource could be read by attacker JavaScript with no interaction beyond visiting the attacker page, and the Service Worker persists across reloads; all redirect status codes work.

What the attacker needed

Victim visits attacker page; Service Worker registration allowed; attacker controls a page on some origin

How it was found

  1. Open Firefox and navigate to the attacker page on port 8443.
  2. Register the Service Worker and wait until it is activated.
  3. Run the exploit, which makes the Service Worker answer a same-origin fetch with a redirect to the victim origin on port 9443.
  4. Observe that the attacker page reads the full JSON body from the victim origin despite the absence of CORS headers.

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 Service Worker is a script a website installs in your browser that can intercept network requests. Normally the browser blocks a page from reading data from another site unless that site explicitly allows it (this rule is called CORS). Here, the browser got confused about where a redirected response came from and skipped that check, so a malicious page could read private data from another site.

What is CORS?

A permissive cross-origin policy lets another site read responses with the user's credentials.

More by satyamasd

View all

2 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

CORS misconfiguration

The lesson behind this report.

A permissive cross-origin policy lets another site read responses with the user's credentials.