Skip to content
Info disclosure Disclosed report Intermediate CVE-2024-6612

Developer tools leak CSP violations through DNS prefetching (links in devtools should have DNS prefetching disabled)

When a CSP violation occurs, the developer tools console creates a link to the violating resource, and the browser's default DNS prefetching for anchor tags causes a DNS request to be sent. An attacker who can inject CSS can use this to leak that a CSP violation happened, bypassing a 'default-src none' policy, but only if the victim has developer tools open.

ymarchand Follow

Originally disclosed on Mozilla

  • Fixed in 3 months
  • Paid in 3 months
  • Disclosed after 3 months
Text
Created attachment 9380278
poc.html

User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0

Steps to reproduce:
- Set up a DNS name server
- In the attached HTML file, update "example.org" to point to your DNS server
- Visit the attached HTML file

Actual result:
- A DNS request is sent out when the CSP violation is generated, leaking the violation

Expected result:
- No DNS prefetching in developer tools

Summary:
By default, <a> tags are prefetched upon loading into the DOM, this includes the developer tools. Upon a CSP violation a link is generated in the console tab of the developer tools, pointing to the violating resource. This causes a DNS prefetch, leaking that a CSP violation has happened. This can be used to bypass the "default-src none" directive in case of a CSS injection, as can be seen in the attached POC. It should be noted that we were only able to exploit this in a browser where the developer tools were open.

In addition to the user agent above, we also confirmed this vulnerability on a Windows machine.

The original report as published on Mozilla's Bugzilla, by ymarchand. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

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 developer tools console renders links to violating resources as normal anchor elements, and the browser's default DNS prefetching for anchors then resolves their hostnames.

Impact

An attacker who can inject CSS could bypass a 'default-src none' CSP and learn that a violation occurred, but only when the victim has developer tools open.

What the attacker needed

Victim has developer tools open; attacker can inject CSS; attacker controls a DNS server

The fix

Developer tools should disable DNS prefetching for links they generate.

How it was found

  1. Set up a DNS name server.
  2. In the attached HTML file, change the domain to point to that DNS server.
  3. Visit the HTML file in the browser.
  4. Observe a DNS request being sent when the CSP violation is generated.

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 use a security rule called CSP to stop the browser loading things from other places. This report found that when that rule blocks something, the browser's developer tools show a link to the blocked item, and the browser quietly looks up that link's domain name in the background. That lookup tells an attacker that the rule was triggered, which can reveal information even when the rule was meant to block all external contact.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.