Chaining Misconfigurations: From File Uploads to Account Takeover
The application forwarded S3 response headers to the client without validation, allowing an attacker to change the Content-Disposition header from attachment to inline. This enabled a stored XSS via an uploaded SVG, which was then chained with an exposed JSONP endpoint to achieve account takeover.
Published on alvandyhamed.medium.com
I’ve been diving into the security of a web application recently, and what started as a routine look at its file upload flow turned into a full exploitation chain that ended with Account Takeover (ATO).
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 execute stored XSS and, by chaining with a JSONP endpoint, achieve account takeover.
What the attacker needed
Ability to upload files; victim views uploaded file; exposed JSONP endpoint
The fix
The application should validate and sanitise all headers received from S3 before forwarding them to the client, and avoid passing through untrusted headers.
How it was found
- Upload an SVG file through the application's file upload flow.
- Observe that the server sets Content-Disposition: attachment, forcing a download.
- Manipulate the S3 response headers to change Content-Disposition to inline.
- The uploaded SVG renders inline in the victim's browser, executing embedded JavaScript.
- Use the stored XSS to abuse an exposed JSONP endpoint and steal sensitive data, leading to 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.
When you upload a file, the server often tells your browser whether to show it or download it using a header called Content-Disposition. Here, the server copied that header from a storage service without checking it, so an attacker could change it to make the browser display a malicious file. That file contained JavaScript, which ran in the victim's browser and let the attacker steal data.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.