Skip to content
XSS Write-up Beginner

Exploiting XSS via Markdown on Xiaomi

The Xiaomi Forum comment section allowed users to post Markdown that was converted to HTML without proper sanitisation. An attacker could inject an event handler attribute into an image tag, leading to stored cross-site scripting when a victim hovered over the image.

N45HT Follow

Published on n45ht.or.id

Bahasa Indonesia | English

N45HT, on n45ht.or.id

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 Markdown-to-HTML converter did not sanitise user-supplied attributes, allowing event handlers to be injected.

Impact

An attacker could execute arbitrary JavaScript in the context of the forum when a victim hovers over a crafted image, potentially leading to actions such as redirection or data theft.

What the attacker needed

Ability to post comments on Xiaomi Forum; victim hovers over the image

How it was found

  1. Post an image using Markdown image syntax in a comment.
  2. Observe the server converts it to an HTML image tag.
  3. Try adding a double quote after the image URL to break out of the attribute.
  4. Notice the server encodes the double quote to %22.
  5. Use mixed case in the event handler name to bypass filtering.
  6. Craft a payload that sets an onmouseover event to redirect to another site.

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.

Markdown is a simple way to format text that gets turned into web page code. The forum let people post Markdown, but it did not clean up the resulting HTML properly. This meant someone could sneak in a small piece of JavaScript that runs when another user interacts with the post, which is called cross-site scripting (XSS).

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 N45HT

View all

5 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.