Password Recovery? More Like Account Delivery Host Header Injection Madness
The password reset flow built the reset link from the request's Host header without validating it, so an attacker could point the link at their own server. The attacker then received the victim's valid reset token and used it to set a new password and log in as the victim.
Published on medium.com
Let me tell you a little story. It started with a “Forgot your password?” link, and ended with me having full control of someone’s account without phishing, social engineering, or black magic.
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 generated the password reset URL from the untrusted Host header without validating it against an allowlist.
Impact
An attacker could obtain a valid password reset token for a victim and take over their account without any user interaction.
What the attacker needed
Ability to send a modified Host header; victim's email address known; no user interaction needed
The fix
The reset URL should be built from a fixed, trusted base URL or a validated allowlist of hosts rather than the incoming Host header.
How it was found
- Intercept the forgot-password request in a proxy.
- Replace the Host header value with an attacker-controlled domain.
- Send the request and wait for the reset email.
- Observe that the reset link points to the attacker's domain and carries the token.
- Use the received token to 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, the site emails you a special link containing a secret code. This site built that link using a value the visitor's browser sends called the Host header, which says which website name was requested. Because the site trusted that value, an attacker could make the link point to their own server and receive the secret code, then use it to take over the 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.