Skip to content
Account takeover Write-up Intermediate

Hijacking accounts with host manipulation using collaborator

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 a domain they control. By requesting a reset for a victim with a modified Host header, the attacker could receive the reset token and take over the account.

kongsec.medium.com

Published on kongsec.medium.com

Kongsec

Kongsec, on kongsec.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. 4 min read.

Context

This is a short write-up by Aditya Shende (Kongsec) about account takeover through host header manipulation, published on Medium in February 2021. The target is not named in the report: the author refers to it only as "my target" and uses target.com and host.com as placeholders. The feature involved is the password reset flow, which normally sends the user an email containing a link that carries a reset token. If the application builds that link from the incoming Host header instead of a fixed, configured value, an attacker can make the link point at a domain they control.

The author opens with an important caveat: this technique will not work against targets sitting behind Akamai, Cloudflare or any WAF. The report does not explain why, but the implication is that such front ends normalise or reject a manipulated Host header before it reaches the application.

Hunt your targets | Hackers gonna hack. From the original on kongsec.medium.com

Setup

The only tool mentioned is Burp Collaborator, used both to generate a collaborator subdomain and to observe HTTP interactions arriving at it. The author says he was testing for open redirects and SSRF with his usual method when he came across this. No accounts, roles or application versions are described.

The precondition is a target whose password reset (or similar email-generating) functionality reflects the request's host into the link it sends, and which is not shielded by a WAF that rewrites or blocks the header.

Finding it

The author requested his target using a hostname of the form target.com.burp_collaborator.net, with a path of /kongsec.php:

Text
target.com.burp_collaborator.net/kongsec.php

This produced an HTTP interaction in Collaborator, but only from his own IP address. That is the expected result of a simple request: the browser resolved the collaborator subdomain and connected to it directly. The interesting question was whether the application itself would ever generate a link to that host, so he moved on to sensitive actions that send email or produce URLs: sharing a URL, downloading private files, and password reset.

From the original on kongsec.medium.com

Exploitation

Step 1: trigger the email with a manipulated host

He captured the password reset request and changed the Host header so that it pointed at a collaborator-controlled name. The report gives the shape of the modified value as:

Here host.com stands in for the real target host and burplink.net for the collaborator domain. The reset email arrived with a link built from the manipulated host.

Step 2: receive the mail

The reset email arrived, with the link built from the attacker-supplied host rather than the legitimate one.

From the original on kongsec.medium.com

Step 3: observe the interaction

When the link was used, the Collaborator recorded an HTTP interaction, confirming that the reset URL pointed at the collaborator domain.

From the original on kongsec.medium.com

Step 4: capture the token

The author states that clicking the reset link in the inbox yields the reset token, which leads to account takeover. The author summarises the reproduction as follows:

  1. Capture request of reset password
  2. Modify host as : host.com.burplink.net
  3. Forward request from repeater
  4. Reset link in inbox, Click on it . We'll get reset token
Hunters after knowing this method to every program…. From the original on kongsec.medium.com

Root cause

The application likely builds absolute URLs in outgoing email from the Host header of the incoming request, without validating it against an allow-list of expected hostnames. The report does not show the server-side code, so this is inferred from behaviour. The author states the technique will not work on Akamai, Cloudflare or any WAF, without explaining why.

Impact

An attacker who can submit a password reset for a victim's account, with a forged Host header, receives a reset link containing a valid token on a domain they control. Using that token, they can take over the account. The author does not state which accounts, roles or user populations were affected beyond the general claim of account takeover.

Fix

The standard remediation, consistent with the root cause, is to construct absolute URLs from a configured canonical hostname rather than from the request's Host header, and to reject requests whose Host does not match an allow-list.

Variants to test

The same pattern applies wherever the application reflects the host into something the user will click or load. Concrete things to try:

  1. Password reset and email verification flows: send the request with Host: target.com.<collaborator-domain> and watch for a Collaborator interaction when the link is opened. A positive result is an email whose link points at the collaborator domain.
  2. Share links and file download URLs: request a share or download link with the manipulated host. A positive result is a generated URL on the collaborator domain.
  3. A positive result is the same reflected host in the generated link.
  4. A positive result is a cached page containing the attacker's host.
Or watch on YouTube
From the original on kongsec.medium.com

In each case, confirm the interaction actually originates from the application rather than from your own browser.

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. 6 min read.

What happened, in plain words

A security researcher found a way to take over user accounts on a website by manipulating a single piece of information that your browser sends with every request: the Host header. When you type a website address into your browser, your computer asks a directory service (DNS) to translate that name into an IP address, then connects to that address and sends a request that includes the name of the site you want. That name is the Host header. Many web applications use this header to build links in emails, such as password reset links. If an attacker can change the Host header to point to a domain they control, the application will send the victim an email with a link that goes to the attacker's domain, carrying a secret token that allows the attacker to reset the victim's password and take over the account.

The author, Aditya Shende (Kongsec), published this on Medium in February 2021. He does not name the target; he uses target.com and host.com as placeholders. The vulnerable feature is the password reset flow. He also warns that this technique will not work if the site is behind Akamai, Cloudflare or any Web Application Firewall (WAF). The report does not explain why, but such front ends typically normalise or reject a manipulated Host header before it reaches the application.

Hunt your targets | Hackers gonna hack. From the original on kongsec.medium.com

The setup

