Path traversal on chrome:// URLs
Firefox's legacy extension system allowed loading non-contentaccessible resources from web pages by using a crafted chrome:// URL with a double slash. An attacker could bypass CSP strict-dynamic and load internal scripts.
Originally disclosed on Mozilla
- Fixed in 7 days
- Paid in 2 months
- Disclosed after 7 days
Created attachment 8945158
csp_bypass_require_chromeurl.html
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0
Build ID: 20180122220231
Steps to reproduce:
This bug exists in Firefox's legacy extension system. The legacy extension is still used in the browser internally.
Usually, only if the extension's resources are defined on `chrome.manifest` and it has a `contentaccessible=yes` flag, the defined resources can be loaded from web pages via <script> tag or other tags. However, by using crafted path string, even non-contentaccessible resources can be loaded from web pages. Due to this bug, as I described in bug 1432358, it causes an universal bypass of CSP strict-dynamic via chrome:// URL. I attached PoC again.
Steps to Reproduce:
1. See `chrome.manifest` file of browser internal resources from the following URL (in case of Windows):
jar:file:///C:/Program%20Files/Nightly/browser/omni.ja!/chrome/chrome.manifest
2. Find this line:
content browser browser/content/browser/ contentaccessible=yes
This means that any web pages can load the resources placed on jar:file:///C:/Program%20Files/Nightly/browser/omni.ja!/chrome/browser/content/browser/* via chrome://browser/content/* URLs.
3. The resources placed on jar:file:///C:/Program%20Files/Nightly/browser/omni.ja!/chrome/devtools/* do not have a contentaccessible flag. So, usually it should not be loaded from web pages.
However, using the following crafted URL, it can be loaded from web pages:
(Please take notice to the two slashes of "content//chrome". )
chrome://browser/content//chrome/devtools/modules/devtools/client/jsonview/lib/require.js
It seems that the following path format causes this issue:
chrome:// [ACCESSIBLE_PATH] // [NON_ACCESSIBLE_PATH]
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 path parsing for chrome:// URLs did not properly normalise double slashes, allowing a path that starts with an accessible directory to reach a non-accessible one.
Impact
An attacker could bypass CSP strict-dynamic and load internal scripts, potentially leading to script execution on web pages.
What the attacker needed
Victim uses Firefox; attacker can host a web page
How it was found
- Open the chrome.manifest file of browser internal resources via a jar: URL.
- Find the line defining contentaccessible=yes for the browser content directory.
- Note that devtools resources lack the contentaccessible flag.
- Use a crafted chrome:// URL with a double slash to load a non-accessible devtools script from a web page.
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.
Firefox uses internal files (like scripts) that web pages normally cannot load. A security rule called CSP is meant to stop malicious scripts. The bug let a web page trick Firefox into loading those internal files, which could let an attacker run code that CSP would normally block.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.