Skip to content
Account takeover Write-up Beginner

UN United Nations Host Header Injection leads to any Full Account Takeover (ATO)

The password reset feature built its reset link from the incoming Host header without validating it, so a manipulated header made the application generate a link pointing at an attacker-controlled domain. An attacker could send that poisoned reset link to a victim and receive the reset token, allowing takeover of any account including administrators.

Ahmed Hassan Follow

Published on medium.com

Hey all. I hope you are all safe and good.

Ahmed Hassan (Bishoo97x), 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. 4 min read.

Context

The target was a web application belonging to the United Nations, reachable on a subdomain of the UN estate. The feature at the centre of the report is the password reset flow: a user submits a reset request, the application generates a reset link containing a token, and that link is delivered so the user can set a new password. The researcher describes the outcome as full account takeover of any account on the platform, including administrative accounts.

Setup

The researcher enumerated subdomains and picked one where self-registration was possible, registering a test user called, for example, target.com. No specific tooling versions are given beyond Burp (a Burp Collaborator link is mentioned as the delivery mechanism for the exploit). The precondition is simply an account on the affected subdomain and access to the password reset functionality.

From the original on medium.com

Finding it

After registering the test user, the researcher looked for low-hanging fruit and found nothing. Attention then moved to the password reset functionality, and from there to testing for host header injection.

The reasoning is straightforward: if the application builds the reset link from the incoming Host header rather than from a fixed, configured base URL, an attacker who controls that header controls the domain in the link. The victim receives a link pointing at the attacker, and the token travels with it.

From the original on medium.com

Exploitation

Step 1: request a password reset normally

The researcher triggered a password reset for the test user. The application redirected to the UN website, which generated a password reset link containing a token. This established the baseline behaviour: the link is generated server-side and includes a token.

From the original on medium.com

Step 2: manipulate the Host header

The next step was to change the Host header to evil.com and observe whether the generated reset link used the attacker-controlled domain. The report states the application accepted the manipulated header and generated the reset link with that domain.

From the original on medium.com

The important parts: the Host header is attacker-supplied input on the reset request, and the application reflects it into the absolute URL of the reset link.

Step 3: deliver the link and capture the token

With the misconfiguration confirmed, the researcher describes putting a Burp Collaborator link in place of evil.com, sending the resulting reset link to any user, and receiving the clear-text reset login credentials. That gives the attacker the token and therefore the ability to complete the reset and take over the account.

From the original on medium.com

The report does not include the raw request or response for this step, only the description of the technique and the outcome. The researcher notes that any account could be taken over this way, including admin accounts.

Root cause

The application derives the base URL for the password reset link from the client-supplied Host header instead of from a trusted, server-side configuration value. The application accepted the manipulated header and reflected it into the link. The weakness is in how the link is assembled and trusted.

The report does not describe any defence that was present and bypassed.

Impact

An attacker can cause a reset link pointing at a domain they control to be generated and send it to a victim. When a victim clicks such a link, the token is delivered to the attacker, who can then reset the victim's password and take over the account. The researcher states that any account on the platform could be affected, including administrative accounts. The report does not discuss whether the victim needs to be logged out, whether the token expires, or any other limiting conditions.

Fix

The report does not state what was changed. The appropriate fix is to stop deriving the reset link from the Host header and instead use a fixed, configured base URL, or to validate the header against a strict allowlist of expected hostnames and reject or ignore anything else. Reset tokens should also be single-use and short-lived, and the reset endpoint should not leak whether an address exists.

