Skip to content
Account takeover Write-up Intermediate

⚙️ 11. — Password Reset Poisoning via Middleware

The application built password reset links using the X-Forwarded-Host header without validating it, so an attacker could point the link at their own server. When the victim clicked the poisoned link, their reset token was sent to the attacker, who then used it on the real site to set a new password and take over the account.

medium.com

Published on medium.com

6. 🖱️ In Burp → Proxy → HTTP history → find POST /forgot-password → Send to Repeater

The4v1, 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

The application trusted the client-supplied X-Forwarded-Host header when constructing the password reset URL, instead of using a fixed, server-configured domain.

Impact

An attacker could take over another user's account by stealing their reset token and setting a new password, provided the victim clicks the poisoned link.

What the attacker needed

A free account on the site; victim clicks the poisoned reset link; an attacker-controlled server to log requests

The fix

The reset URL should be built from a fixed base URL stored in server configuration, and proxy headers should only be trusted when they come from known proxy addresses.

How it was found

  1. Request a password reset for your own account and confirm the email contains a unique token in the link.
  2. Capture the reset request in Burp and send it to Repeater.
  3. Add an X-Forwarded-Host header pointing at your exploit server and resend for your own account to confirm the link now points there.
  4. Change the username to the victim's and resend, so the victim receives a poisoned reset link.
  5. Check the exploit server access log for the victim's request and copy the token from the URL.
  6. Open your own real reset URL, replace your token with the victim's, set a new password, and log in as the victim.

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 a password, a site emails you a special link containing a secret code (a token) that lets you set a new one. This site built that link using a value the visitor's browser can set, so an attacker could make the link point to their own server. The victim's browser then sent the secret code to the attacker, who used it to reset 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.