HexBrain

Brave Software · Report #991713

HTML injection in title of reader view

Validstatus
mediumseverity
30upvotes
22 Jun 2023disclosed

How it was found

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:

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

This report was disclosed publicly on HackerOne and belongs to its author and the program. See the original