Skip to content
Account takeover Write-up Beginner

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.

loayahmed686 Follow

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.

L0Ay, on medium.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

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

  1. Intercept the forgot-password request in a proxy.
  2. Replace the Host header value with an attacker-controlled domain.
  3. Send the request and wait for the reset email.
  4. Observe that the reset link points to the attacker's domain and carries the token.
  5. 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.

More by loayahmed686

View all

3 more disclosed reports, best first.

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.