Skip to content
Access control Disclosed report Intermediate

URL Spoof / Brave Shield Bypass

Brave's shield settings were applied based on a hostname parsed with Node's legacy url.parse, which treats a backtick-encoded hostname as part of the path, while the renderer loads the actual domain. An attacker could spoof a whitelisted domain to keep shields disabled or enable Flash.

Matt Austin Follow

Originally disclosed on HackerOne

  • Triaged in 6 days
  • Fixed in 7 days
  • Paid in 6 days
  • Disclosed after 29 days

Summary:

Improper URL parsing in Brave allows an attacker to spoof the hostname shield settings are applied to.

POC:

https://youtu.be/yz99T_Trfuc

Products affected:

  • Brave (browser-laptop) 0.18.14 rev ad92d02

Steps To Reproduce:

  1. Browse to http://brave.com
  2. Click on the Shield icon and toggle the shield from "up" to "down"
  3. Browse to http://brave.com%60x.code-fu.org/ and notice the shield is down for this domain as well.

I believe this could be used enable flash by spoofing one of the "whitelisted" domains.

The renderer will load the code-fu.org domain, however I believe when the URL is later parsed in node it uses (non standards compliant?) url.parse. This leads to some confusion:

JavaScript
> url.parse('http://brave.com%60x.code-fu.org/')
Url {
  href: 'http://brave.com/%60x.code-fu.org/'
  protocol: 'http:',
  host: 'brave.com',
  hostname: 'brave.com',
  pathname: '%60x.code-fu.org/',
  path: '%60x.code-fu.org/',
}

vs

JavaScript
> new url.URL('http://brave.com%60x.code-fu.org/')
URL {
  href: 'http://brave.com`x.code-fu.org/',
  protocol: 'http:',
  host: 'brave.com`x.code-fu.org',
  hostname: 'brave.com`x.code-fu.org',
  pathname: '/',
}

Node now (7+) supports the the WHATWG through the url.URL . This seems to be the same / compatible with the way the render / chrome parses the URL.

Attachments

Screenshot_2017-08-02_20.32.28.png
Screenshot_2017-08-02_20.32.28.png From the original on HackerOne

The original report as published on HackerOne, by mattaustin. 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 the shield settings used Node's legacy url.parse, which does not follow the same hostname parsing rules as the browser renderer, causing a mismatch.

Impact

An attacker could make a malicious site inherit shield settings from a whitelisted domain, potentially keeping shields off or enabling Flash.

What the attacker needed

Victim visits a crafted link; target domain is whitelisted for shields

The fix

Using a standards-compliant parser such as the WHATWG URL API would make shield settings and the renderer agree on the hostname.

How it was found

  1. Browse to brave.com
  2. Toggle the shield from up to down for that site
  3. Browse to a crafted address that begins with brave.com but resolves to a different domain
  4. Observe the shield remains down for the different domain

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.

A browser has to decide which website it is on to apply settings like ad blocking. Brave used one method to read the address and the page renderer used another, so they disagreed about the site name. This let a crafted address look like a trusted site to the settings code while actually loading a different site.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by Matt Austin

View all

7 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.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.