Account Takeover Through Password Reset Poisoning
The password reset page used the X-Forwarded-Host header to build the reset link, so an attacker could set it to their own domain and receive the victim's reset token. With that token, the attacker could reset the victim's password and take over the account.
Published on medium.com
#### Vishal Bharad
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.
Context
This write-up describes a full account takeover found in the password reset flow of a web application, referred to throughout as redacted.com. The feature involved is the forgotten password page at https://redacted.com/users/forgot_password, where a user enters a username and the application emails a password reset link containing a token. The reset link is built as https://redacted.com/users/reset_password/<token>.
The researcher, Vishal Bharad, a mechanical engineer working as a penetration tester, spent roughly 6 to 8 hours testing forgotten password pages across several websites before finding this issue. The bug class is password reset poisoning: the application builds the host part of the reset link from a request header the client controls.
Setup
No accounts, roles or versions are described beyond a normal user account on redacted.com and the ability to receive the reset email. The tools used were:
- Burp Suite, to intercept and modify the forgot password request.
- An ngrok server, acting as the attacker-controlled host.
Preconditions for the attack: the attacker needs a victim username, the ability to send the forgot password request with a modified header, and the victim must click the poisoned reset link once. The report notes that exploitation needs victim interaction or one click only.
Finding it
The researcher focused on the forgotten password page and tried many tricks against it. Adding the X-Forwarded-Host header to the forgot password request changed the host in the emailed link from redacted.com to the value supplied by the client. By adding that header to the forgot password request, the host in the emailed link changed from redacted.com to the value supplied by the client.
Exploitation
Step 1: Request a reset link
Go to https://redacted.com/users/forgot_password and type the username to get a forgotten password link.
Step 2: Add the host header
Capture the request in Burp Suite and add:
X-Forwarded-Host: bing.com
The screenshot shows the captured request with the added host header.
Step 3: Forward and inspect the email
Forward the request and check the email. The password reset email arrives with a token, and the link looks like:
https://bing.com/users/reset_password/[redacted]
The report says the token is leaked to bing.com because the host portion of the link was taken from the header. To confirm the token is genuine, put https://redacted.com instead of https://bing.com and open it in the browser. The password reset link is valid and the password can be reset.
Step 4: Prepare the attacker server
Create a server via ngrok, which is the attacker's server.
Step 5: Poison the victim's reset request
The attacker goes to https://redacted.com/users/forgot_password, types the victim's username and captures the request in Burp Suite. In the captured request the attacker adds:
X-Forwarded-Host: ngrok.io
Here ngrok.io is the ngrok server address.
Step 6: The victim receives a poisoned link
The victim gets the password reset URL, and the domain of that reset link is the ngrok server address or domain. Exploitation needs victim interaction, or one click only.
Step 7: Capture the token
Whenever the victim clicks that link, the attacker gets the full token on his server.

