Skip to content
Open redirect Disclosed report Beginner

Host Header is not validated resulting in Open Redirect

The web server did not validate the Host header, so a request with an arbitrary Host value was redirected to that domain. An attacker could use this for open redirect, and potentially for web cache poisoning or password reset poisoning, though the password reset flow was verified not to use the Host header.

anshuman_bh Follow

Originally disclosed on HackerOne

Bounty$100 View original
  • Triaged in 5 days
  • Fixed in 11 days
  • Paid in 16 days
  • Disclosed after 12 days

Please see the attached screenshot where I am sending a request to irccloud.com with an invalid HOST header and I am getting redirected to that domain. This is because the HOST header is not validated to ensure that the request is originating from that target host or not.

http://www.skeletonscribe.net/2013/05/practical-http-host-header-attacks.html http://carlos.bueno.org/2008/06/host-header-injection.html The above links mention 2 different ways to exploit this issue:

  1. web-cache poisoning and/or
  2. Using alternate channels like password reset emails.

For the first way, it can be exploited by poisoning a cache with the attacker's domain and then serving that poisoned response to legitimate users, causing them to redirect to the attacker's domain. This attack kind of varies depending on different web servers as they interpret duplicate Host headers in different ways. The attack vectors are very well explained in the above blogs so I don't want to re-iterate them here again.

For the second way, I verified that the password reset functionality on the IRC Cloud website does not retrieve the Host header when sending emails. But, validating the Host header is always a good practice.

The original report as published on HackerOne, by anshuman_bh. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

IRCCloud is a web-based IRC client. The report concerns the web application served at irccloud.com, specifically how it handles the HTTP Host header. Normally, a web server uses the Host header to determine which site or application the client is requesting, and it should validate that the header matches a host it is configured to serve. If it does not, the server may use the supplied value in redirects or other responses, which can lead to open redirect and related attacks.

Setup

The researcher used a simple HTTP request to irccloud.com with a modified Host header. No special accounts, tools or versions are mentioned. The only precondition is the ability to send a request with an arbitrary Host header, which any HTTP client allows.

Finding it

The researcher noticed that when sending a request to irccloud.com with an invalid Host header, the server responded with a redirect to the domain supplied in that header. The behaviour indicated that the Host header was not validated to ensure the request was originating from the target host. The researcher referenced two public articles on HTTP Host header attacks for background:

  • http://www.skeletonscribe.net/2013/05/practical-http-host-header-attacks.html
  • http://carlos.bueno.org/2008/06/host-header-injection.html

Those articles describe two exploitation methods: web-cache poisoning and use of alternate channels such as password reset emails.

Exploitation

Step 1: Send a request with an invalid Host header

The researcher sent a request to irccloud.com with an invalid Host header. The exact request is not included in the report, but the result was a redirect to the domain specified in that header. The report refers to an attached screenshot showing the request and the redirect.

Because the Host header is not validated, the server uses the attacker-controlled value when constructing the redirect. This is the core of the open redirect.

Step 2: Consider web-cache poisoning

The first exploitation method is web-cache poisoning. An attacker can poison a cache with a response that redirects to the attacker's domain, and then serve that poisoned response to legitimate users. The attack varies depending on the web server, because different servers interpret duplicate Host headers in different ways. The researcher refers to the linked articles for the detailed attack vectors and does not repeat them.

Step 3: Check the password reset channel

The second method uses alternate channels such as password reset emails. The researcher verified that the password reset functionality on the IRCCloud website does not retrieve the Host header when sending emails. Therefore, this particular channel was not exploitable in the way described. Nevertheless, the researcher notes that validating the Host header is always good practice.

Root cause

The root cause is that the application does not validate the Host header to ensure it matches a host the application is configured to serve. As a result, the server trusts the client-supplied Host value and uses it in a redirect, leading to an open redirect. The report does not describe any specific code or configuration, but the behaviour is consistent with the server using the Host header directly when generating the redirect location.

Impact

An attacker could craft a request with a malicious Host header and cause the server to redirect to an attacker-controlled domain. If the response is cached, other users could be served the poisoned redirect, potentially leading them to a phishing site or other malicious content. The impact depends on whether a cache is present and how it handles the Host header. The password reset channel was checked and found not to use the Host header, so that vector was not available in this case. The report does not provide further details on the number of users affected or other conditions.

Fix

The report does not state what fix was applied. The recommended practice is to validate the Host header against a whitelist of allowed hosts and to avoid using it directly in redirects or other responses. The researcher notes that validating the Host header is always good practice, even though the password reset channel was not affected.

