Skip to content
XSS Advisory Advanced CVE-2025-9866

Inappropriate implementation in Extensions (CVE-2025-9866)

A service worker could redirect a top-level navigation to a data: URL, which is normally blocked. An attacker could use this to run custom HTML in the victim's origin context and leak the victim's CSP, including nonce values.

NDevTK Follow

Originally disclosed on Chrome VRP

Bounty$4,000 Medium View original
  • Fix shipped in 10 months

Steps to reproduce the problem

This issue is split from https://issues.chromium.org/40064165 someone provided a hosted PoC https://crbug40064165.glitch.me/

index.html

HTML
<script>
  navigator.serviceWorker.register('swredirect.js');
  setTimeout(() => {
    location.reload();
  }, 1000);
</script>

swredirect.js

JavaScript
self.addEventListener('fetch', function(event) {
    event.respondWith(Response.redirect('data:text/html,<script>prompt("Test")</script>'));
});

Now doing open() to the HTTP URL of the service worker you will get redirected to a top-level data: URL.

Problem Description

Top-level navigations of this type are also not normally allowed. https://blog.mozilla.org/security/2017/11/27/blocking-top-level-navigations-data-urls-firefox-59/ This navigation inherits from the opener as shown for the origin in the protocol confirmation dialog and also leaks the victims CSP.

JavaScript
const observer = new ReportingObserver(
  (reports, observer) => {
    reports.forEach((violation) => {
      console.log(violation);
      console.log(JSON.stringify(violation));
    });
  },
  {
    types: ["csp-violation"],
    buffered: true,
  },
);

observer.observe();

CSP leak includes nonce values but with a migration of needing to comply with the victims CSP to abuse it, however a data: URL allows for custom HTML which is a larger attack surface.

Summary

Service workers allowing redirects to data: URLs.

Additional Data

Category: Security
Chrome Channel: Not sure
Regression: N/A

The original report as published on the Chromium issue tracker, by NDevTK. 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. 5 min read.

Service workers redirecting to data: URLs in Chrome Extensions (CVE-2025-9866)

Context

Service workers sit in the path of fetch events. A worker can intercept a request and answer it with event.respondWith(...), including with a redirect. The question this report asks is what happens when that redirect points at a data: URL and the request being redirected is a top-level navigation, for example one started with open().

Top-level navigations to data: URLs are not normally allowed in browsers. The report cites Mozilla's 2017 write-up on blocking top-level navigations to data: URLs in Firefox 59 as the reference for that expectation. The finding here is that a service worker redirect lets such a navigation through in Chrome, and that the resulting document inherits properties from the opener.

The issue was split from an earlier Chromium tracker entry, and a hosted proof of concept was provided at https://crbug40064165.glitch.me/. The report is filed under the Chrome VRP as an inappropriate implementation in Extensions, rated medium, with a bounty of 4000.00 USD, disclosed on 2025-09-02.

Setup

No accounts, roles or tool versions are described. The reproduction needs a page that registers a service worker, the worker script itself, and a way to open the HTTP URL of that worker in a new top-level context. The two files below are the whole of the proof of concept given in the report.

Finding it

A service worker's fetch handler can return a redirect to a data: URL, and when the HTTP URL of the worker is opened, the browser follows that redirect and lands on a top-level data: URL. That contradicts the general rule that top-level navigations to data: URLs are blocked.

Two further observations made it more than a curiosity. The navigation inherits from the opener, which the report says is visible for the origin in the protocol confirmation dialog. And the resulting document leaks the victim's CSP.

Exploitation

Step 1: register the worker and reload

The page registers the worker script and reloads itself after one second, so the worker takes control of the page.

HTML
<script>
  navigator.serviceWorker.register('swredirect.js');
  setTimeout(() => {
    location.reload();
  }, 1000);
</script>

The page registers swredirect.js and reloads itself after 1000 ms.

Step 2: answer every fetch with a redirect to a data: URL

The worker intercepts fetches and responds with a redirect whose target is a data: URL carrying HTML.

JavaScript
self.addEventListener('fetch', function(event) {
    event.respondWith(Response.redirect('data:text/html,<script>prompt("Test")</script>'));
});

Response.redirect builds a redirect response pointing at the data:text/html,... URL. The HTML in the URL is a script that calls prompt("Test").

Step 3: open the worker's HTTP URL

With the worker active, doing open() to the HTTP URL of the service worker produces a redirect to a top-level data: URL. The report says this produces a redirect to a top-level data: URL.

