My Account take Over bug
The application stored session cookies scoped to the wildcard domain without the HttpOnly flag, and a stored XSS on a subdomain could read them. By chaining a login CSRF that forced the victim into the attacker's account, the attacker could steal the victim's session cookie and take over their account.
medium.com
Published on medium.com
In this writeup, I will walk you through my very first bug discovery: a critical Account Takeover (ATO) vulnerability in a major management company. I spent two weeks thoroughly mapping out the application, understanding its authentication flows, features, and underlying business logic.
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 session cookie was set with a wildcard domain and without HttpOnly, and a stored XSS on a subdomain allowed reading it, combined with missing OAuth state validation enabling login CSRF.
Impact
An attacker could take over a victim's account by stealing their session cookie, but the attack required the victim to click a link and be logged into the attacker's account via login CSRF.
What the attacker needed
Victim clicks a link; attacker has an account; victim is logged in
The fix
The cookie should be set with HttpOnly and a specific subdomain rather than a wildcard, the XSS should be fixed, and the OAuth state parameter should be validated.
How it was found
- The attacker sends a malicious link to the victim.
- Clicking the link triggers the OAuth flaw, silently logging the victim into the attacker’s account.
- The victim’s browser is then automatically redirected to the malicious ad preview on `edit.example.com`.
- Trigger the change region feature then the stored XSS payload executes.
- The JavaScript extracts the cookie data and exfiltrates it to the attacker's request catcher.
- The attacker uses the exfiltrated session token to gain full control of the account.
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 session cookie is like a temporary ID card that keeps you logged in. The site made this ID readable by JavaScript on any of its subdomains, and a separate flaw let an attacker run their own JavaScript on one subdomain. The attacker tricked the victim into logging into the attacker's account, then used the JavaScript to steal the victim's real ID card and take over their account.
What is Account takeover?
Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.