Missing authorization in BackgroundFetch (CVE-2026-121174)
Background Fetch skips CORS preflight for same-origin initial requests but does not block cross-origin redirects, so a malicious site can redirect a background fetch to a victim endpoint with a non-safelisted method and custom headers while including cookies. This allows an attacker to perform authenticated state-changing cross-origin requests (CSRF) that bypass standard CORS protections.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 7 months
Project Fortify, an experimental security project, has identified the following potential security issue.
Overview: The BackgroundFetchJobController bypasses CORS preflight checks for initial same-origin requests, but fails to prevent or validate subsequent cross-origin redirects. Because background fetches are executed as kNavigate requests with kInclude credentials, an HTTP 307 redirect preserves custom methods and headers while sending cookies to the new origin. This allows attackers to perform authenticated, state-changing cross-origin requests (CSRF) that bypass standard CORS protections.
Affected files:
content/browser/background_fetch/background_fetch_job_controller.cc
Estimated timestamp from git blame: 2018-12-04
Description
A potential logic flaw in how Background Fetch handles CORS preflights and redirects allows a malicious origin to bypass Cross-Origin Resource Sharing (CORS) protections and perform Cross-Site Request Forgery (CSRF) attacks using non-safelisted HTTP methods (like DELETE or PUT) and custom HTTP headers.
When a background fetch is initiated, BackgroundFetchJobController::RequiresCorsPreflight determines if the request needs a CORS preflight. If the initial URL is same-origin with the requester, it immediately returns false (content/browser/background_fetch/background_fetch_job_controller.cc:49), skipping any validation of unsafe methods or custom headers. A developer comment directly above this code notes: // TODO(crbug.com/40515511): Make sure that cross-origin redirects are disabled.
When the request is passed to the background download service, it is constructed as a network::ResourceRequest with mode = network::mojom::RequestMode::kNavigate (because downloads are treated as navigations). Furthermore, the credentials_mode defaults to kInclude during this translation.
If the attacker's server responds to the initial request with an HTTP 307 Temporary Redirect to a cross-origin victim endpoint, the network stack preserves the original HTTP method and custom headers. Because the request mode is kNavigate, CorsURLLoader completely skips CheckAccess and preflight checks on the redirect. The request arrives at the victim's server with the attacker's custom headers, custom method, and the victim's ambient credentials (e.g., cookies), leading to a powerful CSRF.
Potential Steps to Reproduce
Note: These are suggested steps generated by our setup, which cannot execute code to provide a verified proof-of-concept.
- An attacker hosts a malicious website at
https://attacker.comand registers a Service Worker. - From the Service Worker, the attacker initiates a background fetch to a same-origin endpoint, specifying a non-safelisted method and custom headers:
JavaScript navigator.serviceWorker.ready.then(reg => { reg.backgroundFetch.fetch('csrf-attack', ['/redirect'], { method: 'DELETE', headers: { 'X-Custom-Header': 'attack' } }); }); - The browser skips the CORS preflight because
/redirectis same-origin withhttps://attacker.com. - The browser dispatches the
DELETErequest withX-Custom-Header: attacktohttps://attacker.com/redirect. - The attacker's server responds with an HTTP
307 Temporary Redirect, settingLocation: https://victim-bank.com/api/delete-account. - The browser's network stack follows the redirect, preserving the
DELETEmethod andX-Custom-Header, and attaching cookies forvictim-bank.com. - The cross-origin request executes without a CORS preflight, bypassing the Same-Origin Policy.
Proposed Fix
To address this, cross-origin redirects for Background Fetches should be restricted or subjected to proper CORS validation.
A robust fix would be to explicitly block cross-origin redirects for Background Fetch requests at the download service layer. This can be achieved by updating BackgroundFetchDelegateBase::DownloadUrl to configure the download::DownloadParams to reject cross-origin redirects, or by adding a flag to DownloadUrlParameters that sets cross_origin_redirects to network::mojom::RedirectMode::kError when the initiator is Background Fetch. Alternatively, implement the TODO in background_fetch_job_controller.cc by intercepting the redirect and actively aborting the fetch if the new URL is cross-origin.
Evaluated with Chrome root at commit: 0eb4855bda702feaaa8b899336664f97e3df88b8
Results so far have been promising, but there can be wrong deductions. If this proves to be a false positive, please close as WAI; data from false positives will be used to improve accuracy over time. Please feel free to reach out to me if you have concerns or feedback.
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 code returns false from RequiresCorsPreflight for same-origin initial URLs without disabling or validating cross-origin redirects, and the request is later treated as a navigation with credentials included, so the network stack skips CORS checks on the redirect.
Impact
An attacker could perform authenticated, state-changing cross-origin requests (CSRF) that bypass standard CORS protections, potentially leading to actions like account deletion.
What the attacker needed
Victim visits attacker's site; attacker controls a server; victim logged into target site
The fix
Cross-origin redirects for Background Fetch should be blocked or subjected to proper CORS validation, for example by setting cross_origin_redirects to kError or aborting the fetch on cross-origin redirect.
How it was found
- An attacker hosts a malicious website and registers a Service Worker.
- From the Service Worker, the attacker initiates a background fetch to a same-origin endpoint with a non-safelisted method and custom headers.
- The browser skips the CORS preflight because the endpoint is same-origin with the attacker's site.
- The browser sends the request with the custom method and headers to the attacker's endpoint.
- The attacker's server responds with an HTTP 307 redirect to a cross-origin victim endpoint.
- The browser follows the redirect, preserving the method and headers, and attaches the victim's cookies, executing the cross-origin request without a CORS preflight.
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.
When a website asks the browser to fetch a resource from another site, the browser normally checks with that other site first (a CORS preflight) to see if the request is allowed. Here, the browser skipped that check for the first request because it was to the same site, but then followed a redirect to a different site without re-checking. This let an attacker make the victim's browser send a harmful request to a bank or other site while logged in, as if the victim had done it themselves.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.