Step 4: observe the inheritance and the CSP leak

The report states that this navigation inherits from the opener, as shown for the origin in the protocol confirmation dialog, and that it also leaks the victim's CSP. The following snippet is given as the way to observe CSP violations, including the leak:

JavaScript
const observer = new ReportingObserver(
  (reports, observer) => {
    reports.forEach((violation) => {
      console.log(violation);
      console.log(JSON.stringify(violation));
    });
  },
  {
    types: ["csp-violation"],
    buffered: true,
  },
);

observer.observe();

A ReportingObserver subscribed to csp-violation with buffered: true collects CSP violation reports, including ones generated before the observer was created. The report notes that the CSP leak includes nonce values. Abusing the leak requires complying with the victim's CSP, which limits it, but a data: URL allows custom HTML, and that is a larger attack surface than the leak alone.

Root cause

Service workers are allowed to redirect to data: URLs. A service worker redirect to a data: URL is followed, and the data document becomes the top-level page. Because that page inherits from the opener, it also exposes the opener's origin in the protocol confirmation dialog and leaks the victim's CSP, nonces included. The report does not describe the code path that skips the check, so the precise mechanism is not stated.

Impact

An attacker who controls a service worker can turn a navigation to the worker's HTTP URL into a top-level data: document. That document can contain arbitrary HTML and script, which the report calls a larger attack surface than the CSP leak on its own. The navigation inherits from the opener, so the origin shows in the protocol confirmation dialog, and the victim's CSP is leaked, including nonce values. Exploiting the CSP leak requires the attacker's content to comply with the victim's CSP, which the report presents as a constraint. The report does not set out a full attack chain beyond these points.

Fix

The report does not say what change was made. The summary states the problem plainly: service workers allowing redirects to data: URLs.

Variants to test

  1. Redirect to other schemes. Have the worker respond with Response.redirect to schemes other than data: and open the worker's HTTP URL. A positive result is a top-level document in a scheme that is normally blocked for top-level navigation.
  2. Redirect from a different request type. Trigger the worker's fetch handler with navigations other than open(), such as a link click or a form submission to the worker URL. A positive result is the same top-level data: landing.
  3. Check opener inheritance. After the redirect, inspect what the new document can see of the opener, including the origin shown in the protocol confirmation dialog. A positive result is inherited opener state in the data document.
  4. Check the CSP leak. Run the ReportingObserver snippet in the context that ends up on the data: URL and look for csp-violation reports, including nonce values. A positive result is violation reports from the victim's policy appearing in the attacker-controlled document.

Hunting notes

This kind of bug hides where a component is allowed to synthesise responses or redirects that the browser would otherwise refuse for a top-level navigation: service workers, and by extension anything that can call respondWith or return a redirect. During recon, look for pages that register service workers and for worker scripts whose fetch handlers return redirects. The signal is a navigation that ends on a URL scheme the browser normally blocks at top level. The report notes the navigation inherits from the opener and leaks the victim's CSP, including nonce values.

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. 10 min read.

What happened, in plain words

A page in Chrome can install a small background helper called a service worker. That helper sits between the page and the network: every time the page asks for something, the helper gets a chance to answer instead. The researcher found that this helper could answer with a redirect pointing at a data: URL, and that when the helper's own web address was opened in a new tab, Chrome followed the redirect and showed the data: page as the main page of that tab.

That matters because browsers normally refuse to let a data: URL become the main page of a tab. The report points to an old Mozilla blog post about Firefox 59 blocking exactly that kind of navigation as the reference for the rule. Here the rule was skipped.

Two extra things made it worse. The new page inherited things from the page that opened it (the opener), which the report says is visible for the origin in the protocol confirmation dialog. And the new page leaked the victim's CSP, the security policy that says which scripts a site is allowed to run.

The report was split off from an earlier Chromium tracker entry, and someone provided a hosted proof of concept at https://crbug40064165.glitch.me/. It was filed under the Chrome VRP as an inappropriate implementation in Extensions, rated medium, with a bounty of 4000.00 USD, disclosed on 2025-09-02.

The pieces you need to know

