Skip to content
Account takeover Write-up Intermediate

1-Click Account Takeover via Host Header Injection

The application built password-reset links using the attacker-controlled Host header, so a crafted Host value made the reset link point to an attacker's domain while still carrying a valid reset token. When a victim clicked the link, the token was sent to the attacker, who could then reset the victim's password and take over the account.

medium.com

Published on medium.com

By tampering with the HTTP Host header when triggering the “forgot password” flow, I caused the application to build the reset URL using my attacker-controlled host. The app emailed (or returned) a link that contained a legitimate reset token but pointed to my server.

Abdulrhman, 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 used the untrusted Host header to construct publicly visible password-reset URLs instead of a configured canonical domain.

Impact

An attacker could take over the victim's account by resetting their password, and if the victim is an admin, could gain administrative control over the entire company tenant.

What the attacker needed

Victim clicks a link; attacker can send crafted Host header; victim has an account

The fix

The application should never use the raw Host header to generate public links; instead it should use a configured canonical hostname and validate or allow-list Host header values if they must be used.

How it was found

  1. Create a victim account or use one you control.
  2. Submit a forgot-password request while changing the Host header to an attacker-controlled domain that includes the target as a path-like suffix.
  3. Observe the reset link generated by the application; it points to the attacker-controlled host and contains a valid reset token as a query parameter.
  4. When the victim clicks that link, the attacker receives the token on their server, then uses it to complete the password reset flow 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 ask a website to reset your password, it sends you an email with a special link that contains a secret code. This report shows that the website was building that link using a value (the Host header) that the person making the request can control. So an attacker could make the link point to their own server, and when the victim clicked it, the secret code was sent to the attacker, who then used it to reset the victim's password.

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.

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.