Skip to content
Account takeover Write-up Intermediate

Logic Issue Allowed me to Takeover Any User Account

The site allowed usernames with dots, so an attacker could register the username 'password.php'. Password reset links used the username in the URL path, so a victim clicking the reset link was redirected to the attacker's profile page, which contained stored XSS that sent the reset token to the attacker, allowing account takeover.

medium.com

Published on medium.com

Hi All, This is Abdelkader Mouaz, also known as Hamzadzworm. Recently, while exploring a website’s user registration and password reset features, I stumbled upon an interesting vulnerability that could lead to account takeover.

Hamzadzworm, 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 allowed dots in usernames and used the username directly in the password reset URL path without sanitisation, causing the reset link to point to the attacker's profile page.

Impact

An attacker could take over any user account by stealing password reset tokens, provided the victim clicks the reset link and the attacker's profile page is visited.

What the attacker needed

Attacker can register a username with a dot; attacker can store XSS in bio field; victim clicks password reset link

How it was found

  1. Register a username containing a dot, such as 'password.php'.
  2. Add a stored XSS payload in the user bio field that sends the page URL to an attacker-controlled server.
  3. Trigger a password reset for a victim; the reset link uses the attacker's username in the path.
  4. When the victim clicks the reset link, they are redirected to the attacker's profile page.
  5. The stored XSS executes and sends the reset token to the attacker.
  6. Use the stolen token via a direct API call to reset the victim's password.

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.

Usernames could contain dots, so someone could pick a name that looked like a file name. When a user asked to reset their password, the link included that username in the web address. Because the attacker's username matched a real page, the victim was sent to the attacker's profile instead of the reset page. That profile had a script that stole the reset token, letting the attacker change the victim's password.

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.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.