Before the steps make sense, here are the ideas they rely on, from zero.

  • Browser extension: a small add-on installed into Chrome that adds features to the browser. Extensions can run their own background code.
  • Service worker: a script the browser keeps running in the background for a page or an extension. It can act like a receptionist for network requests: when the page asks for a file, the worker can hand back a stored copy, fetch it, or answer with something else entirely.
  • fetch event: the moment a request is about to go out. The worker listens for this event so it can step in.
  • respondWith: the call a worker uses to say "here is my answer instead of the normal one". The answer can be a real file, an error, or a redirect.
  • Redirect: an instruction that says "not here, go to this other address instead". Like a forwarding note on a letter.
  • data: URL: a way of putting a whole document inside the address itself, rather than pointing at a server. data:text/html,... means "the text after the comma is an HTML page". Because the page travels inside the link, anyone who can write the link can write the page.
  • Top-level navigation: the page that fills the whole tab, the one whose address you see in the address bar. A page loaded inside a frame is not top-level.
  • open(): the browser function that opens a URL in a new tab or window.
  • Opener: the page or script that opened the new tab. The new tab can sometimes see and be seen by it.
  • Origin: the combination of scheme, host and port that identifies where a page came from, for example https://example.com. Browsers use it to decide what one page is allowed to touch.
  • CSP (Content Security Policy): a set of rules a site sends to the browser saying which scripts, styles and other resources are allowed. It is a defence against injected code.
  • Nonce: a one-time random value that a site puts on a script tag and in its CSP so the browser knows that particular script is legitimate. If an attacker learns the nonce, they can make their own script look legitimate.
  • ReportingObserver: a browser feature that lets a page collect reports about things the browser noticed, such as CSP violations.

Setting up

The report does not describe any accounts, roles or tool versions. To reproduce it you need a page that registers a service worker, the worker script itself, and a way to open the worker's HTTP address as a new top-level page. The two files below are the whole proof of concept given in the report.

Finding it

A service worker's fetch handler can return a redirect to a data: URL, and when the HTTP URL of the worker is opened, the browser follows that redirect and lands on a top-level data: URL. That contradicts the general rule that top-level navigations to data: URLs are blocked.

Two further observations made it more than a curiosity. The navigation inherits from the opener, which the report says is visible for the origin in the protocol confirmation dialog. And the resulting document leaks the victim's CSP.

Step by step

Step 1: register the worker and reload the page

The first file is the page itself. It installs the worker and then reloads, so that the worker is in charge of what the page loads next.

HTML
<script>
  navigator.serviceWorker.register('swredirect.js');
  setTimeout(() => {
    location.reload();
  }, 1000);
</script>

Line by line:

  1. navigator.serviceWorker.register('swredirect.js'); asks the browser to install the script swredirect.js as a service worker for this page.
  2. setTimeout(() => { ... }, 1000); schedules the code inside the braces to run after 1000 milliseconds, which is one second.
  3. location.reload(); tells the browser to load the current page again.

The page reloads itself after one second.

Step 2: answer every request with a redirect to a data: URL

The second file is the worker. It listens for requests and replies to each one with a redirect whose destination is a data: URL containing HTML.

JavaScript
self.addEventListener('fetch', function(event) {
    event.respondWith(Response.redirect('data:text/html,<script>prompt("Test")</script>'));
});

Line by line:

  1. self.addEventListener('fetch', function(event) { ... }); tells the worker: every time a request is about to happen, run this function and give it the details of the request in event.
  2. Response.redirect('data:text/html,<script>prompt("Test")</script>') builds a redirect answer. The destination is a data: URL whose content is an HTML page containing a script.
  3. The script inside that page is prompt("Test"), which opens a small dialog box with the word Test.
  4. event.respondWith(...) hands that redirect back to the browser as the answer to the request, instead of letting the request go to the network.

Step 3: open the worker's HTTP URL

With the worker active, doing open() to the HTTP URL of the service worker produces a redirect to a top-level data: URL. The report says this produces a redirect to a top-level data: URL.

In plain terms: you ask the browser to open the worker's own web address in a new tab. The browser asks the worker for that address. The worker answers with a redirect to the data: URL. The browser follows it, and the tab ends up showing the HTML that was written inside the address, with the dialog box appearing.

Step 4: watch the inheritance and the CSP leak

The report states that this navigation inherits from the opener, as shown for the origin in the protocol confirmation dialog, and that it also leaks the victim's CSP. The snippet below is given as the way to observe CSP violations, including the leak.

JavaScript
const observer = new ReportingObserver(
  (reports, observer) => {
    reports.forEach((violation) => {
      console.log(violation);
      console.log(JSON.stringify(violation));
    });
  },
  {
    types: ["csp-violation"],
    buffered: true,
  },
);

observer.observe();