The only tool mentioned is Burp Collaborator. Burp Collaborator is a service that gives you a unique subdomain (like something.burp_collaborator.net) and records any HTTP requests that arrive at it. You can use it to detect when a server makes a request to a domain you control, which is useful for finding blind vulnerabilities like SSRF (Server-Side Request Forgery) or host header injection. The author says he was testing for open redirects and SSRF with his usual method when he came across this issue. No accounts, roles or application versions are described.

The precondition is a target whose password reset (or similar email-generating) functionality reflects the request's host into the link it sends, and which is not shielded by a WAF that rewrites or blocks the header.

Finding it

The author requested his target using a hostname of the form target.com.burp_collaborator.net, with a path of /kongsec.php:

Text
target.com.burp_collaborator.net/kongsec.php

This is a URL where the domain is target.com.burp_collaborator.net and the path is /kongsec.php. The idea is to see if the application will treat this whole string as the host and use it when building links. When he requested this URL, he saw an HTTP interaction in Collaborator, but only from his own IP address. That is expected: his browser resolved the collaborator subdomain and connected to it directly. The interesting question was whether the application itself would ever generate a link to that host. So he moved on to sensitive actions that send email or produce URLs: sharing a URL, downloading private files, and password reset.

From the original on kongsec.medium.com

Exploitation

Step 1: trigger the email with a manipulated host

He captured the password reset request and changed the Host header so that it pointed at a collaborator-controlled name. The report gives the shape of the modified value as:

Here host.com stands in for the real target host and burplink.net for the collaborator domain. The reset email arrived with a link built from the manipulated host.

Step 2: receive the mail

The reset email arrived, with the link built from the attacker-supplied host rather than the legitimate one.

From the original on kongsec.medium.com

Step 3: observe the interaction

When the link was used, the Collaborator recorded an HTTP interaction, confirming that the reset URL pointed at the collaborator domain.

From the original on kongsec.medium.com

Step 4: capture the token

The author states that clicking the reset link in the inbox yields the reset token, which leads to account takeover. The author summarises the reproduction as follows:

  1. Capture request of reset password
  2. Modify host as : host.com.burplink.net
  3. Forward request from repeater
  4. Reset link in inbox, Click on it . We'll get reset token
Hunters after knowing this method to every program…. From the original on kongsec.medium.com

Root cause

The application likely builds absolute URLs in outgoing email from the Host header of the incoming request, without validating it against an allow-list of expected hostnames. The report does not show the server-side code, so this is inferred from behaviour. The author states the technique will not work on Akamai, Cloudflare or any WAF, without explaining why.

Impact

An attacker who can submit a password reset for a victim's account, with a forged Host header, receives a reset link containing a valid token on a domain they control. Using that token, they can take over the account. The author does not state which accounts, roles or user populations were affected beyond the general claim of account takeover.

Fix

The standard remediation, consistent with the root cause, is to construct absolute URLs from a configured canonical hostname rather than from the request's Host header, and to reject requests whose Host does not match an allow-list.

Variants to test

The same pattern applies wherever the application reflects the host into something the user will click or load. Concrete things to try:

  1. Password reset and email verification flows: send the request with Host: target.com.<collaborator-domain> and watch for a Collaborator interaction when the link is opened. A positive result is an email whose link points at the collaborator domain.
  2. Share links and file download URLs: request a share or download link with the manipulated host. A positive result is a generated URL on the collaborator domain.
  3. A positive result is the same reflected host in the generated link.
  4. A positive result is a cached page containing the attacker's host.
Or watch on YouTube
From the original on kongsec.medium.com

In each case, confirm the interaction actually originates from the application rather than from your own browser.

Glossary

  • Host header: The part of an HTTP request that tells the server which website the client wants to reach. It is sent by the browser and can be modified by an attacker using tools.
  • DNS: Domain Name System, the internet's directory that translates human-readable domain names into IP addresses.
  • IP address: A numeric label assigned to each device on a network, used to identify where to send data.
  • HTTP interaction: A request that arrives at a server or service, recorded for analysis. In Burp Collaborator, it means a request was made to the collaborator subdomain.
  • Burp Collaborator: A service by PortSwigger that provides unique subdomains and logs any HTTP or DNS interactions, used to detect out-of-band vulnerabilities.
  • Burp Repeater: A tool in Burp Suite that allows you to modify and resend HTTP requests manually.
  • WAF (Web Application Firewall): A security layer that filters and monitors HTTP traffic to protect web applications from attacks.
  • Akamai, Cloudflare: Content delivery networks and security services that often include WAF capabilities.
  • SSRF (Server-Side Request Forgery): A vulnerability where an attacker can make a server perform requests to arbitrary destinations.
  • Open redirect: A vulnerability where an application redirects users to a URL specified in the request, which can be used for phishing.
  • Account takeover (ATO): A type of attack where an attacker gains unauthorised access to a user's account.
  • Password reset flow: The process by which a user requests a password reset, receives an email with a link containing a token, and uses that link to set a new password.
  • Token: A unique, secret string used to authenticate a user or authorise an action, often included in links.
  • Allow-list: A list of permitted values; in this context, a list of valid hostnames that the application should accept.
  • Cache poisoning: An attack where an attacker manipulates a cached response to serve malicious content to other users.
  • X-Forwarded-Host, X-Host: HTTP headers that can carry the original host when a request passes through a proxy; applications may use them to build URLs.

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.