Skip to content
XSS Write-up Intermediate

Xiaomi Execute Arbitrary JavaScript

The Xiaomi Browser's read mode failed to sanitise HTML taken from a page's title tag, so a crafted page could inject an iframe and run arbitrary JavaScript. An attacker could execute script in the browser's read mode context when the victim opened a malicious page and enabled read mode.

Neil Mark Ochea Follow

Published on nmochea.medium.com

Due to lack of HTML Sanitization, It’s possible to Inject Malicious Iframe tag in Readmode and Execute Arbitrary JavaScript code.

Neil Mark Ochea / mhl_0xnmo, on nmochea.medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the title value was passed into the read-mode HTML without going through the sanitiser that other content used.

Impact

An attacker could run arbitrary JavaScript in the browser's read-mode context once the victim opened a crafted page and enabled read mode.

What the attacker needed

Victim opens a crafted page; victim enables read mode

The fix

The vulnerability was fixed according to the disclosure timeline.

How it was found

  1. Create a local HTML file containing the malicious iframe markup.
  2. Create a second page that sets the title to that markup and loads the first file.
  3. Serve both files from a local web server.
  4. Open the second page in the browser and turn on read mode.
  5. The script from the iframe runs as soon as read mode is enabled.

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 write-up has not been written yet. The Original tab links to the source.

Read mode is a browser feature that strips a web page down to just its article text. The browser took the page's title and inserted it into the read-mode page without cleaning it first, so hidden markup in the title could create an iframe that loads attacker script. That means a page you visit could run code inside the browser's own read-mode screen.

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 Neil Mark Ochea

View all

7 more disclosed reports, best first.

More from Xiaomi

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.