Inappropriate implementation in Background Fetch API (CVE-2025-5064)
The Background Fetch API ignored the request's credentials mode, so a fetch marked to omit or restrict credentials still sent cookies. An attacker-controlled page could therefore read cookie-bearing responses from a cross-origin site that allows any origin, bypassing an earlier fix.
Originally disclosed on Chrome VRP
- Fix shipped in 3.5 years
VULNERABILITY DETAILS
BackgroundFetch sends cookies even if the credentials mode is "omit" or "same-origin" and thus bypassing the fix for https://crbug.com/chromium/1239709.
VERSION
Version 96.0.4664.45 (Official Build) Arch Linux (64-bit)
REPRODUCTION CASE
Using the glitch.me site from https://crbug.com/chromium/1239709:
- Set a cookie at https://echo-cookie-test.glitch.me
<script>
const url = "https://echo-cookie-test.glitch.me/echo-cookie"; // some site with a wildcard ACAO header
navigator.serviceWorker.ready.then(async (swReg) => {
// { credentials: "same-origin" || "omit" } still sends cookies, but isn't blocked
const bgFetch = await swReg.backgroundFetch.fetch("test", [new Request(url, { credentials: "omit" })]);
const targetPage = await bgFetch.match(url);
const response = await targetPage.responseReady;
console.log(await response.text()); // response contains cookie
});
navigator.serviceWorker.register("sw.js");
</script>
// can be empty
I'm not entirely sure, but AFAIU setting the request->request_initiator1, that is explained here2, in the DownloadParams struct, that is declared here3, should fix this.
Also not sure how that relates to https://crbug.com/chromium/1268580 and if that fixes it too.
CREDIT INFORMATION
Reporter credit: Maurice Dauer
Context
Chrome's Background Fetch API lets a service worker start a download that continues even if the page or the browser is closed. The service worker registers a fetch through swReg.backgroundFetch.fetch(...), and the browser later hands the request to the download component, which performs the network request on the worker's behalf.
Because the request is performed outside the page's normal fetch path, the credentials handling has to be carried over explicitly. The report shows that it was not: Background Fetch sends cookies even when the request's credentials mode is "omit" or "same-origin", which bypasses the earlier fix for crbug.com/chromium/1239709. The weakness is classified as an inappropriate implementation in the Background Fetch API, tracked as CVE-2025-5064.
Setup
The researcher tested on Chrome version 96.0.4664.45 (Official Build) Arch Linux (64-bit).
The reproduction reuses the glitch.me site from the earlier bug, https://echo-cookie-test.glitch.me, described in the report as a site with a wildcard ACAO (Access-Control-Allow-Origin) header. The only precondition is that a cookie is set for that origin, which the test page does first. A service worker is registered from the same page; its script can be empty.
Finding it
The starting point is the fix for crbug.com/chromium/1239709, which was meant to stop cross-origin requests from carrying credentials when the credentials mode says they should not. The researcher noticed that the same request, when issued through Background Fetch instead of a normal fetch, still carried the cookie. The same request, issued through Background Fetch, still carried the cookie, so the earlier protection did not apply.
Exploitation
Step 1: Set a cookie on the target origin
The test begins by setting a cookie at https://echo-cookie-test.glitch.me. This is the credential that should not be sent when the credentials mode is "omit" or "same-origin".
Step 2: Register a service worker and start a background fetch
The page registers a service worker and, once it is ready, creates a Background Fetch request for the echo endpoint with credentials: "omit":
<script>
const url = "https://echo-cookie-test.glitch.me/echo-cookie"; // some site with a wildcard ACAO header
navigator.serviceWorker.ready.then(async (swReg) => {
// { credentials: "same-origin" || "omit" } still sends cookies, but isn't blocked
const bgFetch = await swReg.backgroundFetch.fetch("test", [new Request(url, { credentials: "omit" })]);
const targetPage = await bgFetch.match(url);
const response = await targetPage.responseReady;
console.log(await response.text()); // response contains cookie
});
navigator.serviceWorker.register("sw.js");
</script>
The Request is constructed with credentials: "omit", which should prevent cookies from being attached. The comment notes that "same-origin" behaves the same way in this path. The fetch is registered under the id "test", then matched back with bgFetch.match(url) and awaited through responseReady. The body of the response is printed to the console, and the comment states that the response contains the cookie, meaning the echo endpoint received it.
Step 3: The service worker
The worker script itself does nothing:
// can be empty
All of the behaviour comes from the page calling into the Background Fetch API through the registration.
Root cause
The Background Fetch request is handed to the download component, which builds its own request from the parameters it is given. The researcher's reading is that setting request->request_initiator in the DownloadParams struct should fix this. The suggested fix is to set request->request_initiator in DownloadParams.
The report points to three places in the Chromium source:
components/download/internal/common/download_utils.cc, line 277.net/url_request/url_request.h, line 328, which explainsrequest_initiator.components/background_fetch/background_fetch_delegate_base.cc, line 93, whereDownloadParamsis declared.
The researcher is explicit that this is a hypothesis ("I'm not entirely sure, but AFAIU"). The report also raises the question of how this relates to crbug.com/chromium/1268580 and whether the same change would fix that issue too; it does not answer the question.
Impact
A page can cause a credentialed request to a cross-origin endpoint through Background Fetch even when the request is marked "omit" or "same-origin". In the test, the response body returned by the echo endpoint contained the cookie. The test site is described in the code comment as having a wildcard ACAO header.
Fix
The report proposes setting request->request_initiator in the DownloadParams struct, which the researcher believes should fix this. The report does not state which change was ultimately shipped.
Variants to test
- Try both
credentials: "omit"andcredentials: "same-origin"on theRequestpassed tobackgroundFetch.fetch. A positive result is a response body that contains a cookie value the page set for the target origin. - Test other request properties that the download component might drop, such as the referrer or the request mode, and check whether the server observes them. A positive result is the server seeing a value that the
Requestshould have suppressed. - Repeat the test against an endpoint without a wildcard ACAO header to see whether the cookie is still sent, even if the response cannot be read. A positive result is the server-side log showing the cookie on a request that should have been credential-free.
Hunting notes
This kind of bug tends to sit where a high-level web API hands a request to a lower-level network component: the credentials mode, initiator and referrer have to be copied across the boundary, and any field that is not copied is silently lost. During recon, look for features that perform requests on the user's behalf outside the page's normal fetch path, such as background downloads, prefetching and background sync. The signal is a request that reaches the server with credentials the calling code explicitly asked to omit. In this case the researcher demonstrated impact by echoing the cookie back in the response body from a site with a wildcard ACAO header, which showed that the page could read the credential rather than merely cause it to be sent.
What happened, in plain words
A browser has a rule about when it may attach your saved login data (cookies) to a request. A website can say "do not send my cookies with this request", and the browser is supposed to obey. Chrome has a feature called Background Fetch that lets a website start a download in the background, and it sent the cookies anyway. The researcher showed this with a small test page, and the bug was tracked as CVE-2025-5064.
To follow the rest, you only need to know what a few everyday things are. A cookie is a small piece of text a website asks your browser to store and send back on later requests, and it is often how a site knows you are logged in. An API (Application Programming Interface) is a defined set of commands one piece of software offers to another; think of it as a menu of actions a website is allowed to ask the browser to perform. A service worker is a script the browser keeps running in the background for a website, even when the page is closed, so the site can do things like show notifications or finish downloads. Background Fetch is the Chrome feature that uses a service worker to download a file that keeps going after you leave the page or close the browser.
Context
Chrome's Background Fetch API lets a service worker start a download that continues even if the page or the browser is closed. The service worker registers a fetch through swReg.backgroundFetch.fetch(...), and the browser later hands the request to the download component, which performs the network request on the worker's behalf.
Because the request is performed outside the page's normal fetch path, the credentials handling has to be carried over explicitly. The report shows that it was not: Background Fetch sends cookies even when the request's credentials mode is "omit" or "same-origin", which bypasses the earlier fix for crbug.com/chromium/1239709. The weakness is classified as an inappropriate implementation in the Background Fetch API, tracked as CVE-2025-5064.
A credentials mode is the setting on a request that says whether cookies and similar login data may travel with it. "omit" means "never send them", and "same-origin" means "send them only to the same site that made the request". The earlier bug, crbug.com/chromium/1239709, was about requests that carried credentials when they should not have, and a fix was written for it. This report is about the same problem reappearing through a different door.
Setup
The researcher tested on Chrome version 96.0.4664.45 (Official Build) Arch Linux (64-bit).
The reproduction reuses the glitch.me site from the earlier bug, https://echo-cookie-test.glitch.me, described in the report as a site with a wildcard ACAO (Access-Control-Allow-Origin) header. The only precondition is that a cookie is set for that origin, which the test page does first. A service worker is registered from the same page; its script can be empty.
Two terms from that paragraph. ACAO stands for Access-Control-Allow-Origin, a response header a server uses to tell the browser which other sites are allowed to read its responses. A wildcard ACAO header means "any site may read this response". An origin is the combination of scheme, host and port, so https://echo-cookie-test.glitch.me is one origin.
Finding it
The starting point is the fix for crbug.com/chromium/1239709, which was meant to stop cross-origin requests from carrying credentials when the credentials mode says they should not. The researcher noticed that the same request, when issued through Background Fetch instead of a normal fetch, still carried the cookie. The same request, issued through Background Fetch, still carried the cookie, so the earlier protection did not apply.
In other words: the browser had already been taught to respect the "do not send cookies" instruction on the ordinary path, but the background download path was a separate route to the network, and that route had not been taught the same lesson.
Exploitation
Step 1: Set a cookie on the target origin
The test begins by setting a cookie at https://echo-cookie-test.glitch.me. This is the credential that should not be sent when the credentials mode is "omit" or "same-origin".
Why this step: without a cookie in place, there would be nothing to leak, and the test could not tell whether the browser obeyed the instruction. The cookie acts as a marker, like putting a labelled item in a bag and then checking whether it is still there after the bag has supposedly been emptied.
Step 2: Register a service worker and start a background fetch
The page registers a service worker and, once it is ready, creates a Background Fetch request for the echo endpoint with credentials: "omit":
<script>
const url = "https://echo-cookie-test.glitch.me/echo-cookie"; // some site with a wildcard ACAO header
navigator.serviceWorker.ready.then(async (swReg) => {
// { credentials: "same-origin" || "omit" } still sends cookies, but isn't blocked
const bgFetch = await swReg.backgroundFetch.fetch("test", [new Request(url, { credentials: "omit" })]);
const targetPage = await bgFetch.match(url);
const response = await targetPage.responseReady;
console.log(await response.text()); // response contains cookie
});
navigator.serviceWorker.register("sw.js");
</script>
Line by line, in plain words:
<script>and</script>mark the start and end of a block of JavaScript that the browser runs when the page loads.const url = "https://echo-cookie-test.glitch.me/echo-cookie";stores the address to be requested. The comment after it notes that this is a site with a wildcard ACAO header, which is what will let the page read the reply.navigator.serviceWorker.ready.then(async (swReg) => {waits until the service worker is installed and active, then runs the code inside the braces.swRegis the handle to that worker.- The comment
// { credentials: "same-origin" || "omit" } still sends cookies, but isn't blockedrecords the finding: either of those two settings still results in cookies being sent. const bgFetch = await swReg.backgroundFetch.fetch("test", [new Request(url, { credentials: "omit" })]);asks the service worker to start a background download. The download is named"test", and the thing to download is aRequestbuilt for the URL withcredentials: "omit", meaning "do not send cookies".awaitmeans "wait for this to finish before moving on".const targetPage = await bgFetch.match(url);looks up the part of that background fetch that corresponds to the URL, so the page can inspect its result.const response = await targetPage.responseReady;waits until the server's response has arrived.console.log(await response.text()); // response contains cookieprints the body of the response into the browser's developer console. The comment states the result: the body contains the cookie, which means the server received it despite the"omit"setting.navigator.serviceWorker.register("sw.js");registers the service worker script namedsw.jsfor this page.
Why this step: the whole point is to make a request that is explicitly marked "no cookies" and then check, through the server's own echo, whether a cookie nevertheless arrived.
Step 3: The service worker
The worker script itself does nothing:
// can be empty
This is a single comment line saying the file can be empty. Why it matters: it shows that the behaviour does not come from clever code inside the worker. The worker only needs to exist so that the page has a registration to call Background Fetch through. All of the behaviour comes from the page calling into the Background Fetch API through the registration.
Root cause
The Background Fetch request is handed to the download component, which builds its own request from the parameters it is given. The researcher's reading is that setting request->request_initiator in the DownloadParams struct should fix this. The suggested fix is to set request->request_initiator in DownloadParams.
Some vocabulary. A component here is a self-contained part of the browser's code with a specific job; the download component's job is to carry out downloads. A struct is a bundle of related values grouped under one name in code, like a form with several fields. The request initiator is the value recording which origin started a request, so the browser can apply the right rules to it.
The report points to three places in the Chromium source:
components/download/internal/common/download_utils.cc, line 277.net/url_request/url_request.h, line 328, which explainsrequest_initiator.components/background_fetch/background_fetch_delegate_base.cc, line 93, whereDownloadParamsis declared.
The researcher is explicit that this is a hypothesis ("I'm not entirely sure, but AFAIU"). "AFAIU" is shorthand for "as far as I understand". The report also raises the question of how this relates to crbug.com/chromium/1268580 and whether the same change would fix that issue too; it does not answer the question.
Impact
A page can cause a credentialed request to a cross-origin endpoint through Background Fetch even when the request is marked "omit" or "same-origin". In the test, the response body returned by the echo endpoint contained the cookie. The test site is described in the code comment as having a wildcard ACAO header.
CORS (Cross-Origin Resource Sharing) is the set of rules by which a server says which other sites may read its responses. Without a permissive header, the browser will still send the request but will not let the page read the reply.
Fix
The report proposes setting request->request_initiator in the DownloadParams struct, which the researcher believes should fix this. The report does not state which change was ultimately shipped.
Variants to test
- Try both
credentials: "omit"andcredentials: "same-origin"on theRequestpassed tobackgroundFetch.fetch. A positive result is a response body that contains a cookie value the page set for the target origin. - Test other request properties that the download component might drop, such as the referrer or the request mode, and check whether the server observes them. A positive result is the server seeing a value that the
Requestshould have suppressed. - Repeat the test against an endpoint without a wildcard ACAO header to see whether the cookie is still sent, even if the response cannot be read. A positive result is the server-side log showing the cookie on a request that should have been credential-free.
The referrer is the address of the page a request came from, which a request can be told to withhold. The request mode is a setting that controls what kind of request it is and what the page may do with the response.
Hunting notes
This kind of bug tends to sit where a high-level web API hands a request to a lower-level network component: the credentials mode, initiator and referrer have to be copied across the boundary, and any field that is not copied is silently lost. During recon, look for features that perform requests on the user's behalf outside the page's normal fetch path, such as background downloads, prefetching and background sync. The signal is a request that reaches the server with credentials the calling code explicitly asked to omit. In this case the researcher demonstrated impact by echoing the cookie back in the response body from a site with a wildcard ACAO header, which showed that the page could read the credential rather than merely cause it to be sent.
Recon means the exploratory phase of testing, where you look around a system to see what it can do before trying anything specific. Prefetching is when the browser fetches something in advance, expecting it will be needed soon. Background sync is a feature that lets a site queue work to be sent to the server later, even if the page has been closed.
Glossary
- API: a defined set of commands one piece of software offers to another, like a menu of allowed actions.
- ACAO (Access-Control-Allow-Origin): a response header by which a server says which other sites may read its responses.
- Background Fetch: a Chrome feature that lets a service worker start a download that continues after the page or browser is closed.
- Background sync: a feature that lets a site queue work to be sent to the server later, even after the page is closed.
- Component: a self-contained part of a program with a specific job, such as carrying out downloads.
- Cookie: a small piece of text a site asks the browser to store and send back on later requests, often used to recognise a logged-in user.
- CORS (Cross-Origin Resource Sharing): the rules by which a server tells the browser which other sites may read its responses.
- Credentials mode: the setting on a request that says whether cookies and similar login data may travel with it, such as
"omit"or"same-origin". - CVE: a public identifier given to a known security vulnerability so people can refer to it unambiguously.
- Download component: the part of the browser whose job is to carry out downloads.
- Echo endpoint: a server address that sends back what it received, used here to reveal whether a cookie arrived.
- Inappropriate implementation: a weakness class meaning the code does not behave as its own specification or security rules require.
- Origin: the combination of scheme, host and port that identifies a site, for example
https://echo-cookie-test.glitch.me. - Prefetching: fetching something in advance because it is expected to be needed soon.
- Recon: the exploratory phase of testing, looking around a system to see what it can do.
- Referrer: the address of the page a request came from, which a request can be told to withhold.
- Request initiator: the value recording which origin started a request, so the browser can apply the right rules.
- Request mode: a setting that controls what kind of request it is and what the page may do with the response.
- Service worker: a script the browser keeps running in the background for a site, even when the page is closed.
- Struct: a bundle of related values grouped under one name in code, like a form with several fields.
- Wildcard: a value meaning "any", here an ACAO header that lets any site read the response.