Variants to test

  • Test other endpoints that perform redirects, such as login, logout, or any URL that includes a redirect or next parameter, by supplying a malicious Host header. A positive result is a redirect to the attacker-controlled domain.
  • Test for web-cache poisoning by sending requests with duplicate Host headers and observing whether the cache stores a response that redirects to the attacker's domain. A positive result is that subsequent requests without the malicious header receive the poisoned response.
  • Test password reset and other email-generating functionality to see if the Host header is used in the email content (e.g. links). A positive result is an email containing a link to the attacker's domain.
  • Test other headers that might be used in redirects, such as X-Forwarded-Host or X-Host, if the application or its proxies support them. A positive result is similar: a redirect to an attacker-controlled domain.

Hunting notes

This kind of bug tends to hide in applications that use the Host header to construct absolute URLs, especially in redirects, password reset links, and cache keys. During recon, look for endpoints that return redirects and check whether the Location header reflects the supplied Host. Also check for caching layers that might store responses keyed on the Host header. The researcher showed the redirect and checked the password reset channel, which was not vulnerable.

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

What happened, in plain words

IRCCloud is a website that lets people connect to IRC (a type of chat network) from their browser instead of installing a separate chat program. The report is about the main IRCCloud website at irccloud.com and, in particular, about one small piece of information that every browser sends to every website: the Host header.

When your browser asks a web server for a page, it includes a short note saying which website it wants. That note is the Host header. Think of it like writing the name of the shop on an envelope before posting a letter: the postal service (the server) reads the name to know which shop should open the letter. A well-behaved server checks that the name on the envelope is one of the shops it actually runs. If it does not check, it might blindly trust whatever name is written there, and that is where trouble starts.

The researcher found that IRCCloud did not check the name. When a request arrived with a made-up Host value, the server answered by redirecting the visitor to that made-up domain. A redirect is simply the server telling your browser "go to this other address instead". If an attacker can choose that other address, they can send people to a site they control. This kind of flaw is called an open redirect.

Background: what a Host header is

Every time you type an address into your browser, the browser opens a connection to a server and sends a request. The first line of that request names the page, and among the headers that follow is Host. It looks roughly like this in concept:

A single server can host many different websites. The Host header is how the server knows which one you want. Because the value comes from the client (your browser, or any program pretending to be one), the server must not trust it blindly. It should compare it against a list of names it is configured to serve and reject anything else.

The finding

The researcher sent a request to irccloud.com but replaced the normal Host value with an invalid one. The server responded with a redirect to the domain that had been placed in the Host header. In other words, the server took the client's word for which domain it was serving and used that word when building the redirect.

The report refers to an attached screenshot showing the request and the redirect. The exact request is not included in the report either; what matters is the behaviour: an invalid Host value produced a redirect to that value.

To explain the background, the researcher linked two public articles on HTTP Host header attacks:

  • http://www.skeletonscribe.net/2013/05/practical-http-host-header-attacks.html
  • http://carlos.bueno.org/2008/06/host-header-injection.html

Those articles describe two ways such a flaw can be exploited: web-cache poisoning, and the use of alternate channels such as password reset emails. The researcher did not repeat the details of those articles, so the report itself only names the two methods.

Exploitation

Step 1: Send a request with an invalid Host header

The first step was simply to send a request to irccloud.com with a Host header that did not belong to IRCCloud. The purpose was to see whether the server would notice. It did not: it redirected to the domain named in the header.

Why does this matter? A redirect is a normal, helpful feature. Websites use it all the time, for example to send you from an old address to a new one. But when the destination is taken from user-supplied input, an attacker can supply their own destination. The victim clicks a link that appears to belong to IRCCloud, and ends up on the attacker's site instead. That is the core of the open redirect.

Step 2: Consider web-cache poisoning

The first exploitation method is web-cache poisoning. To understand it, you need to know what a cache is. A cache is a storage layer that sits between visitors and the real server and keeps copies of responses so that the next visitor gets them faster. Think of a photocopier in a busy office: the first person photocopies a document, and everyone after that takes a copy instead of going back to the original.

If an attacker can make the cache store a response that redirects to the attacker's domain, then every later visitor who receives that stored copy is sent to the attacker's site. The attacker does not need to trick each person individually; the cache does the work.

The researcher notes that this attack varies depending on the web server, because different servers interpret duplicate Host headers in different ways. A duplicate Host header means sending the header twice in the same request, with two different values. Servers disagree about which one to believe, and that disagreement is what an attacker can exploit. The report points to the linked articles for the detailed attack vectors and does not repeat them.

