Skip to content
Info disclosure Advisory Advanced CVE-2026-1504

Inappropriate implementation in Background Fetch API (CVE-2026-1504)

A flaw in Chrome's handling of opaque responses with status 416 allowed a service worker to bypass a security check and leak the size of cross-origin resources. An attacker could use this to determine the exact size of a cross-origin resource via a binary search attack.

Luan Herrera Follow

Originally disclosed on Chrome VRP

Bounty$3,000 High View original
  • Fix shipped in 19 days

VULNERABILITY DETAILS

When a cross-origin resource is used in an audio/video tag, a request containing the Range header asking for bytes=0- is issued. If the request is intercepted using a Service Worker and we respond with an arbitrary Content-Range header, e.g:

JavaScript
e.respondWith(new Response("A".repeat(size), {status: 206, headers: { "Content-Range": "bytes 0-5000/13337" }}));

Chrome will be tricked into thinking it got the first size bytes of the audio/video and then ask for the remaining bytes by issuing a new request containing the Range: bytes=${size}- header.

If we also intercept the following request and send it again using the Fetch API, the request will be sent to the cross-origin server containing the Range header and there will be two possible outcomes:

  1. The server will return a 416 Range Not Satisfiable response status code if the cross-origin response size is smaller than size bytes.
  2. The server will return a 206 Partial Content response status code if the cross-origin response size is bigger than size bytes.

We can then store this response and use the service worker to return it when a different resource is fetched (e.g., /mock.css with mode: "no-cors").

In the case of fetch requests, if the stored response contains a 206 status code, it will fail because Chrome has a security check in resource_loader.cc:950-958 that blocks opaque responses with status 206 when has_range_requested is true but the original request didn't have a Range header.

However, if the stored response contains a 416 status code, this check is skipped because it only triggers for status code 206, not 416, causing the fetch to succeed normally.

This difference in behavior (206 throws an error, 416 succeeds) can be observed using a try/catch block, thus creating an oracle that allows an attacker to detect the possible outcomes mentioned above and leak the exact size of cross-origin resources that accept range requests.

The root cause is in third_party/blink/renderer/platform/loader/fetch/resource_loader.cc:950-958:

C++
// A response should not serve partial content if it was not requested via a
// Range header: https://fetch.spec.whatwg.org/#main-fetch
if (response.GetType() == network::mojom::FetchResponseType::kOpaque &&
    response.HttpStatusCode() == 206 && response.HasRangeRequested() &&
    !initial_request.HttpHeaderFields().Contains(http_names::kRange)) {
  HandleError(ResourceError::CancelledDueToAccessCheckError(
      response.CurrentRequestUrl(), ResourceRequestBlockedReason::kOther));
  return;
}

The check only blocks responses with status code 206, but does not block 416 responses, allowing the information leak.

In the PoC, the size of https://www.google.com/robots.txt is being brute-forced through a binary search attack.

This vulnerability is useful for XS-Search attacks. A real-world example is https://medium.com/@luanherrera/xs-searching-googles-bug-tracker-to-find-out-vulnerable-source-code-50d8135b7549 (more on https://github.com/xsleaks/xsleaks/wiki/Real-World-Examples).

For more context, this is a variation of https://crbug.com/chromium/990849 (which I reported a few years ago). I have also attached a video reproducing the attack (repro.mp4).

BISECT

