Skip to content
Info disclosure Disclosed report Advanced CVE-2026-74963

ServiceWorker CookieStore subscriptions leak sibling-subdomain host-only cookie changes

Firefox's ServiceWorker CookieStore subscription dispatch did not check whether the changed cookie's host was visible to the registration origin, so a ServiceWorker on one subdomain received cookiechange events for host-only cookies set by a sibling subdomain. An attacker controlling a same-site subdomain could learn the name and value of non-HttpOnly host-only cookies belonging to sibling subdomains.

hajim Follow

Originally disclosed on Mozilla

  • Fixed in 33 days
  • Paid in 55 days
  • Disclosed after 33 days

Created attachment 9601362 poc.zip

Summary

Firefox dispatches cookiechange events to ServiceWorker CookieStore subscriptions after checking base domain, origin attributes, optional subscription name, and path. The ServiceWorker dispatch path does not check whether the changed cookie's host/domain is visible to the ServiceWorker registration origin.

As a result, a ServiceWorker on one same-site subdomain can receive cookiechange events containing the name and value of a non-HttpOnly host-only cookie set by a sibling subdomain, even though cookieStore.get(name) from the attacker origin returns null.

This is reachable from ordinary web content through ServiceWorkerRegistration.cookies.subscribe().

A malicious IPC variant reaches the same ServiceWorker cookiechange delivery sink by storing a subscription where PrincipalInfo and ServiceWorker scope belong to different same-site origins. That variant is included here because the receiver, leaked event type, and missing parent-side visibility invariant are the same family.

Root Cause

CookieStoreSubscriptionService::Observe() filters cookie events by:

  • notification action;
  • HttpOnly flag;
  • base domain;
  • origin attributes;
  • optional subscription name;
  • path.

It then dispatches the cookie to the ServiceWorker:

C++
swm->SendCookieChangeEvent(principalInfo.attrs(),
                           data.mRegistration.scope(),
                           cookie->AsCookie().ToIPC(), deleteEvent);

The sibling window event path performs an additional host/domain visibility check:

C++
CookieCommons::DomainMatches(cookie, mHost)

The ServiceWorker subscription path lacks the equivalent check.

The malicious IPC variant adds a second way to violate the same event-visibility invariant:

Text
CookieStoreParent::RecvSubscribeOrUnsubscribeRequest(principalInfo, scopeURL)
  -> validates remote-type compatibility
  -> stores principalInfo and scopeURL together

CookieStoreSubscriptionService::Observe()
  -> filters cookie visibility using stored principalInfo
  -> dispatches SendCookieChangeEvent(...) using stored ServiceWorker scope

The parent does not verify that the subscription principal and ServiceWorker scope are the same origin before using one for cookie filtering and the other for event delivery.

Broken invariant:

Text
CookieStore event visibility must not exceed CookieStore read visibility for
the same origin.

For parent-side IPC subscriptions, the equivalent invariant is:

Text
The ServiceWorker registration receiving CookieStore events must belong to the
same origin/principal whose cookies are being observed.

Current source shows the host/domain check in CookieStoreNotifier and not in the ServiceWorker subscription dispatch path.

Impact

This is a same-site cross-origin information disclosure issue.

An attacker controlling https://www.web-platform.test can register a ServiceWorker and subscribe to cookie changes. When https://www1.web-platform.test sets a non-HttpOnly host-only cookie, the attacker ServiceWorker receives a cookiechange event containing the sibling cookie's name and value.

The confirmed cookie shape was:

Text
randomName=sibling-path-root-secret-value; Path=/; Secure; SameSite=None

HttpOnly cookies are filtered out before dispatch. The issue still exposes non-HttpOnly host-only cookies that should be isolated by host/origin visibility.

The malicious IPC variant confirms that the same event sink can also leak a same-site host-only cookie value when a compromised content process for one origin subscribes an attacker ServiceWorker scope using another same-site origin's principal. Cross-site abuse was blocked by existing remote-type checks, so the proven scope is same-site cross-origin disclosure.

Security Impact

Host-only cookies are expected to be isolated from sibling subdomains. The ordinary web proof shows a ServiceWorker receiving a sibling host-only cookie name and value through the browser's CookieStore event delivery path even though direct cookieStore.get() from the attacker origin cannot read it.

This is a browser-mediated same-site cross-origin non-HttpOnly cookie disclosure.

Reproduction

WPT validation:

Text
application_buildid: <build-id>
application_version: 154.0a1
TEST_START: /cookiestore/local_serviceworker_cookiechange_sibling_subdomain_path_root_any_name.sub.https.html
TEST_END: Test OK. Subtests passed 1/1. Unexpected 0