Step 3: Check the password reset channel

The second method uses alternate channels, and the example given is password reset emails. When you forget your password, a website usually emails you a link to set a new one. If the website builds that link using the Host header, an attacker can make the link point to their own domain. The victim receives a genuine-looking email from the real service, clicks the link, and lands on the attacker's copy of the site, where they may type their new password.

The researcher checked this on IRCCloud and found that the password reset functionality does not retrieve the Host header when sending emails. So this particular channel was not exploitable in the way described. Even so, the researcher notes that validating the Host header is always good practice.

Root cause

The root cause is that the application does not validate the Host header to make sure it matches a host the application is configured to serve. Because of that, the server trusts a value supplied by the client and uses it when building a redirect. The report does not describe any specific code or configuration, but the behaviour is consistent with the server using the Host header directly when generating the redirect location.

Impact

An attacker could craft a request with a malicious Host header and cause the server to redirect to a domain they control. If the response is cached, other users could be served the poisoned redirect, potentially leading them to a phishing site or other malicious content. How serious this is depends on whether a cache is present and how it handles the Host header. The password reset channel was checked and found not to use the Host header, so that vector was not available in this case. The report does not give further details on the number of users affected or other conditions.

Fix

The recommended practice is to validate the Host header against a whitelist of allowed hosts and to avoid using it directly in redirects or other responses. A whitelist is simply a list of the names the server is allowed to answer for; anything not on the list is rejected. The researcher notes that validating the Host header is always good practice, even though the password reset channel was not affected.

Variants to test

  • Test other endpoints that perform redirects, such as login, logout, or any URL that includes a redirect or next parameter, by supplying a malicious Host header. A positive result is a redirect to the attacker-controlled domain.
  • Test for web-cache poisoning by sending requests with duplicate Host headers and observing whether the cache stores a response that redirects to the attacker's domain. A positive result is that later requests without the malicious header receive the poisoned response.
  • Test password reset and other email-generating functionality to see if the Host header is used in the email content (for example, in links). A positive result is an email containing a link to the attacker's domain.
  • Test other headers that might be used in redirects, such as X-Forwarded-Host or X-Host, if the application or its proxies support them. A positive result is similar: a redirect to an attacker-controlled domain.

Hunting notes

This kind of bug tends to hide in applications that use the Host header to construct absolute URLs, especially in redirects, password reset links and cache keys. During recon, look for endpoints that return redirects and check whether the Location header reflects the supplied Host. The Location header is the part of a redirect response that tells the browser where to go next. Also check for caching layers that might store responses keyed on the Host header. The researcher showed the redirect and checked the password reset channel, which was not vulnerable.

Glossary

  • Host header: a line in every HTTP request that names the website the client wants; the server uses it to pick which site to serve.
  • HTTP: the language browsers and web servers use to exchange requests and responses.
  • Request: the message a browser (or any client) sends to a server asking for something.
  • Response: the message a server sends back, such as a page, an error or a redirect.
  • Redirect: a response that tells the browser to go to a different address instead.
  • Open redirect: a flaw where a site lets an attacker choose where a redirect sends the visitor.
  • Header: a labelled line of extra information attached to a request or response, such as Host.
  • Domain: the name of a website, such as irccloud.com.
  • Endpoint: a specific address or feature on a website that performs an action, such as login or password reset.
  • Web-cache poisoning: tricking a cache into storing a malicious response and serving it to other visitors.
  • Cache: a storage layer that keeps copies of responses so later visitors get them faster.
  • Duplicate Host header: sending the Host header more than once in the same request, with different values.
  • Password reset channel: the feature that emails a link to set a new password when a user forgets theirs.
  • Phishing: tricking someone into visiting a fake site or handing over credentials by pretending to be a trusted service.
  • Whitelist: a list of values that are explicitly allowed; anything not on the list is rejected.
  • Location header: the part of a redirect response that gives the address the browser should go to.
  • X-Forwarded-Host / X-Host: extra headers sometimes used by proxies to pass along the original host name.
  • Proxy: an intermediary server that forwards requests between clients and the real server.
  • Recon: the early stage of testing where you map out a site's features and endpoints.
  • Bounty: a payment made by a company to a researcher who reports a valid security issue.

More by anshuman_bh

View all

18 more disclosed reports, best first.

More from IRCCloud

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Open redirect

The lesson behind this report.

A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.