From Image Upload to Account Takeover — Chaining Upload, St
An SVG file upload was rendered as HTML, allowing stored cross-site scripting. The attacker chained this with a script that forced the victim's browser to visit the profile page, where a JWT was stored in localStorage, then exfiltrated the token via an image request to take over the account.
While reviewing the application, I noticed a profile image upload functionality. I tested whether it accepted other file types like .svg or .html — and to my surprise, SVG uploads were accepted and rendered as-is.
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
Impact
An attacker could steal a victim's JWT and take over their account, though the exploit required the victim to view the uploaded SVG and the token was only present after visiting the profile page.
What the attacker needed
Ability to upload a profile image; victim views the uploaded SVG; victim has visited /profile to store JWT
The fix
The application should reject SVG uploads or sanitise them, and should store authentication tokens in HttpOnly cookies rather than localStorage.
How it was found
- Upload an SVG file containing script tags as a profile image.
- Open the uploaded file in the browser to confirm script execution.
- Create an HTML payload that loads the profile page in the background, waits, then reads the JWT from localStorage.
- Send the stolen token to an external server using an image tag to avoid CORS restrictions.
- Set the stolen token in localStorage and refresh to confirm account takeover.
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.
The site let people upload SVG image files and then showed them as web pages. Because SVG files can contain scripts, an attacker could upload a file that runs code in the browser of anyone who views it. That code then stole a login token and let the attacker 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.