CSP violation information contains URL of redirect started from client-side code
A CSP violation event exposed the full URL of a redirect initiated by client-side code, including query parameters. An attacker who can trigger such a violation could learn sensitive information from the redirect URL.
Originally disclosed on Mozilla
- Fixed in 22 months
- Paid in 23 months
- Disclosed after 22 months
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0
Steps to reproduce:
1. Navigate to https://l0.cm/fx_csp_violation_leak.html . This page has the following CSP and CSP violation event listener:
'''html
<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' vulnerabledoma.in">
'''
'''js
document.addEventListener('securitypolicyviolation', e => {
console.dir(e);
alert(e.blockedURI);
});
'''
In addition, there are three buttons to embed other origin's pages into an iframe. These buttons are for testing the following cases.
TEST 1: Navigate to domain not allowed by CSP via 302 redirect
TEST 2: Navigate to domain not allowed by CSP via JavaScript
TEST 3: Navigate to domain not allowed by CSP via link
2. Click on the "TEST 1" button. "https://vulnerabledoma.in/fx_csp_violation_leak_302.php" is popped up. (= Safe. I think this behavior comes from a fix of bug 1069762 )
3. Click on the "TEST 2" button. "https://www.vulnerabledoma.in/path?query" is popped up. (= leak of redirect URL )
4. Click on the "TEST 3" button and then click on the displayed link. "https://www.vulnerabledoma.in/path?query" is popped up. (= leak of redirect URL )
For your information, also the behavior of "TEST 1" is different from other browsers. Other browsers return "https://www.vulnerabledoma.in".
Actual results:
The CSP violation event object ( and CSP violation report ) contains the full redirect URL if the violation happens via a client-side navigation.
Expected results:
The CSP violation event object ( and CSP violation report ) should not contain the full redirect URL in the case of navigation started from a client-side code also. This is because the redirect URL might have sensitive information.
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
Impact
The full redirect URL, which may contain sensitive information, could be exposed to scripts that read the CSP violation event or report.
What the attacker needed
Victim uses Firefox; attacker can run script on the page; page has a CSP that blocks a redirect
The fix
The browser should not include the full redirect URL in CSP violation events for client-side navigations.
How it was found
- Open the test page that sets a CSP and listens for violation events.
- Click the button that navigates via a 302 redirect; the blocked URI is only the origin.
- Click the button that navigates via JavaScript; the blocked URI is the full redirect URL.
- Click the button that navigates via a link; the blocked URI is the full redirect URL.
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.
Content Security Policy (CSP) is a browser rule that blocks certain page actions, like loading scripts from unapproved sites. When a rule is broken, the browser fires an event that can be read by JavaScript. This report shows that the event included the full address of a redirect, which might contain private data like tokens.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.