Password Reset Link Poisoning
Password reset emails build their link from the request's Host header, so an attacker can make a victim's genuine reset email point to a server they control.
| Severity | High |
| CVSS 3.1 | 8.1 CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N Open in the calculator |
| CVSS 4.0 | 8.5 CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-640: Weak Password Recovery Mechanism for Forgotten Password |
| OWASP Top 10 | A07:2025 Authentication Failures |
| MITRE ATT&CK | T1212 Exploitation for Credential Access, T1078 Valid Accounts |
| Category | Input Validation |
Description
The application builds the absolute URL in password reset emails from information in the reset request itself, usually the HTTP Host header or a forwarding header such as X-Forwarded-Host, instead of from a fixed, configured address. The usual cause is a framework or reverse proxy that passes client-supplied host values to the application unchecked, or an application that trusts forwarding headers from any source.
An attacker can request a password reset for a victim's account while supplying their own domain in that header. The application then sends the victim a genuine reset email, from its own mail system, whose link points to the attacker's server and carries the victim's valid reset token. When the victim clicks the link, or when an email security product follows it automatically to scan it, the token is sent to the attacker's server, and the attacker can use it to set a new password and take over the account. The attack can target any user whose email address or username is known, including administrators, but it relies on the link being followed before the token expires, so short token lifetimes limit the exposure. The same poisoning can affect other emails that contain links, such as account verification and invitation messages.
The weakness is confirmed by requesting a reset for a test account with a modified Host, X-Forwarded-Host, X-Host or Forwarded header, or with a duplicated Host header or an absolute URL in the request line, and inspecting the link in the email received. An external interaction server, such as Burp Collaborator, shows whether the token is delivered when the link is followed.
Remediation
- Build links in emails from a fixed base URL held in the application's configuration, never from the
Hostheader or any forwarding header in the request. - Configure the framework's list of allowed host names so that requests with unexpected
Hostvalues are rejected, for exampleALLOWED_HOSTSin Django orAllowedHostsin ASP.NET Core, and in nginx make the default server block, which receives requests for unknown host names, refuse them rather than passing them to the application. - Accept
X-Forwarded-Hostand similar headers only from trusted reverse proxies, and have the proxy overwrite them rather than pass on values supplied by the client. - Keep reset tokens single use and short-lived, so that any token that does leak is useful for as little time as possible.
Confirm the fix by repeating the reset request with each modified host header and confirming that the emailed link always points to the application's own domain.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.