Step 8: Take over the account
Once the attacker has the password reset token, he changes the ngrok domain name to the main domain to take over the account.
Root cause
The emailed reset link took its host from the X-Forwarded-Host request header, which the client controls. Because the header is client-controlled, an attacker can make the application email a link pointing at a host the attacker owns. The researcher confirmed the token was valid by swapping the host back to redacted.com.
Impact
The researcher demonstrated that a captured reset token could be used to take over the account. The researcher described the issue as a full account takeover.
Fix
The report does not describe a fix or a change made by the vendor.
Variants to test
- A positive result is a reset email whose link points at the supplied host.
What happened, in plain words
A security researcher found a way to take over someone else's account on a website (called redacted.com in the write-up) without ever knowing their password. The trick was in the "forgot password" feature.
When you forget your password, a website usually emails you a special link. Clicking that link proves you own the email address, and it lets you set a new password. The link contains a long random string called a token, which is what makes the link work. If someone else gets hold of your token, they can reset your password and lock you out.
On redacted.com, the website built the reset link using a piece of information that the person making the request could control. By adding an extra instruction to the request, the researcher could make the website send the reset email with a link pointing at a server he owned instead of at redacted.com. When the victim clicked that link, the token was delivered straight to the attacker's server. The attacker then used the token on the real site and took over the account.
This class of bug is called password reset poisoning. The word "poisoning" means the attacker is feeding the application bad input that changes how it behaves, in this case changing the address that ends up in the email.
The pieces you need to understand first
Before walking through the steps, here are the ideas the report relies on. Each one is explained from scratch.
- A web request: when you fill in a form on a website and press a button, your browser sends a message to the website's computer (the server). That message is called a request. It has a few parts: the address you are asking for, some extra information called headers, and sometimes a body with the data you typed.
- Headers: headers are small labelled lines of extra information that travel with every request and response. Think of them like the address block and handling notes on an envelope: they are not the letter itself, but they tell the postal system where it came from and how to treat it. Examples include
Host(which website you are asking for) andUser-Agent(which browser you are using). - The
Hostheader: this tells the server which website name the browser was trying to reach. One server can host many websites, so the server uses this header to know which one you want. X-Forwarded-Host: this is a header that proxies and load balancers (middle computers that sit in front of a website) use to tell the real server which hostname the visitor originally asked for. It starts withX-because it was originally a custom header, not part of the official standard. The important point: a normal visitor's browser does not send it, so if a server trusts it blindly, anyone can put any value in it.- Burp Suite: a tool used by security testers. It sits between your browser and the website and lets you pause a request, look at it, change it, and then send it on. Think of it as a mail intercept service that lets you open an envelope, edit the letter, and reseal it before delivery.
- ngrok: a service that gives your own computer a public web address on the internet. You run a small program on your machine, and ngrok gives you a URL (in this report, something under
ngrok.io) that anyone on the internet can visit. Whatever requests arrive at that URL are forwarded to your computer, so you can see them. This is how the attacker receives the victim's token. - Token: a long random string that acts like a one-time key. In a password reset link, the token is what proves the person clicking the link is allowed to reset the password. If someone else gets the token, they can use it too.
- Account takeover: when an attacker gains control of someone else's account, usually by resetting the password or stealing a session. It is the worst outcome for a normal user account.
- Victim interaction: some attacks need the victim to do something, such as click a link. This report needs exactly one click from the victim.
The setup
The researcher, Vishal Bharad, describes himself as a mechanical engineer working as a penetration tester. He spent roughly 6 to 8 hours testing forgotten password pages on several websites before finding this issue on redacted.com.
The only things needed to reproduce the finding were:
- A normal user account on
redacted.comand the ability to receive the reset email. - Burp Suite, to pause and edit the forgot password request.
- An ngrok server, to act as the attacker-controlled host that receives the stolen token.
For the attack to work against a real victim, the attacker needs three things: the victim's username, the ability to send the forgot password request with a modified header, and the victim clicking the poisoned link once. The report notes that exploitation needs victim interaction, or one click only.
Finding it
The researcher focused on the forgotten password page. He tried many tricks against it. The behaviour that made the page look wrong was that the application trusted the X-Forwarded-Host header when building the password reset URL. By adding that header to the forgot password request, the host in the emailed link changed from redacted.com to whatever value the client supplied.
In plain terms: the website was asking the visitor "which hostname should I use in this link?" instead of deciding for itself. That is the bug.
Exploitation
The exploitation is broken into numbered steps in the report. Each step below explains what was done and why.
Step 1: Request a reset link
Go to https://redacted.com/users/forgot_password and type the username to get a forgotten password link.
This is the normal, everyday action any user takes when they forget their password. The point of doing it here is to see what the resulting email looks like before tampering with anything.
Step 2: Add the host header
Capture the request in Burp Suite and add:
X-Forwarded-Host: bing.com
Line by line:
X-Forwarded-Hostis the header name. It is the one the application is trusting.bing.comis the value the researcher chose.
Why this step: the researcher wants to see whether the website will use the value he supplies in the reset link. If it does, the link in the email will point at bing.com instead of redacted.com.
Step 3: Forward and inspect the email
Forward the request and check the email. The password reset email arrives with a token, and the link looks like:
https://bing.com/users/reset_password/[redacted]
The report says the token is leaked to bing.com because the host portion of the link was taken from the header. To confirm the token is genuine, put https://redacted.com instead of https://bing.com and open it in the browser. The password reset link is valid and the password can be reset.
What this shows: the website built the link using the value the researcher supplied. The token itself is real. Swapping the host back to redacted.com confirms the token works on the real site.
Step 4: Prepare the attacker server
Create a server via ngrok, which is the attacker's server.
Why this step: the attacker needs somewhere to receive the token. ngrok gives the attacker's own machine a public address on the internet, so when the victim clicks a link pointing at that address, the request arrives at the attacker's machine and the attacker can read it.
Step 5: Poison the victim's reset request
The attacker goes to https://redacted.com/users/forgot_password, types the victim's username and captures the request in Burp Suite. In the captured request the attacker adds:
X-Forwarded-Host: ngrok.io
Here ngrok.io is the ngrok server address.
Line by line:
X-Forwarded-Hostis the same header as before.ngrok.iois the attacker's ngrok address. This is the host the reset link will point at.
Why this step: this is the same trick as Step 2, but now aimed at a real victim. The attacker is asking the website to send the victim a reset email whose link points at the attacker's server.
Step 6: The victim receives a poisoned link
The victim gets the password reset URL, and the domain of that reset link is the ngrok server address or domain. Exploitation needs victim interaction, or one click only.
Why this matters: the victim does not need to be tricked into typing a password anywhere. They just need to click the link in the email, which is exactly what a normal user would do. That is why the report calls it one click only.
Step 7: Capture the token
Whenever the victim clicks that link, the attacker gets the full token on his server.

