Skip to content
Account takeover Write-up Intermediate

ATO via Host Header Poisoning

The password reset endpoint was vulnerable to host header injection: by adding X-Forwarded-Host and Referrer headers with an attacker-controlled domain, the reset email contained a link to that domain. An attacker could use this to steal reset tokens and take over accounts.

Shivam Kamboj Dattana Follow

Published on medium.com

Bounty$2,000 View original

Bug Bounty

Shivam K, 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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 3 min read.

Context

This write-up covers an account takeover found through host header poisoning on a site referred to throughout as redacted.com. The affected feature is the password reset flow, reached at https://redacted.com/forgot. Normally that page takes a username, and the application sends a reset email to the address linked to that account. The email is supposed to contain a link pointing back to redacted.com.

The researcher reports that the application was vulnerable to host header injection, and that a remote attacker could use it to take over any account on the site. The report was submitted to a private program on 26 June 2019, triaged on 1 August 2019, rewarded with a $2000 USD bounty on 8 August 2019, and the vulnerability was fixed on 24 October 2019.

Setup

The report does not describe any special accounts, roles or software versions. The only tool named is Burp Suite, used to intercept the password reset request.

Finding it

The researcher modified the POST request for the reset flow and tried to influence the host that the application used when building the reset email. The attempts were incremental:

  1. First, the value of the Host header was changed to evil.com. Nothing happened.
  2. Then the X-Forwarded-Host header was added with the value evil.com. Again nothing happened.
  3. On the third attempt, the Referrer header was also changed to the same value as X-Forwarded-Host. This time it worked.

The signal that something was wrong was the reset email itself: the host in the email became evil.com instead of the legitimate domain.

Exploitation

Step 1: Reach the reset form

Navigate to https://redacted.com/forgot and enter the username of the target account.

Step 2: Intercept the request

Intercept the resulting POST request with Burp Suite. The request the researcher sent looked like this:

HTTP
POST /forgot HTTP/1.1
Host: redacted.com
X-Forwarded-Host: evil.com
Referrer: https://evil.com

username=<username>&_csrf_token=[redacted]
Request Looks Like From the original on medium.com

The screenshot shows the request as it appeared in the tool. The important parts are:

  • Host: redacted.com stays as the legitimate host, so the request still reaches the real application.
  • X-Forwarded-Host: evil.com is the injected host that the application apparently trusts when generating links.
  • Referrer: https://evil.com matches the injected host. On its own, neither the Host change nor the X-Forwarded-Host addition had any effect; only when the referrer carried the same value did the poisoning take effect.
  • The body carries the target username and the existing _csrf_token, so the request is otherwise a valid reset submission.

Step 3: Forward and check the email

Forward the request and check the mailbox linked to the username. The email arrived with evil.com as the host:

Got email with malicious host From the original on medium.com

The screenshot shows the received email with the malicious host in place of the legitimate domain. The email arrived with evil.com as the host instead of the legitimate domain.

Steps to reproduce, as given in the report

  1. Navigate to https://redacted.com/forgot.
  2. Enter your username and intercept the request with Burp Suite.
  3. Add these two headers to the POST request:
HTTP
X-Forwarded-Host: evil.com
Referrer: https://evil.com
  1. Forward the request and check the email linked to your username.

Root cause

The injected host appeared in the email only after both X-Forwarded-Host and Referrer were set to evil.com. The report does not explain why the referrer check mattered, so the exact logic is not documented here. Changing the Host header alone had no effect.

Impact

An attacker who can submit a reset request for a victim's username can cause the reset email to use a host they control. The researcher states that any account of redacted.com could be taken over this way.

Fix

The report states that the vulnerability was fixed on 24 October 2019 but does not describe the change that was made.

Variants to test

  • A positive result is an email whose link points at your test domain.

Timeline

Bounty Rewarded From the original on medium.com
  • 26 June 2019: reported to the private program.
  • 1 August 2019: report triaged.
  • 8 August 2019: bounty of $2000 USD awarded.
  • 24 October 2019: vulnerability fixed.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 5 min read.

What happened, in plain words

A security researcher found a way to take over any user account on a website (called redacted.com in the report) by abusing the password reset feature. When you forget your password, the site sends you an email with a link to reset it. Normally that link points to the real site. But the researcher discovered that by adding a couple of extra lines to the request your browser sends when you ask for a reset, he could make the site send an email whose link pointed to a domain he controlled (evil.com). The email's link pointed to a domain the researcher controlled instead of the real site. The bug was reported in June 2019, fixed in October 2019, and earned a $2000 bounty.

Context

This write-up covers an account takeover found through host header poisoning on a site referred to throughout as redacted.com. The affected feature is the password reset flow, reached at https://redacted.com/forgot. Normally that page takes a username, and the application sends a reset email to the address linked to that account. The email is supposed to contain a link pointing back to redacted.com.

