Skip to content
XSS Write-up Advanced

From Self-XSS to Account Takeover

A self-XSS on the main application was escalated by chaining it with a blind XSS on a subdomain, allowing an attacker to set a session cookie with a specific path and trigger the XSS in a victim's session, leading to account takeover.

medium.com

Published on medium.com

Self-XSS is often dismissed as a low-risk vulnerability — something most bug bounty programs won’t even triage. But under the right circumstances, this seemingly minor issue can escalate to critical impact.

Mark Roy, 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 application failed to output-encode user input and also failed to validate uploaded file content, allowing two XSS vulnerabilities that could be chained via cookie path manipulation.

Impact

An attacker could take over a company admin's account by chaining the two XSS vulnerabilities, assuming the admin was authenticated when opening the malicious file.

What the attacker needed

Victim opens malicious file; victim is authenticated; attacker can upload SVG file

The fix

The report recommends encoding user input, validating file content, enforcing a strict CSP, and setting SameSite on cookies.

How it was found

  1. Find a self-XSS on the main application via a POST parameter.
  2. Discover a file upload feature that accepts an SVG disguised as a PDF, leading to blind XSS on a subdomain.
  3. Use the blind XSS to set the attacker's session cookie with a specific path for the vulnerable page on the main domain.
  4. Craft a request with the attacker's CSRF token to trigger the self-XSS in the victim's session.
  5. Use the XSS to fetch the victim's CSRF token and change their email to the attacker's, completing 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.

Self-XSS is a cross-site scripting bug that only affects the person who enters the malicious code, so it is usually considered low risk. Here, the attacker found a second XSS on a subdomain that could set a cookie for the main site, and by carefully controlling the cookie's path, they could make the victim's browser run the self-XSS in the victim's own session, taking over their account.

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.