Line by line:

  1. new ReportingObserver(...) creates an observer, an object whose job is to collect reports the browser produces.
  2. The first argument is a function that runs whenever reports arrive. It receives them in reports.
  3. reports.forEach((violation) => { ... }) goes through each report one at a time.
  4. console.log(violation); prints the report object to the browser's developer console.
  5. console.log(JSON.stringify(violation)); prints the same report as JSON text, which is easier to read and copy.
  6. types: ["csp-violation"] says only collect reports about CSP violations, meaning times when something on the page broke the site's security policy.
  7. buffered: true asks for reports that were generated before the observer was created, not only new ones.
  8. observer.observe(); switches the observer on.

The report notes that the CSP leak includes nonce values. Abusing the leak requires complying with the victim's CSP, which limits it, but a data: URL allows custom HTML, and that is a larger attack surface than the leak alone.

Why it happens

Service workers are allowed to redirect to data: URLs. A service worker redirect to a data: URL is followed, and the data: document becomes the top-level page. Because that page inherits from the opener, it also exposes the opener's origin in the protocol confirmation dialog and leaks the victim's CSP, nonces included. The report does not describe the code path that skips the check, so the precise mechanism is not stated.

What an attacker could do with it

An attacker who controls a service worker can turn a navigation to the worker's HTTP URL into a top-level data: document. That document can contain arbitrary HTML and script, which the report calls a larger attack surface than the CSP leak on its own. The navigation inherits from the opener, so the origin shows in the protocol confirmation dialog, and the victim's CSP is leaked, including nonce values. Exploiting the CSP leak requires the attacker's content to comply with the victim's CSP, which the report presents as a constraint. The report does not set out a full attack chain beyond these points.

The fix

The summary states the problem plainly: service workers allowing redirects to data: URLs.

Things worth trying

  1. Redirect to other schemes. Have the worker respond with Response.redirect to schemes other than data: and open the worker's HTTP URL. A positive result is a top-level document in a scheme that is normally blocked for top-level navigation.
  2. Redirect from a different request type. Trigger the worker's fetch handler with navigations other than open(), such as a link click or a form submission to the worker URL. A positive result is the same top-level data: landing.
  3. Check opener inheritance. After the redirect, inspect what the new document can see of the opener, including the origin shown in the protocol confirmation dialog. A positive result is inherited opener state in the data: document.
  4. Check the CSP leak. Run the ReportingObserver snippet in the context that ends up on the data: URL and look for csp-violation reports, including nonce values. A positive result is violation reports from the victim's policy appearing in the attacker-controlled document.

Where to look for similar bugs

This kind of bug hides where a component is allowed to synthesise responses or redirects that the browser would otherwise refuse for a top-level navigation: service workers, and by extension anything that can call respondWith or return a redirect. During recon, look for pages that register service workers and for worker scripts whose fetch handlers return redirects. The signal is a navigation that ends on a URL scheme the browser normally blocks at top level. The report notes the navigation inherits from the opener and leaks the victim's CSP, including nonce values.

Glossary

  • Browser extension: an add-on installed into a browser that adds features and can run its own background code.
  • Service worker: a background script the browser keeps running for a page or extension, able to intercept and answer network requests.
  • fetch event: the event fired when a request is about to be made, which a service worker can listen for.
  • respondWith: the call a service worker uses to supply its own answer to a request instead of the normal one.
  • Redirect: an instruction telling the browser to go to a different address instead.
  • data: URL: an address that carries a whole document inside itself rather than pointing at a server.
  • Top-level navigation: a page loaded as the main page of a tab, the one shown in the address bar.
  • Opener: the page or script that opened a new tab or window.
  • Origin: the scheme, host and port that identify where a page came from.
  • CSP (Content Security Policy): rules a site sends to the browser saying which scripts and resources are allowed.
  • Nonce: a one-time random value used to mark a particular script as legitimate under a CSP.
  • ReportingObserver: a browser feature that collects reports about things the browser noticed, such as CSP violations.
  • CSP violation: an event recorded when something on a page breaks the site's Content Security Policy.
  • Attack surface: the total set of ways an attacker could try to get in or do damage.
  • Chrome VRP: Chrome's Vulnerability Reward Program, which pays researchers for reporting security bugs.
  • CVE: a public identifier given to a known security vulnerability.
  • Proof of concept (PoC): a small demonstration that shows a bug is real.
  • Regression: a bug that appears in something that used to work correctly.

More by NDevTK

View all

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

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.