Skip to content
Account takeover Write-up Intermediate

Password Reset Poisoning via Middleware: The Hidden Flaw That Can Lead to Account Takeover

The application's middleware used the unvalidated X-Forwarded-Host header to build password reset links, allowing an attacker to redirect the reset token to their own server. An attacker could then capture the token and reset the victim's password, leading to account takeover.

infosecwriteups.com

Published on infosecwriteups.com

Password reset poisoning is a web application vulnerability that allows attackers to manipulate the password reset process by tampering with how the application generates reset links. In this specific case, the vulnerability occurs within middleware, a software layer that processes HTTP requests before they reach the…

Bash Overflow, on infosecwriteups.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 middleware trusted the X-Forwarded-Host header to construct the password reset URL without validating it against an allowlist of trusted hosts.

Impact

This could lead to full account takeover, even without traditional phishing, and enable further attacks such as privilege escalation.

What the attacker needed

Victim clicks a link in an email; attacker can send crafted requests

The fix

The application should validate the X-Forwarded-Host header against a list of trusted hosts or use a fixed, trusted host when generating password reset links.

How it was found

  1. Log in as Wiener and observe the registered email address.
  2. Log out and initiate a password reset for Wiener, then check the email to see the reset link.
  3. In the HTTP history, locate the POST /forgot-password request and send it to Repeater.
  4. Add an X-Forwarded-Host header pointing to the exploit server and observe that the reset link changes.
  5. For Carlos's account, capture the password reset request, inject the exploit server into the X-Forwarded-Host header, and send it.
  6. Check the exploit server's access log to capture Carlos's reset token, then use it to set a new password and log in as Carlos.

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 sends you an email with a special link to reset it. This link contains a secret code. The website builds that link using information from your request, including a header that tells it which website you are visiting. If the website trusts that header without checking, an attacker can change it so the link points to their own server. Then, when the victim clicks the link, the secret code is sent to the attacker, who can use it 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.