By doing an initial bisect, I found that the issue was introduce between 800651 and 800665 (https://chromium.googlesource.com/chromium/src/+log/d474076dff70b3df138c423225c74cb011e750b7..676c68c320a484dc95ed5060d81af7b71d55153b).

After investigating, it became clear that the commit that introduced the issue is https://chromium.googlesource.com/chromium/src/+/5da0ed1e65305ab2c6d9de2bb4ce62f159520ba8, and it landed on M87.0.4241.0.

VERSION

Chrome Version: 143.0.7499.170 (Stable)
Chrome Version: 144.0.7559.31 (Beta)
Chrome Version: 145.0.7587.5 (Dev)
Chrome Version: 145.0.7618.0 (Canary)
Operating System: Windows 11 24H2

REPRODUCTION CASE

  1. Download the following files: index.html and sw.js.
  2. Move all files into the same folder.
  3. Serve the files using a web server (e.g., python -m http.server 8080).
  4. Navigate to http://localhost:8080/index.html.
  5. The page will automatically register the service worker.
  6. Enter a URL in the input field (default is https://www.google.com/robots.txt) and click the Run button.
  7. The exact response size of the cross-origin resource will be leaked via a binary search attack, with results displayed on the page.

CREDIT INFORMATION

Reporter credit: Luan Herrera (@lbherrera_)

The original report as published on the Chromium issue tracker, by Luan Herrera (@lbherrera_). Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 6 min read.

Context

Chrome's Background Fetch API is not the subject here despite the advisory title; the behaviour described lives in Blink's resource loader and concerns how media elements and the Fetch API handle partial content. When a cross-origin resource is used in an <audio> or <video> tag, Chrome issues a request carrying a Range header asking for bytes=0-. A Service Worker can intercept that request and answer it with an arbitrary Content-Range header, which lets an attacker control what Chrome believes about the size of the remote resource.

The report describes how that control, combined with an inconsistency in how Chrome treats opaque responses with status 206 versus 416, produces an oracle that leaks the exact size of cross-origin resources that accept range requests. The researcher notes this is useful for XS-Search attacks and is a variation of an earlier issue, crbug.com/chromium/990849, reported a few years before.

Setup

The reproduction serves a page from a local web server with a Service Worker registered on it. The researcher's reproduction uses a local web server and two files, index.html and sw.js, placed in the same folder. The affected versions listed are:

Channel Version
Stable 143.0.7499.170
Beta 144.0.7559.31
Dev 145.0.7587.5
Canary 145.0.7618.0

Operating system: Windows 11 24H2. The target resource in the proof of concept is https://www.google.com/robots.txt.

Finding it

The researcher noticed that when a cross-origin resource is used in an audio or video tag, Chrome sends a request with the Range header bytes=0-. If a Service Worker intercepts that request and responds with an arbitrary Content-Range header, Chrome is tricked into thinking it received the first size bytes of the media. Chrome then asks for the remaining bytes with a new request carrying Range: bytes=${size}-.

That second request can also be intercepted. If the Service Worker re-sends it using the Fetch API, the request reaches the cross-origin server with the Range header intact, and one of two things happens depending on the real size of the remote resource relative to the attacker-chosen size:

  1. The server returns 416 Range Not Satisfiable if the cross-origin response is smaller than size bytes.
  2. The server returns 206 Partial Content if the cross-origin response is bigger than size bytes.

The attacker can store whichever response comes back and have the Service Worker return it later when a different resource is fetched, for example /mock.css with mode: "no-cors". The two status codes then behave differently in a way the page can observe, which is what turns the primitive into a size oracle.

Exploitation

Step 1: serve the page and register the Service Worker

  1. Download index.html and sw.js.
  2. Move both files into the same folder.
  3. Serve the folder with a web server, for example:
Bash
python -m http.server 8080
  1. Navigate to http://localhost:8080/index.html.
  2. The page registers the Service Worker automatically.

Step 2: answer the media request with a forged partial response

The Service Worker intercepts the media request and responds with a body of the attacker's chosen size, a 206 status and an arbitrary Content-Range header:

JavaScript
e.respondWith(new Response("A".repeat(size), {status: 206, headers: { "Content-Range": "bytes 0-5000/13337" }}));

Chrome accepts this as the first size bytes of the media and follows up with a request for the rest, carrying Range: bytes=${size}-.

Step 3: replay the follow-up request to the cross-origin server

The Service Worker intercepts that follow-up and re-sends it through the Fetch API. The request goes to the cross-origin server with the Range header, and the server's answer depends on whether the real resource is larger or smaller than size:

  • 416 Range Not Satisfiable when the cross-origin response is smaller than size bytes.
  • 206 Partial Content when the cross-origin response is bigger than size bytes.

Step 4: replay the stored response against a different resource

The attacker stores the response and uses the Service Worker to return it when a different resource is fetched, such as /mock.css with mode: "no-cors". The outcome of that fetch now depends on the stored status code:

  • A stored 206 fails. Chrome has a security check in resource_loader.cc:950-958 that blocks opaque responses with status 206 when has_range_requested is true but the original request did not carry a Range header.
  • A stored 416 succeeds, because the check only triggers for status code 206 and not for 416.

Step 5: read the oracle and brute-force the size

Because the 206 case throws and the 416 case succeeds, a try/catch block around the fetch distinguishes the two outcomes. That gives the attacker a yes/no answer to the question "is the cross-origin resource larger than size bytes?". In the proof of concept the size of https://www.google.com/robots.txt is recovered through a binary search attack. The page takes a URL in an input field (default https://www.google.com/robots.txt), the Run button starts the attack, and the leaked exact response size is displayed on the page.

Root cause

The flaw is in third_party/blink/renderer/platform/loader/fetch/resource_loader.cc:950-958:

C++
// A response should not serve partial content if it was not requested via a
// Range header: https://fetch.spec.whatwg.org/#main-fetch
if (response.GetType() == network::mojom::FetchResponseType::kOpaque &&
    response.HttpStatusCode() == 206 && response.HasRangeRequested() &&
    !initial_request.HttpHeaderFields().Contains(http_names::kRange)) {
  HandleError(ResourceError::CancelledDueToAccessCheckError(
      response.CurrentRequestUrl(), ResourceRequestBlockedReason::kOther));
  return;
}

The check blocks opaque responses with status code 206 when a range was requested but the initial request had no Range header. It does not block 416 responses, so the same situation with a 416 status passes through and the fetch succeeds. That asymmetry is the information leak: the attacker learns which of the two status codes the cross-origin server produced, and therefore whether the real resource is larger or smaller than the chosen size.

A bisect placed the introduction of the issue between revisions 800651 and 800665. The commit identified as introducing it is [redacted], which landed on M87.0.4241.0.

Impact

An attacker who can serve a page with a Service Worker can determine the exact size of cross-origin resources that accept range requests, without reading their contents. The report frames this as useful for XS-Search attacks and points to a real-world example of XS-Searching Google's bug tracker to find vulnerable source code, along with the xsleaks wiki's collection of real-world examples. The advisory rates the issue high severity, and the Chrome VRP paid a bounty of 3000.00 USD.

Fix

The report does not describe the fix that was applied. A change following from the root cause would be for the guard in resource_loader.cc to treat a 416 response the same way it treats a 206 response.

Variants to test

  • Other status codes that signal partial or unsatisfiable content. The check keys on 206 only; try any status the server can return for a ranged request and see whether the opaque response is allowed through where a 206 would be blocked. A positive result is a fetch that succeeds with a status the guard should have rejected.
  • Other resource types that trigger ranged requests. The report describes audio and video tags; test whether other elements or APIs that issue Range requests can be driven the same way through a Service Worker. A positive result is a follow-up request with Range: bytes=${size}- that the attacker can replay.
  • Other consumers of the stored response. The report uses /mock.css with mode: "no-cors"; try other fetch destinations and modes to see whether the 206/416 difference remains observable. A positive result is a try/catch that reliably distinguishes the two outcomes.
  • Size oracles on other cross-origin endpoints. Any resource that accepts range requests and is reachable from the victim's browser can be measured with the same binary search. A positive result is a recovered size that matches the real response length.
  • The earlier related issue, crbug.com/chromium/990849, as a starting point. The researcher describes this as a variation of it, so the same class of guard bypass may appear in other places where opaque responses are filtered by status code.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 13 min read.

What happened, in plain words

A security researcher found a way for a website you visit to learn the exact size of a file that lives on a completely different website, without being allowed to read that file. The trick abuses how Chrome handles a request for part of a media file (audio or video) and a small inconsistency in a security check inside Chrome's code.

To follow this, you need a few ideas from scratch:

  • Cross-origin: a website at one address (say evil.example) is not normally allowed to read data from another address (say www.google.com). Browsers enforce this with rules collectively called the same-origin policy. Think of it as two offices in a building: you can walk around your own office freely, but the door to the other office is locked unless they explicitly let you in.
  • Range request: when a browser wants only part of a file, it asks the server for a byte range, for example "give me bytes 0 to 5000". This is how video players start playing before the whole file has downloaded. The server replies with a status code 206 Partial Content and a Content-Range header saying which slice it sent. If you ask for a slice that does not exist (for example, bytes beyond the end of the file), the server replies 416 Range Not Satisfiable.
  • Service Worker: a small script that a website can install in your browser to sit between the page and the network. It can intercept requests the page makes and answer them itself, like a receptionist who can hand you a pre-written reply instead of forwarding your call. A site can only install one for its own address.
  • Opaque response: when a page fetches something cross-origin in a mode that does not allow reading the body (no-cors), the browser gives the page an "opaque" response: the page can see that something came back, but not the contents. It is like receiving a sealed envelope: you know it arrived, not what is inside.
  • Oracle: in security, an oracle is any observable difference (an error versus a success, a fast reply versus a slow one) that lets an attacker learn a secret one small piece at a time. Here the oracle is simply: does a fetch throw an error or not?
  • XS-Search: a class of attacks where a malicious page uses such side channels to search or measure things on other sites, without ever reading their content.
  • Binary search: a way to find a number by repeatedly halving the range of possibilities. Guess the middle; if the answer is "bigger", keep the upper half; if "smaller", keep the lower half. A file of a few thousand bytes can be measured in a dozen or so questions.

The advisory is titled around the Background Fetch API, but the behaviour described actually lives in Chrome's resource loader (the part of the browser engine, Blink, that fetches things) and concerns how media elements and the Fetch API deal with partial content. The researcher also notes this is a variation of an earlier issue, crbug.com/chromium/990849, reported a few years before.

Setup

The reproduction serves a page from a local web server with a Service Worker registered on it. The researcher's reproduction uses a local web server and two files, index.html and sw.js, placed in the same folder. The affected versions listed are:

Channel Version
Stable 143.0.7499.170
Beta 144.0.7559.31
Dev 145.0.7587.5
Canary 145.0.7618.0

Operating system: Windows 11 24H2. The target resource in the proof of concept is https://www.google.com/robots.txt.

Finding it

The researcher noticed that when a cross-origin resource is used in an audio or video tag, Chrome sends a request with the Range header bytes=0-. In plain terms: the media player asks the other site for the file starting from the first byte.

If a Service Worker intercepts that request and responds with an arbitrary Content-Range header, Chrome is tricked into thinking it received the first size bytes of the media. Chrome then asks for the remaining bytes with a new request carrying Range: bytes=${size}-. The ${size} is simply the number the attacker chose; Chrome fills in the value it believes it already has.

That second request can also be intercepted. If the Service Worker re-sends it using the Fetch API (the modern way JavaScript makes network requests), the request reaches the cross-origin server with the Range header intact, and one of two things happens depending on the real size of the remote resource relative to the attacker-chosen size:

  1. The server returns 416 Range Not Satisfiable if the cross-origin response is smaller than size bytes. The attacker asked for bytes starting past the end of the file, so the server says "no such range".
  2. The server returns 206 Partial Content if the cross-origin response is bigger than size bytes. The requested slice exists, so the server sends it.

The attacker can store whichever response comes back and have the Service Worker return it later when a different resource is fetched, for example /mock.css with mode: "no-cors". The two status codes then behave differently in a way the page can observe, which is what turns the primitive into a size oracle.

Exploitation

Step 1: serve the page and register the Service Worker

  1. Download index.html and sw.js.
  2. Move both files into the same folder.
  3. Serve the folder with a web server, for example:
Bash
python -m http.server 8080

This line starts Python's built-in web server on port 8080, serving whatever files are in the current folder. python runs the interpreter, -m http.server selects the built-in server module, and 8080 is the port number. The reason for this step is that Service Workers only work on pages served over HTTP(S), not files opened directly from disk, so the researcher needs a real local address.

  1. Navigate to http://localhost:8080/index.html.
  2. The page registers the Service Worker automatically.

Step 2: answer the media request with a forged partial response

The Service Worker intercepts the media request and responds with a body of the attacker's chosen size, a 206 status and an arbitrary Content-Range header:

JavaScript
e.respondWith(new Response("A".repeat(size), {status: 206, headers: { "Content-Range": "bytes 0-5000/13337" }}));

Line by line:

  • e.respondWith(...) tells the browser: do not go to the network for this request, use the response I am giving you instead. e is the fetch event the Service Worker received.
  • new Response("A".repeat(size), ...) builds a fake response body consisting of the letter A repeated size times. The attacker picks size.
  • {status: 206, ...} marks the fake response as "partial content", the status a server uses when it sends only a slice of a file.
  • headers: { "Content-Range": "bytes 0-5000/13337" } adds a header claiming this slice covers bytes 0 to 5000 of a file that is 13337 bytes long. The numbers are arbitrary; the point is that Chrome believes them.

Chrome accepts this as the first size bytes of the media and follows up with a request for the rest, carrying Range: bytes=${size}-. The reason for this step is to make Chrome itself generate the follow-up request, with a Range header, that the attacker will then replay.

Step 3: replay the follow-up request to the cross-origin server

The Service Worker intercepts that follow-up and re-sends it through the Fetch API. The request goes to the cross-origin server with the Range header, and the server's answer depends on whether the real resource is larger or smaller than size:

  • 416 Range Not Satisfiable when the cross-origin response is smaller than size bytes.
  • 206 Partial Content when the cross-origin response is bigger than size bytes.

The reason for this step is that the cross-origin server, not the attacker, now answers the question "is the file bigger than size?", and its status code carries that answer back.

Step 4: replay the stored response against a different resource

The attacker stores the response and uses the Service Worker to return it when a different resource is fetched, such as /mock.css with mode: "no-cors". The outcome of that fetch now depends on the stored status code:

  • A stored 206 fails. Chrome has a security check in resource_loader.cc:950-958 that blocks opaque responses with status 206 when has_range_requested is true but the original request did not carry a Range header.
  • A stored 416 succeeds, because the check only triggers for status code 206 and not for 416.

The reason for this step is to move the answer into a place where the page's own JavaScript can observe it. The page cannot read the cross-origin response, but it can notice whether the fetch threw an error.

Step 5: read the oracle and brute-force the size

Because the 206 case throws and the 416 case succeeds, a try/catch block around the fetch distinguishes the two outcomes. A try/catch is JavaScript's way of running code that might fail: the try block runs, and if it throws, the catch block runs instead. That gives the attacker a yes/no answer to the question "is the cross-origin resource larger than size bytes?".

In the proof of concept the size of https://www.google.com/robots.txt is recovered through a binary search attack. The page takes a URL in an input field (default https://www.google.com/robots.txt), the Run button starts the attack, and the leaked exact response size is displayed on the page. The reason binary search is used is efficiency: each question halves the remaining possibilities, so the exact size is found in a small number of requests rather than one request per possible byte count.

Root cause

The flaw is in third_party/blink/renderer/platform/loader/fetch/resource_loader.cc:950-958:

C++
// A response should not serve partial content if it was not requested via a
// Range header: https://fetch.spec.whatwg.org/#main-fetch
if (response.GetType() == network::mojom::FetchResponseType::kOpaque &&
    response.HttpStatusCode() == 206 && response.HasRangeRequested() &&
    !initial_request.HttpHeaderFields().Contains(http_names::kRange)) {
  HandleError(ResourceError::CancelledDueToAccessCheckError(
      response.CurrentRequestUrl(), ResourceRequestBlockedReason::kOther));
  return;
}

Line by line:

  • The comment explains the rule: a response should not serve partial content if the page never asked for a range. This mirrors the Fetch standard, which the comment links to.
  • response.GetType() == network::mojom::FetchResponseType::kOpaque checks that the response is opaque, meaning the page is not allowed to read its body.
  • response.HttpStatusCode() == 206 checks that the response claims to be partial content.
  • response.HasRangeRequested() checks that a range was requested at some point.
  • !initial_request.HttpHeaderFields().Contains(http_names::kRange) checks that the original request did not itself carry a Range header. The ! means "not".
  • If all four conditions hold, HandleError(...) cancels the request with an access-check error, and return; stops processing.

The check blocks opaque responses with status code 206 when a range was requested but the initial request had no Range header. It does not block 416 responses, so the same situation with a 416 status passes through and the fetch succeeds. That asymmetry is the information leak: the attacker learns which of the two status codes the cross-origin server produced, and therefore whether the real resource is larger or smaller than the chosen size.

A bisect (a technique that walks through a project's history, testing versions to find the exact change that introduced a bug) placed the introduction of the issue between revisions 800651 and 800665. The commit identified as introducing it is [redacted], which landed on M87.0.4241.0.

Impact

An attacker who can serve a page with a Service Worker can determine the exact size of cross-origin resources that accept range requests, without reading their contents. The report frames this as useful for XS-Search attacks and points to a real-world example of XS-Searching Google's bug tracker to find vulnerable source code, along with the xsleaks wiki's collection of real-world examples. The advisory rates the issue high severity, and the Chrome VRP paid a bounty of 3000.00 USD.

Fix

The report does not describe the fix that was applied. A change following from the root cause would be for the guard in resource_loader.cc to treat a 416 response the same way it treats a 206 response.

Variants to test

  • Other status codes that signal partial or unsatisfiable content. The check keys on 206 only; try any status the server can return for a ranged request and see whether the opaque response is allowed through where a 206 would be blocked. A positive result is a fetch that succeeds with a status the guard should have rejected.
  • Other resource types that trigger ranged requests. The report describes audio and video tags; test whether other elements or APIs that issue Range requests can be driven the same way through a Service Worker. A positive result is a follow-up request with Range: bytes=${size}- that the attacker can replay.
  • Other consumers of the stored response. The report uses /mock.css with mode: "no-cors"; try other fetch destinations and modes to see whether the 206/416 difference remains observable. A positive result is a try/catch that reliably distinguishes the two outcomes.
  • Size oracles on other cross-origin endpoints. Any resource that accepts range requests and is reachable from the victim's browser can be measured with the same binary search. A positive result is a recovered size that matches the real response length.
  • The earlier related issue, crbug.com/chromium/990849, as a starting point. The researcher describes this as a variation of it, so the same class of guard bypass may appear in other places where opaque responses are filtered by status code.

Glossary

  • API: a defined set of functions a program offers so other programs can use it, like a menu of services at a counter.
  • Background Fetch API: a browser feature for letting downloads continue in the background; named in the advisory title, though the behaviour described here lives in the resource loader.
  • Binary search: finding a number by repeatedly halving the range of possible values.
  • Bisect: walking through a project's version history to find the exact change that introduced a bug.
  • Blink: the rendering engine inside Chrome that turns web pages into what you see and handles fetching resources.
  • Commit: a recorded change in a source code repository.
  • Content-Range: a response header that says which slice of a file the server is sending, for example bytes 0-5000/13337.
  • Cross-origin: a different address (scheme, host or port) from the page making the request.
  • Fetch API: the modern JavaScript way to make network requests.
  • Header: extra information attached to a request or response, separate from the body.
  • Media element: an <audio> or <video> tag in a page.
  • no-cors: a fetch mode that lets a request go cross-origin but gives the page an opaque response it cannot read.
  • Opaque response: a response whose contents the page is not allowed to read.
  • Oracle: any observable difference that lets an attacker learn a secret one piece at a time.
  • Range header: a request header asking for only part of a file, for example bytes=0-.
  • Resource loader: the part of Blink that performs network fetches and applies security checks to the results.
  • robots.txt: a small text file at the root of a website that tells crawlers what they may visit.
  • Same-origin policy: the browser rule that stops one site from reading another site's data.
  • Service Worker: a script a site installs in the browser to intercept and answer its network requests.
  • Status code: a three-digit number in a response saying how the request went, such as 206 or 416.
  • 206 Partial Content: the status for a successful response that contains only part of a file.
  • 416 Range Not Satisfiable: the status for a request asking for a range that does not exist, for example past the end of the file.
  • try/catch: JavaScript syntax for running code that might fail and handling the failure.
  • XS-Search: a class of attacks that use side channels to search or measure cross-origin resources without reading them.
  • XS-Leak: the broader family of cross-site leaks that XS-Search belongs to.

More by Luan Herrera

View all

30 more disclosed reports, best first.

More from Google Chrome

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.