Skip to content
XSS Write-up Intermediate

Day 25: From alert(origin) to ATO — An XSS Story

A stored cross-site scripting flaw in a nickname editing feature let an attacker inject script that ran when victims viewed the attacker's profile. The attacker used it to steal session cookies and take over accounts.

medium.com

Published on medium.com

Today’s Account Takeover (ATO) vulnerability was discovered by Remmy. This case highlights how a Stored XSS vulnerability was exploited to steal session cookies and fully compromise user accounts.

dani3l, 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 nickname value was stored and later rendered into the profile page without proper output encoding, and the input filter relied on a regex that could be bypassed with encoded whitespace.

Impact

An attacker could steal a victim's session cookies and take over their account, though the report notes the finding was closed as a duplicate.

What the attacker needed

A user account; victim views attacker's profile; ability to modify server response

The fix

The text does not say it was fixed; it recommends filtering and encoding user input, using a WAF, setting HttpOnly and Secure flags on cookies, and adding a strong Content Security Policy.

How it was found

  1. Test inputs in the nickname editing feature and observe that the less-than character is reflected.
  2. Try a simple tag and see that valid tags are blocked.
  3. Fuzz with different encodings and find that HTML-encoded tab characters bypass the filter.
  4. Work around the 32-character limit by modifying the server response to report success.
  5. Inject a payload that steals session cookies and have a victim view the attacker's profile.
  6. Import the stolen session to log in without credentials.

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.

Cross-site scripting (XSS) is when a website shows text from a user without making it safe, so the browser treats it as code. Here the nickname field was shown on the profile page, so a crafted nickname could run a small script in the browser of anyone who looked at that profile. That script could read the visitor's login cookie, which is like a temporary key, and send it to the attacker so they could 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.

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.