CSP bypass in DevTools Network Tab Response Preview because `content-security-policy:` headers ignored
The DevTools Network tab's response preview does not enforce a Content-Security-Policy delivered via the HTTP header, although the same policy in a meta tag is honoured. An attacker who can inject HTML into a response could therefore cause the preview to load external resources and leak sensitive URL path information such as UUIDs.
Originally disclosed on Mozilla
- Fixed in 7 months
- Paid in 7 months
- Disclosed after 7 months
Created attachment 9426342
poc.py
CSP (Content Security Policy) is a crucial security feature set by web administrators to prevent information leakage from users. When clicking on a network request in the DevTools Network tab and viewing the response preview, it becomes evident that CSP is not enforced. This behavior does not occur with the <meta> tag.
I have attached poc.py. Upon inspecting the site, you can see that the CSP is set to default-src 'none';, and elements such as base, img, and iframe are prohibited. However, what happens when a user opens the response preview in the Network tab? CSP is immediately disabled, and a request for the content within the base tag is triggered.
This illustrates a case of HTML injection, where CSP fails to protect if sensitive information (such as UUIDs) is included in the URL path. In other words, the path gets leaked. Additionally, it demonstrates that content may be rendered incorrectly as well.
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 DevTools response preview renders the saved response body without applying the CSP header that accompanied the original response, while still honouring a meta-tag CSP embedded in the body.
Impact
An attacker who can inject HTML into a response could cause the DevTools preview to load external resources and leak sensitive information such as UUIDs present in the URL path, though this only affects developers viewing the preview.
What the attacker needed
Victim opens DevTools Network response preview; attacker can inject HTML into a response
How it was found
- Open a site whose response sets a restrictive CSP header and contains injectable HTML.
- Open the DevTools Network tab and select that network request.
- View the response preview and observe that the CSP is not enforced and a request for the base tag content is made.
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 Content-Security-Policy is a rule set a website sends to the browser to stop it loading things from untrusted places. This report says that when a developer looks at a saved response inside the browser's developer tools, those rules are ignored if they arrived as a header. That means injected HTML could make the preview fetch outside content and reveal parts of the URL.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.