SAR 2,629 For Stored XSS via svg Image Leading to ATO
The application accepted SVG files as profile pictures and served them from the same origin as the main site, so an SVG containing a script executed when viewed. The script could read the authentication token from localStorage and send it to an attacker, leading to account takeover.
medium.com
Published on medium.com
In this write-up, I want to share an interesting finding: a Stored Cross-Site Scripting (XSS) vulnerability hidden inside a profile picture upload feature.
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 upload feature did not sanitise SVG files and served them from the same origin without a strict Content Security Policy, allowing embedded scripts to run.
Impact
An attacker could steal the authentication token and take over the account without a password, view personal information, and perform actions as the victim.
What the attacker needed
A free account; victim views the uploaded SVG
How it was found
- Log in and go to the Account Details page.
- Create an SVG file containing a script that reads the token from localStorage and sends it to a listener.
- Upload the SVG as a profile picture; the application accepts it.
- Open the uploaded image in a new tab, which causes the script to run and the token to be sent.
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 profile picture upload let people upload SVG files, which are images that can contain code. Because the image was shown from the same website address as the main app, that code could run and read the login token kept in the browser. The attacker could then use that token to log in as the victim.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.