Skip to content
Path traversal Disclosed report Advanced CVE-2018-5137

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.

Masato Kinugawa Follow

Originally disclosed on Mozilla

  • Fixed in 7 days
  • Paid in 2 months
  • Disclosed after 7 days
Text
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]

The original report as published on Mozilla's Bugzilla, by Masato Kinugawa. 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 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

  1. Open the chrome.manifest file of browser internal resources via a jar: URL.
  2. Find the line defining contentaccessible=yes for the browser content directory.
  3. Note that devtools resources lack the contentaccessible flag.
  4. 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.

More by Masato Kinugawa

View all

26 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.