PoC flow:

  1. Attacker page loads on https://www.web-platform.test.
  2. It registers a ServiceWorker and subscribes with { url }.
  3. A victim iframe on https://www1.web-platform.test sets a random host-only cookie.
  4. The attacker origin verifies cookieStore.get(randomName) returns null.
  5. The attacker ServiceWorker still receives cookiechange with the cookie name and value.

PoC files:

Text
local_serviceworker_cookiechange_sibling_subdomain_path_root_any_name.sub.https.html
poc-main.sub.https.html
poc-sw.js
poc-attacker-frame.sub.html
poc-victim-path-root-frame.sub.html

Malicious IPC variant validation:

Text
FX_AUDIT_COOKIESTORE_FORGED_SUBSCRIBE_PRINCIPAL target=https://www1.web-platform.test:8443 scope=https://web-platform.test:8443/cookiestore/resources/fx-audit-cookie-scope/
TEST_END: Test OK. Subtests passed 1/1. Unexpected 0

The variant test asserted that the attacker ServiceWorker received the victim cookie name and value while cookieStore.get(cookieName) in the attacker origin returned null.

Cross-site negative validation was blocked by the existing remote-type gate:

Text
PCookieStore::Msg_SubscribeOrUnsubscribeRequest Processing error: message was deserialized, but the handler returned false

Suggested Fix

Before dispatching ServiceWorker cookiechange events, apply the same host/domain visibility invariant used by CookieStoreNotifier.

For each ServiceWorker registration, derive the registration host from the registration scope or principal URI, then reject cookies that do not match that host:

C++
if (!CookieCommons::DomainMatches(Cookie::Cast(cookie), registrationHost)) {
  continue;
}

Domain cookies intentionally visible to the ServiceWorker origin should continue to dispatch. Host-only cookies for sibling subdomains should not.

For IPC subscriptions, also derive the ServiceWorker registration principal from the stored scope and reject requests where the supplied PrincipalInfo and registration scope origin do not match exactly.

Scope

Confirmed behavior:

  • ordinary web content can trigger the event leak;
  • sibling host-only non-HttpOnly cookie name and value are delivered to the attacker ServiceWorker;
  • the same attacker origin cannot read the cookie via cookieStore.get();
  • malicious IPC can reach the same event-delivery sink with a mismatched subscription principal and ServiceWorker scope inside the same-site remote-type boundary.

Proof of Concept

The proof-of-concept files are provided under poc/.

Observed output:

Text
FAIL ServiceWorker CookieStore any-name subscriptions are filtered between sibling subdomains for Path=/ cookies - assert_equals: attacker subdomain ServiceWorker must not receive victim subdomain Path=/ any-name cookiechange expected "timeout" but got "cookie
  FAIL ServiceWorker CookieStore any-name subscriptions are filtered between sibling subdomains for Path=/ cookies - assert_equals: attacker subdomain ServiceWorker must not receive victim subdomain Path=/ any-name cookiechange expected "timeout" but got "cook

Observed output:

Text
FAIL Local confirmation: sibling subdomain ServiceWorker CookieStore any-name subscription leaks victim Path=/ host-only cookie changes - assert_equals: expected (string) "/" but got (undefined) undefined
  FAIL Local confirmation: sibling subdomain ServiceWorker CookieStore any-name subscription leaks victim Path=/ host-only cookie changes - assert_equals: expected (string) "/" but got (undefined) undefined

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

The ServiceWorker cookiechange dispatch path filtered events by base domain, origin attributes, name and path but omitted the host/domain visibility check that the window event path performs.

Impact

A same-site cross-origin attacker could learn the name and value of non-HttpOnly host-only cookies set by sibling subdomains; HttpOnly cookies were filtered out and cross-site abuse was blocked by existing remote-type checks.

What the attacker needed

Attacker controls a same-site subdomain; victim visits attacker page; victim subdomain sets a non-HttpOnly host-only cookie

The fix

The ServiceWorker dispatch path should apply the same host/domain visibility check used by CookieStoreNotifier, and IPC subscriptions should verify that the principal and registration scope share the same origin.

How it was found

  1. Load an attacker page on one subdomain.
  2. Register a ServiceWorker and subscribe to cookie changes.
  3. Have a victim iframe on a sibling subdomain set a random host-only cookie.
  4. Confirm the attacker origin cannot read the cookie via cookieStore.get.
  5. Observe the attacker ServiceWorker receiving a cookiechange event with the cookie name and value.

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 cookie is a small piece of data a website stores in your browser. A 'host-only' cookie is meant to be readable only by the exact host that set it, not by other subdomains. Here, a background script (a ServiceWorker) on one subdomain was told about cookie changes on a sibling subdomain, even though it could not read those cookies directly.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More by hajim

View all

7 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.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.