Firefox leaks full redirect path via CSP violation reports
Firefox's CSP violation reports for redirects included the full path and query string instead of stripping them as the specification requires. A malicious site could use this to learn sensitive values such as OAuth codes or tokens embedded in redirect URLs.
Originally disclosed on Mozilla
- Fixed in 23 days
- Paid in 36 days
- Disclosed after 23 days
Created attachment 9197786
oauth-leak.png
Tested on: Firefox 84.0.2 (64 bits) (Windows)
In Firefox, Content Security Policy (CSP) violation reports triggered by a redirect did not remove path information as required by the CSP specification: https://www.w3.org/TR/CSP/#security-violation-reports
This potentially reveals information about the redirect that would not otherwise be known to the original site. This could be used by a malicious site to obtain sensitive information such as usernames or single-sign-on tokens encoded within the target URLs.
It looks like this is a recurring problem:
https://bugzilla.mozilla.org/show_bug.cgi?id=1208946
https://bugzilla.mozilla.org/show_bug.cgi?id=1069762
Steps to reproduce:
In a scenario where https://example-01.com performs a code 302 redirect to https://example-02.com/?secret=mysecret
1. The page https://attacker.com is served with the header "Content-Security-Policy: frame-src https://example-01.com; report-uri /report"
2. The page https://attacker.com attempts to iframe https://example-01.com
3. The full path of the redirect ( https://example-02.com/?secret=mysecret ) is leaked to the attacker through the violation report.
It's possible to leak the full path of chained redirects by iframing each leaked URL in a new page with a CSP frame-src directive that matches the domain of the leaked URL.
Through this bug it's possible to leak OAuth authorization codes and access tokens (image attached from a real case), thus getting access to the victim's resources.
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 browser failed to strip the path and query from the URL before including it in the CSP violation report for redirects.
Impact
This could leak OAuth authorization codes and access tokens, allowing an attacker to access the victim's resources.
What the attacker needed
Victim visits attacker-controlled page; target uses redirects with secrets in URL; Firefox browser
How it was found
- Serve a page with a CSP frame-src directive for the first site and a report-uri.
- Attempt to iframe the first site from the attacker page.
- The redirect to the second site is followed and its full URL appears in the violation report sent to the attacker.
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 website can tell the browser to send a report when it blocks something, such as loading another site in a frame. The rules say those reports must not include the full address of the blocked page, because it might contain secrets. Firefox broke that rule and included the full address, so a bad site could read secrets from the report.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.