How i found a RXSS by webpack
A document-viewing page took a file URL from the query string and, on mobile devices only, inserted a derived filename into the page using innerHTML. An attacker could craft a link so that a filename containing HTML markup executed script in the victim's browser.
Hey hunters, I’m new here and this is my first vulnerability, even though it has no bounty.
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 application inserted a user-controlled filename into the DOM via innerHTML instead of using textContent or proper escaping.
Impact
An attacker could run script in a victim's session on the document-viewing page, but only when the victim uses a mobile device and opens the crafted link.
What the attacker needed
Victim opens a crafted link; victim uses a mobile device; attacker can host or reference a file URL
How it was found
- Upload a picture and observe the returned document-viewing link with a fileUrl parameter.
- Notice that a non-existent file causes the filename to be displayed on the page.
- Review the leaked webpack source and find where innerHTML is used.
- Switch the browser to a mobile user agent, since the innerHTML path only runs on mobile.
- Open a crafted fileUrl whose filename contains an image tag with an error handler and observe 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 write-up has not been written yet. The Original tab links to the source.
A web page can build its content in two ways: safely as plain text, or by treating a string as HTML code. Here the page took part of a link (the filename) and treated it as HTML, so any tags inside it became real page elements. Because an image tag with an error handler runs script when the image fails to load, the attacker's link ran code in the visitor's browser.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.