Skip to content
XSS Disclosed report Intermediate

New XSS vector in ReaderMode with %READER-TITLE-NONCE%

The ReaderMode HTML template inserts the page's author meta tag without escaping, and a relaxed CSP allows scripts with a nonce placeholder. An attacker can inject a script that executes in the ReaderMode origin, potentially stealing other ReaderMode pages and accessing privileged pages via the uuidkey.

nishimunea Follow

Originally disclosed on HackerOne

Critical 9.5 View original
  • Disclosed after 18 months

Summary:

Previously, script execution in ReaderMode pages was prohibited by CSP. However, three months ago, this commit partially relaxed the CSP and scripts with nonce-%READER-TITLE-NONCE% are now allowed to be executed. This relaxation of the CSP rule can be exploited for XSS attacks on ReaderMode pages.

Here, the attack vector is %READER-CREDITS% which is also included in the ReaderMode HTML template. The %READER-CREDITS% is replaced with the value of the <meta name="author"> tag in the original page, but then the HTML tags are not escaped. So, when the following meta tag is embedded in the original page and the page is displayed in ReaderMode, this Swift code replaces %READER-TITLE-NONCE% with the correct nonce value.

<meta name="author" content="Evil &lt;script nonce=%READER-TITLE-NONCE%&gt;alert(document.location);&lt;/script&gt;!--">

As a result, the malicious script will be executed on a page http://localhost:6571/reader-mode?uri={uri}&uuidkey={value}. In Brave, all readalized pages are hosted on http://localhost:6571. Therefore, through this XSS, any cross-origin pages, that has been converted to ReaderMode, can be stolen by embedding an iframe and reading out them. Also, please find that the uuidkey is included in the URL query string. By obtaining this key, the attacker can gain access to Brave's privileged pages.

Products affected:

  • Brave iOS 1.31.1 and higher (including the latest Nightly)

Steps To Reproduce:

Supporting Material/References:

  • See the screenshot of the alert dialog when the bug is reproduced.

Impact

  • Any cross-origin pages, that has been converted to ReaderMode, can be stolen
  • Attacker can gain access to Brave's privileged pages

Attachments

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

Root cause

The author meta tag value is inserted into the ReaderMode HTML without escaping, and the CSP allows scripts with a nonce that is also inserted into the same template.

Impact

Any cross-origin page converted to ReaderMode could be stolen, and the attacker may gain access to Brave's privileged pages by obtaining the uuidkey.

What the attacker needed

Victim visits a malicious page; victim activates ReaderMode

How it was found

  1. Open the provided test page that contains a malicious author meta tag.
  2. Activate ReaderMode using the button in the address bar.
  3. Observe the alert dialog showing script execution.

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.

ReaderMode is a feature that shows a simplified version of a web page. The app builds this simplified page by inserting parts of the original page, like the author name, without cleaning them first. Because the app also allows scripts that carry a special secret code, an attacker can sneak in a script that runs as if it were part of the app, letting them read other pages or access private areas.

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.