HTML injection in title of reader view
Brave's reader mode fails to escape HTML tags in the page title, allowing an attacker to inject arbitrary HTML into the reader view. This can be used to display a fake login form that steals credentials or to exfiltrate the original page content via a form submission.
Originally disclosed on HackerOne
- Disclosed after 2.7 years
Summary:
Reader.html in Brave doesn't escape/trim HTML tags in %READER-TITLE%.
https://github.com/brave/brave-ios/blob/development/Client/Frontend/Reader/Reader.html#L17
This allows any page to inject malicious HTML code in reader-mode page through <title>{html code you want to inject}</title>.
Products affected:
Brave iOS Version 1.20 (20.09.11.20), also current Nightly
Steps To Reproduce:
- Open the following Google docs: https://docs.google.com/document/d/10kPw7PNOujlenF08i3jBgD4zqoG5148u8TRkoHj7io8/edit?usp=sharing
- Push reader-mode button shown in address bar.
- Malicious login form is rendered instead of the document
- Fill the form, then the user/password you filled are stolen to malicious website
Supporting Material/References:
- See attached movie file for the demonstration
Impact
Malicious web contents can inject HTML code and manipulate readerized page (hosted in localhost:65XX).
Also, if injected HTML code contains a string %READER-CONTENT%, it is replaced to the original page contents.
https://github.com/brave/brave-ios/blob/87af4cbf0474bafd13673690aeee0c11059fbba2/Client/Frontend/Reader/ReaderModeUtils.swift#L29
So, attacker can steal user's sensitive information contained in the original HTML page through <form><textarea>%READER-CONTENT%</textarea>.
When you open the following Google search link in reader-mode, you can reproduce the above scenario as well.
https://www.google.com/search?q=%3Cform%3E%3Ctextarea%20name%3D%22dom%22%3E%25READER-CONTENT%25%3C%2Ftextarea%3E%3Cinput%20type%3D%22submit%22%3E%3C%2Fform%3E
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
An attacker could steal user credentials via a fake login form and could also exfiltrate sensitive information from the original page by injecting a form that includes the page content placeholder.
What the attacker needed
Victim uses Brave on iOS; victim opens a malicious page; victim activates reader mode
How it was found
- Open the provided Google Docs link in Brave on iOS.
- Tap the reader-mode button in the address bar.
- Observe that a malicious login form is rendered instead of the document.
- Fill the form; the entered username and password are sent to a malicious website.
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.
Reader mode is a feature that strips away clutter from web pages. Brave's reader mode did not properly clean the page title, so a malicious page could include HTML code in its title. When a user opened that page in reader mode, the code ran and could show a fake login form or steal information from the page.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.