Variants to test

  1. X-Forwarded-Host and similar headers. Send a reset request with X-Forwarded-Host: attacker.example (and X-Forwarded-For, Forwarded, X-Host, X-Original-Host) and check whether the generated link uses the attacker domain. A positive result is a reset link whose host is the attacker-controlled value.
  2. Absolute URL in the request line. Request the reset endpoint with an absolute URI such as POST https://attacker.example/reset HTTP/1.1 and see whether the application builds the link from the request target. A positive result is the same reflected host in the link.
  3. Host header with port or trailing dot. Try Host: target.com:evil.example, Host: target.com.evil.example and Host: target.com. to see whether naive parsing or suffix matching lets the attacker domain through. A positive result is a link pointing at the attacker domain despite the allowlist.
  4. Multiple Host headers. Send two Host headers and observe which one the application uses. A positive result is the link using the attacker-supplied value.
  5. Password reset for other flows. Apply the same manipulation to email verification, invitation links, magic login links and any other feature that emails a token-bearing URL. A positive result is any of those links pointing at the attacker domain.
  6. Cache poisoning angle. If the reset page or a related response is cached, check whether a manipulated Host header poisons the cached response for other users. A positive result is another user receiving a page or link containing the attacker domain without sending the header themselves.

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

What happened, in plain words

A security researcher found a bug in a United Nations website that let an attacker take over any user account, including administrator accounts. The bug was in the password reset feature. When you forget your password, the site emails you a link with a special code (a token) that lets you set a new password. The researcher discovered that the site built that link using a value the visitor's browser sends, called the Host header, instead of using a fixed, trusted address. By changing that header, an attacker could make the site send a reset link pointing to a domain the attacker controls. The token would be sent to the attacker, who could then reset the victim's password and take over the account. The researcher tested this on a subdomain where anyone could register, and it worked. The report does not say whether the issue was fixed or what the fix was.

From the original on medium.com

Background: what you need to know

Before diving into the steps, here are the basic ideas you need to understand. If you already know them, feel free to skip ahead.

  • Web application: a program that runs on a server and is accessed through a browser. When you visit a site and log in, you are using a web application.
  • Subdomain: a part of a larger domain name. For example, mail.example.com is a subdomain of example.com. Organisations often have many subdomains for different services.
  • Host header: every time your browser asks a web server for a page, it sends a small piece of text called the Host header. This tells the server which website you want, especially when many websites share the same server. It is like writing the address on an envelope: the postal service uses it to deliver your letter to the right place.
  • Password reset flow: the feature that lets you recover access to your account when you forget your password. Typically, you enter your email address, the site sends you an email with a link containing a unique token, and clicking that link lets you set a new password.
  • Token: a long, random string of characters that acts like a temporary key. In a password reset, the token proves that whoever clicks the link has access to the email inbox associated with the account. It is similar to a one-time code you might receive by text message.
  • Host header injection: a vulnerability where an application trusts the Host header sent by the client and uses it to build links or make decisions. An attacker can change this header to a value they control, potentially tricking the application into sending sensitive information to the attacker's server.
  • Account takeover (ATO): when an attacker gains full control of someone else's account, often by resetting the password or stealing session cookies.
  • Burp Collaborator: a tool that provides a unique domain name and server that an attacker can use to detect and capture interactions, such as HTTP requests or DNS lookups, that occur as a result of a vulnerability. It is often used to confirm out-of-band vulnerabilities like this one.

Step-by-step: how the researcher found and exploited the bug

1. Finding a suitable subdomain and registering a test user

The researcher started by looking for subdomains of the United Nations' online presence. After enumerating many subdomains, they focused on one where it was possible to create a new user account. They registered a test user called, for example, target.com. The goal was to have a working account to test the password reset feature.

From the original on medium.com

After registering, the researcher tried some common, easy-to-find vulnerabilities (often called "low-hanging fruit") but found nothing. So they turned their attention to the password reset functionality.

2. Understanding the password reset flow

