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.
Originally disclosed on HackerOne
- 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
versionparameter sent from the abovepostMessageis 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
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
- Open a victim page that contains a cross-origin iframe pointing to an attacker-controlled site.
- The attacker subframe calls u2f.register() via postMessage.
- A Ready to Scan dialog appears showing the top frame's origin.
- The user inserts a FIDO device and touches it.
- 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.