Skip to content
XSS Write-up Intermediate

XSS to Account Takeover

A DOM-based XSS vulnerability in the 'return' parameter of a login page allowed an attacker to steal non-HttpOnly cookies containing access tokens and other user data, leading to account takeover.

whoistaha.medium.com

Published on whoistaha.medium.com

One of the hottest topics in today’s world is the gambling industry. Most of these websites use the same script.

Taha, on whoistaha.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 'return' parameter was reflected into the DOM without sanitisation, and the access token cookie lacked the HttpOnly flag.

Impact

An attacker could steal a victim's access token and other cookies, leading to account takeover.

What the attacker needed

Victim clicks a crafted link; attacker controls a server to receive cookies

The fix

The 'return' parameter should be properly sanitised or validated, and the access token cookie should be set with the HttpOnly flag.

How it was found

  1. Inspect the login page source and find the 'return' parameter.
  2. Identify forbidden characters by testing different phrases.
  3. Craft a payload to read document.cookie and send it to an attacker server, bypassing filters.
  4. Use the concat function to combine the attacker URL and cookies because the plus sign is filtered.
  5. Deliver the final payload to a victim to steal cookies and achieve 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.

The login page had a part of the web address that the site used to decide where to send you after logging in. The site did not check this part properly, so an attacker could put code in it that runs in your browser. Because the site stored your login token in a cookie that JavaScript can read, the attacker's code could steal it and take over your 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.