Skip to content
Account takeover Write-up Beginner

A Simple Host Header Bug That Leads to Admin Takeover

The application blindly trusted the HTTP Host header when generating password reset links, allowing an attacker to manipulate the header and obtain a reset token for the admin account. This led to full admin account takeover.

medium.com

Published on medium.com

Every time a user visits a website, the browser sends an HTTP request that includes a Host header. This header tells the server which domain the request is meant for.

Nidhi kathayat, 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

Likely the application used the user-supplied Host header to construct password reset URLs without validating it against a list of allowed domains.

Impact

An attacker could take over the admin account, leading to full control of the application.

What the attacker needed

Knowledge of admin email; ability to intercept HTTP requests

The fix

The application should validate the Host header against a predefined list of allowed domains and generate password reset links using a fixed, trusted domain from configuration.

How it was found

  1. Find the admin's email address on the home page.
  2. Go to the login page and click 'Forgot Password'.
  3. Enter the admin email and intercept the password reset request.
  4. Modify the Host header to a different value and forward the request.
  5. Observe that a password reset token is generated.
  6. Use the token to reset the admin password and log in as admin.

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 visit a website, your browser sends a 'Host' header telling the server which site you want. If the server uses that header to build links (like password reset links) without checking it, an attacker can change the header to make the server generate a link pointing to the attacker's site. This can let the attacker steal the reset token and 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.

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.