Inappropriate implementation in Network (CVE-2024-3845)
A service worker could intercept fetch requests and bypass the Private Network Access (PNA) preflight and user confirmation, as well as the Mixed Content policy, allowing a page to send requests to private network hosts without the expected checks. An attacker could use this to reach internal services that should have been protected by these browser policies.
Originally disclosed on Chrome VRP
- Fix shipped in 2 months
Steps to reproduce the problem
- Enable Permission Prompt for Private Network Access experiment in about:flags or use an origin with active Origin Trial PrivateNetworkAccessPermissionPrompt
- Install a Service Worker on a secure origin with the following code:
const request = event.request;
if (!request.url.startsWith(location.origin)) {
// Skip cross origin requests
return false;
}
event.respondWith(fetch(request));
});
- Send a PNA enabled request from the application context, e.g.
fetch('http://privatehost.local', { targetAddressSpace: 'private' })
I've put together a minimal repro at the following URL: https://www.danielbaulig.de/pna-sw-bug/ Since the origin is not part of the Origin Trial, the experiment flag will need to be enabled.
Problem Description
Expected behavior: A PNA preflight request should be sent to the privatehost.local host and the actual request should only be sent upon successful response and user confirmation. With PNA Permission Prompt experiment disabled the UA will prevent the request due to the Mixed Content policy.
Actual behavior: No PNA preflight request is sent and no user confirmation prompted. The Mixed Content policy will also not prevent the request from being sent. The UA will send the request as instructed by the application, circumventing both the Mixed Content policy and PNA Permission Dialog.
More details relating to the bug can be found in https://github.com/WICG/private-network-access/issues/126#issue-2104329281
Summary
Security: Application can actively circumvent Mixed Content policy in PNA origin trial
Custom Questions
Which component does this fall under?
Not sure - I don't know
Does this work in other browsers?
Yes - This is just a Chrome problem
Additional Data
Category: API
Chrome Channel: Stable
Regression: N/A
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 service worker's fetch handler was not subject to the same PNA and Mixed Content checks as normal page fetches, so requests it made were sent without preflight or user confirmation.
Impact
An application could bypass the Mixed Content policy and the PNA permission prompt, potentially allowing requests to private network hosts without user consent.
What the attacker needed
Chrome browser; PNA permission prompt experiment enabled; Secure origin to host service worker
How it was found
- Enable the Permission Prompt for Private Network Access experiment in the browser flags or use an origin with the Origin Trial enabled.
- Install a service worker on a secure origin that intercepts fetch events and forwards same-origin requests.
- From the page, send a fetch request to a private network host with the target address space set to private.
- Observe that no PNA preflight or user confirmation occurs and the request is sent despite Mixed Content policy.
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.
Websites are not supposed to be able to silently talk to devices on your local network or internal company network. Browsers have rules like Private Network Access (which asks the user before allowing such requests) and Mixed Content (which blocks insecure requests from secure pages). This report shows a way to get around both rules using a service worker, a script that runs in the background for a website.
What is CORS?
A permissive cross-origin policy lets another site read responses with the user's credentials.