XSS Via SVG File Upload
A read-only user could upload an SVG file containing a script, and the application stored it and returned its path. When the path was visited, the script executed in the browser, allowing cookie theft.
Published on abhishekgk.medium.com
Hello and welcome to my latest Medium writeup! I’m thrilled to share my thoughts and insights with you today on How I found a XSS Bug using file upload.
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 allowed SVG uploads without sanitising or blocking embedded scripts, and served the uploaded file from a location where scripts execute.
Impact
An attacker could execute JavaScript in a victim's browser and steal their cookies, though Cloudflare blocked many other attempts.
What the attacker needed
A free account; victim visits the uploaded file URL
How it was found
- Register and invite a read-only user, then activate the account.
- Intercept the response from /api/v1/me and use Burp Match and Replace to change false values to true.
- Reload the browser to see the Admin tab appear for the read-only user.
- Upload an SVG file containing a script; the response returns the uploaded file path.
- Navigate to the returned path to trigger 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.
The site let a low-privilege user upload an image file. The site accepted a special image format called SVG that can contain code. When someone opened the uploaded file, that code ran in their browser, which could let an attacker steal their login cookies.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.