Skip to content
XSS Write-up Intermediate

How i found XSS and chained it with CSRF

A user profile picture upload accepted an SVG file containing script, and the stored script executed when the image was opened directly in a new tab on a subdomain. The author then used the script to read the four cookies present on that subdomain and submitted them in a cross-site request to a GraphQL password-change endpoint, which succeeded.

alshormanmomen681 Follow

Published on medium.com

first i checked my personal account on the website and noticed that i can upload any image as my PFP

Alshormanmomen, on medium.com

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 accepted SVG files and served them from a domain without forcing a download or a safe content type, so the embedded script ran in the site's origin.

Impact

An attacker could run script in the subdomain's origin and use the victim's session cookies to change their password, leading to account takeover; the text does not say whether cookie flags or other defences limited this.

What the attacker needed

A free account; victim opens the uploaded image link; victim is logged in

How it was found

  1. Upload an SVG file containing script as the profile picture.
  2. Open the uploaded picture directly in a new tab to trigger the script.
  3. Inspect the cookies available on that subdomain.
  4. Start a password change and note which cookies the request needs.
  5. Build a cross-site request against the GraphQL password-change endpoint using those cookies.

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 someone store a file that browsers treat as a small web page, so code inside it runs when the file is opened on its own. The attacker then used that running code to act as the logged-in user and change their password without them knowing. This is dangerous because taking over an account only needs the victim to open a link.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.