What is happening: the victim's browser follows the link to ngrok.io, which forwards the request to the attacker's machine. The token is part of the URL, so it appears in the request the attacker receives. The attacker now has the victim's reset token without ever seeing the victim's email.
Step 8: Take over the account
Once the attacker has the password reset token, he changes the ngrok domain name to the main domain to take over the account.
In plain terms: the attacker changes the ngrok domain name in the captured URL back to redacted.com to take over the account.
Why the bug exists
The emailed reset link took its host from the X-Forwarded-Host request header, which the client controls. Because the header is client-controlled, an attacker can make the application email a link pointing at a host the attacker owns. The researcher confirmed the token was valid by swapping the host back to redacted.com.
A simple comparison: imagine a bank that prints the customer's address on a statement by asking the customer to write it on the envelope. A fraudster could write their own address and receive the statement. The bank should print the address it has on file, not the one the customer supplies. The same idea applies here: the website should decide the hostname itself, not take it from the request.
Impact
The researcher demonstrated that a captured reset token could be used to take over the account. The researcher described the issue as a full account takeover.
Fix
The report does not describe a fix or a change made by the vendor.
An allowlist is a list of values the application will accept. Anything not on the list is rejected. In this case, the application should only ever use redacted.com (or whatever its real hostname is) when building reset links, regardless of what the request says.
Variants to test
Each one is a small change to the same idea.
- A positive result is a reset email whose link points at the supplied host.
Disclosure
The researcher reported the issue to the vendor on 1 August. The vendor reviewed the report, the steps to reproduce, and the proof of concept (screenshots and videos). The researcher was rewarded with a three-digit amount between $700 and $1000.
Glossary
- Allowlist: a list of values an application will accept; anything not on the list is rejected.
- Burp Suite: a tool that sits between a browser and a website, letting a tester pause, inspect and modify requests before they are sent.
- Header: a small labelled line of extra information sent with a web request or response, such as
HostorUser-Agent. - Host header: the header that tells a server which website name the browser was trying to reach.
- ngrok: a service that gives a computer a public web address on the internet and forwards incoming requests to it.
- Password reset poisoning: a bug where an application builds a password reset link using a value the attacker controls, so the link points at the attacker's server.
- Penetration tester: a security professional who tests systems for vulnerabilities, with permission, before attackers find them.
- Proof of concept (PoC): evidence that a vulnerability can actually be exploited, such as screenshots or a video.
- Request: the message a browser sends to a server when you visit a page or submit a form.
- Token: a long random string that acts like a one-time key, used in password reset links to prove the person clicking is allowed to reset the password.
- Victim interaction: a step the victim must take for an attack to succeed, such as clicking a link.
X-Forwarded-Host: a header used by proxies to tell the real server which hostname the visitor originally asked for; if trusted blindly, an attacker can put any value in it.