The researcher reports that the application was vulnerable to host header injection, and that a remote attacker could use it to take over any account on the site. The report was submitted to a private program on 26 June 2019, triaged on 1 August 2019, rewarded with a $2000 USD bounty on 8 August 2019, and the vulnerability was fixed on 24 October 2019.

Setup

The report does not describe any special accounts, roles or software versions. The only tool named is Burp Suite, used to intercept the password reset request.

Finding it

The researcher modified the POST request for the reset flow and tried to influence the host that the application used when building the reset email. The attempts were incremental:

  1. First, the value of the Host header was changed to evil.com. Nothing happened.
  2. Then the X-Forwarded-Host header was added with the value evil.com. Again nothing happened.
  3. On the third attempt, the Referrer header was also changed to the same value as X-Forwarded-Host. This time it worked.

The signal that something was wrong was the reset email itself: the host in the email became evil.com instead of the legitimate domain.

Exploitation

Step 1: Reach the reset form

Navigate to https://redacted.com/forgot and enter the username of the target account.

Step 2: Intercept the request

Intercept the resulting POST request with Burp Suite. The request the researcher sent looked like this:

HTTP
POST /forgot HTTP/1.1
Host: redacted.com
X-Forwarded-Host: evil.com
Referrer: https://evil.com

username=<username>&_csrf_token=[redacted]
Request Looks Like From the original on medium.com

The screenshot shows the request as it appeared in the tool. The important parts are:

  • Host: redacted.com stays as the legitimate host, so the request still reaches the real application.
  • X-Forwarded-Host: evil.com is the injected host that the application apparently trusts when generating links.
  • Referrer: https://evil.com matches the injected host. On its own, neither the Host change nor the X-Forwarded-Host addition had any effect; only when the referrer carried the same value did the poisoning take effect.
  • The body carries the target username and the existing _csrf_token, so the request is otherwise a valid reset submission.

Step 3: Forward and check the email

Forward the request and check the mailbox linked to the username. The email arrived with evil.com as the host:

Got email with malicious host From the original on medium.com

The screenshot shows the received email with the malicious host in place of the legitimate domain. The email arrived with evil.com as the host instead of the legitimate domain.

Steps to reproduce, as given in the report

  1. Navigate to https://redacted.com/forgot.
  2. Enter your username and intercept the request with Burp Suite.
  3. Add these two headers to the POST request:
HTTP
X-Forwarded-Host: evil.com
Referrer: https://evil.com
  1. Forward the request and check the email linked to your username.

Root cause

The injected host appeared in the email only after both X-Forwarded-Host and Referrer were set to evil.com. The report does not explain why the referrer check mattered, so the exact logic is not documented here. Changing the Host header alone had no effect.

Impact

An attacker who can submit a reset request for a victim's username can cause the reset email to use a host they control. The researcher states that any account of redacted.com could be taken over this way.

Fix

The report states that the vulnerability was fixed on 24 October 2019 but does not describe the change that was made.

Variants to test

  • A positive result is an email whose link points at your test domain.

Timeline

Bounty Rewarded From the original on medium.com
  • 26 June 2019: reported to the private program.
  • 1 August 2019: report triaged.
  • 8 August 2019: bounty of $2000 USD awarded.
  • 24 October 2019: vulnerability fixed.

Glossary

  • Account takeover (ATO): when an attacker gains control of someone else's account, for example by changing their password.
  • API: a set of rules that lets one piece of software talk to another; here, the web application's endpoints that handle requests.
  • Burp Suite: a tool that lets you pause and edit the requests your browser sends to a website.
  • Cookie: a small piece of data a website stores in your browser to remember you between visits.
  • CSRF token: a secret value included in forms to prove the request came from the real site and not from an attacker.
  • Endpoint: a specific URL or address on a server that performs a particular function, like /forgot.
  • Host header: the part of an HTTP request that tells the server which website you are trying to reach.
  • Host header injection: a vulnerability where an attacker can change the host value the application uses, often to make it generate links to a malicious site.
  • Password reset flow: the series of steps a website uses to let you set a new password when you forget yours, usually by sending an email with a special link.
  • POST request: a type of HTTP request used to send data to a server, such as a form submission.
  • Referrer header: a header that tells the server the address of the page you came from.
  • Remote attacker: someone attacking the system over the internet, from a different computer.
  • Reset token: a unique, secret code included in a password reset link that proves you are allowed to change the password.
  • Triaged: when a bug report is reviewed and confirmed as valid by the program.
  • X-Forwarded-Host header: a header sometimes used by proxies to tell the server the original host requested by the client; applications may trust it when building links.

More by Shivam Kamboj Dattana

View all

1 more disclosed report, 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.