Skip to content
Account takeover Write-up Intermediate

Password Reset Link Injection Enables Full Account Takeover

The password reset link generation reflected a user-supplied URL parameter without proper validation, allowing an attacker to inject their own domain using the '@' technique. When a victim clicked the crafted reset link, the reset token was sent to the attacker's server, enabling full account takeover.

medium.com

Published on medium.com

In this write-up, I demonstrate how a weak password reset implementation in a web application (referred to as target.com) can lead to a full account takeover (ATO) with just a single click from the victim.

Mahmoud Gamal, 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 server validated that the supplied reset URL contained the target domain but failed to properly parse the URL, allowing the '@' character to redirect the actual host to an attacker-controlled domain.

What the attacker needed

Victim clicks a link; attacker can receive HTTP requests

The fix

The application should properly validate and sanitise the resetPassword parameter, ensuring it only allows URLs with the exact target domain and no userinfo or redirect tricks.

How it was found

  1. Send a password reset request with a valid email and observe the resetPassword parameter.
  2. Replace the resetPassword value with an attacker domain and note the 403 response.
  3. Try variations appending the attacker domain to the original domain and removing path segments, observing 200 responses but no redirect.
  4. Use the '@' technique with the target domain before the '@' and the attacker domain after, which bypasses validation.
  5. The victim receives a reset link pointing to the attacker domain with the token as a query parameter.
  6. Capture the token from server logs and use it in the legitimate reset link to change 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.

When you forget your password, a website emails you a special link with a secret code (token) that lets you set a new password. This report shows that the website let an attacker change where that link points, so the secret code was sent to the attacker's own server instead. The attacker could then use that code to reset the victim's password 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.

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.