When you use the "forgot password" feature, the application typically does the following:

  1. You enter your email address.
  2. The application generates a unique token and stores it, linking it to your account.
  3. It sends an email to your address containing a link. The link usually looks like `https://example.com/reset?[redacted]
  4. When you click the link, the application checks the token and lets you set a new password.

The critical part is how the application builds that link. If it uses a fixed, configured base URL (like https://example.com), it is safe. But if it uses the Host header from the incoming request, an attacker can manipulate it.

3. Testing for host header injection

The researcher requested a password reset for the test user. The application redirected to the UN website and generated a reset link containing a token. This was the normal behaviour.

From the original on medium.com

Next, the researcher wondered: what if I change the Host header to evil.com? Will the application generate the reset link using that domain? They tried it, and the application did exactly that: it accepted the manipulated header and produced a reset link pointing to evil.com.

From the original on medium.com

This confirmed the vulnerability. The application was using the Host header to construct the reset link.

4. Exploiting the vulnerability to take over accounts

With the misconfiguration confirmed, the researcher described how an attacker could exploit it. Instead of evil.com, the attacker would use a domain they control, such as a Burp Collaborator link. They would then send the crafted reset link to a victim. When the victim clicks the link, the token is sent to the attacker's server. The attacker can then use that token to reset the victim's password and take over the account.

From the original on medium.com

The researcher noted that any account could be taken over this way, including administrator accounts. The report does not include the raw HTTP request or response for this step, only the description of the technique and the outcome.

Why this works: the root cause

The application derives the base URL for the password reset link from the client-supplied Host header instead of from a trusted, server-side configuration value. The application accepted the manipulated header and reflected it into the link. The weakness is in how the link is assembled and trusted.

The report does not describe any defence that was present and bypassed.

Impact

An attacker can cause a reset link pointing at a domain they control to be generated and send it to a victim. When a victim clicks such a link, the token is delivered to the attacker, who can then reset the victim's password and take over the account. The researcher states that any account on the platform could be affected, including administrative accounts. The report does not discuss whether the victim needs to be logged out, whether the token expires, or any other limiting conditions.

How to fix it

The appropriate fix is to stop deriving the reset link from the Host header and instead use a fixed, configured base URL, or to validate the header against a strict allowlist of expected hostnames and reject or ignore anything else. Reset tokens should also be single-use and short-lived, and the reset endpoint should not leak whether an address exists.

Other things to test

  1. X-Forwarded-Host and similar headers. Send a reset request with X-Forwarded-Host: attacker.example (and X-Forwarded-For, Forwarded, X-Host, X-Original-Host) and check whether the generated link uses the attacker domain. A positive result is a reset link whose host is the attacker-controlled value.
  2. Absolute URL in the request line. Request the reset endpoint with an absolute URI such as POST https://attacker.example/reset HTTP/1.1 and see whether the application builds the link from the request target. A positive result is the same reflected host in the link.
  3. Host header with port or trailing dot. Try Host: target.com:evil.example, Host: target.com.evil.example and Host: target.com. to see whether naive parsing or suffix matching lets the attacker domain through. A positive result is a link pointing at the attacker domain despite the allowlist.
  4. Multiple Host headers. Send two Host headers and observe which one the application uses. A positive result is the link using the attacker-supplied value.
  5. Password reset for other flows. Apply the same manipulation to email verification, invitation links, magic login links and any other feature that emails a token-bearing URL. A positive result is any of those links pointing at the attacker domain.
  6. Cache poisoning angle. If the reset page or a related response is cached, check whether a manipulated Host header poisons the cached response for other users. A positive result is another user receiving a page or link containing the attacker domain without sending the header themselves.

Glossary

  • Subdomain: a part of a larger domain name, like mail.example.com being a subdomain of example.com.
  • Host header: an HTTP header that tells the server which website the client wants to reach.
  • Password reset flow: the feature that lets users recover access to their account by receiving a link with a token via email.
  • Token: a unique, often random string used to authenticate or authorise an action, such as resetting a password.
  • Host header injection: a vulnerability where an application trusts the Host header from the client and uses it to build links or make security decisions.
  • Account takeover (ATO): when an attacker gains full control of someone else's account.
  • Burp Collaborator: a tool that provides a unique domain and server to detect and capture out-of-band interactions, such as HTTP requests, that occur as a result of a vulnerability.
  • Allowlist: a list of trusted values that are explicitly permitted; anything not on the list is rejected.
  • Cache poisoning: an attack where an attacker manipulates a cached response so that other users receive malicious content.

More by Ahmed Hassan

View all

4 more disclosed reports, best first.

More from United Nations

View all

The newest disclosed reports for this program.

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.