Skip to content
XSS Disclosed report Advanced

Universal XSS through FIDO U2F register from subframe

Brave's FIDO U2F implementation allowed a cross-origin subframe to call u2f.register() via postMessage, and the version parameter was embedded unescaped into evaluateJavaScript. This let a malicious subframe inject arbitrary JavaScript into the top frame's origin.

nishimunea Follow

Originally disclosed on HackerOne

High 7.4 View original
  • Disclosed after 2.7 years

Summary:

There are three weaknesses in Brave's FIDO U2F implementation.

  • u2f.register() can be executed from cross-origin subframe by invoking U2F.postMessage directly
  • Then, FIDO related modals show the name of top frame origin (but not caller subframe)
  • The version parameter sent from the above postMessage is embedded in an evaluateJavaScript without escape

The combination of these weaknesses allows cross-domain subframe to inject any JavaScript code to the top frame through fake U2F registration process.

Products affected:

  • Brave iOS Version 1.20 (20.09.11.20), also current Nightly

Steps To Reproduce:

  • Open UXSS Victim hosted on alice.csrf.jp. This site has a cross-origin iframe that opens evil.csrf.jp.
  • Ready to Scan dialog is shown with the name of top frame
  • Insert your FIDO device such as YubiKey 5Ci and touch
  • Injected JavaScript alert() is executed on the top frame

Supporting Material/References:

  • See attached movie file for the demonstration

Impact

As written in summary, malicious web content in subframe can UXSS on the top frame origin.

Attachments

uxss_through_u2f.mp4 From the original on HackerOne

The original report as published on HackerOne, by nishimunea. 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

Impact

A malicious subframe could run arbitrary JavaScript in the top frame's origin, leading to universal XSS.

What the attacker needed

Victim uses Brave iOS; victim visits a page with attacker iframe; victim has a FIDO device and touches it

How it was found

  1. Open a victim page that contains a cross-origin iframe pointing to an attacker-controlled site.
  2. The attacker subframe calls u2f.register() via postMessage.
  3. A Ready to Scan dialog appears showing the top frame's origin.
  4. The user inserts a FIDO device and touches it.
  5. The injected JavaScript alert() runs on the top frame.

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 website can contain a hidden frame from another site. In Brave, that frame could trick the browser into running harmful code in the main page, as if the main site had done it. This is called universal cross-site scripting (UXSS) because it breaks the security boundary between sites.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More by nishimunea

View all

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

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.