Skip to content
Misconfiguration Disclosed report Beginner

Host Header Injection/Redirection

The application reflects the Host header in a redirect, allowing an attacker to supply an arbitrary domain and cause a 301 redirect to that domain. This could be abused in password reset flows or hyperlink manipulation if the backend uses the hostname.

xer0dayz Follow

Originally disclosed on HackerOne

Bounty$30 View original
  • Fixed in 49 days
  • Paid in 49 days
  • Disclosed after 3 months

whisper.sh is vulnerable to host header injection because the host header can be changed to something outside the target domain (ie. whisper.sh) and cause it to redirect to to that domain instead (see below).

Attack vectors are somewhat limited but depends on how the host header is used by the back-end application code. If code references the hostname used in the URL such as password reset pages, an attacker could spoof the host header of the request in order to trick the application to forwarding the password reset email to the attackers domain instead, etc. Other attack vectors may also be possible through manipulation of hyperlinks or other misc. code that relies on the host/domain of the request.

GET / HTTP/1.1 Host: crowdshield.com User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Connection: keep-alive

HTTP/1.1 301 Moved Permanently Content-length: 0 Location: https://crowdshield.com/ Connection: close

If you search Google for this vulnerability, there are many, many blogs, articles and white papers describing this vulnerability and associated attack vectors. Every major commercial web application scanner like Accunetix will report this same vulnerability.

For more details, please read: https://www.acunetix.com/blog/articles/automated-detection-of-host-header-attacks/.

Normally, most apps will reject any request that doesn't originate from the same origin (ie. whisper.sh). To fix, the application should reject anything that doesn't match the target domain. This may also be an error in the rewrite functions of the back-end web server as well.

Attachments

Host_Header_Injection.png
Host_Header_Injection.png From the original on HackerOne

The original report as published on HackerOne, by xer0dayz. 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

Whisper is a service reachable at whisper.sh. The report concerns how that host handles the HTTP Host header. Normally a web server uses the Host header to decide which site or virtual host a request is for, and an application that builds absolute URLs (redirects, links, password reset emails) from that value should only ever trust a hostname that belongs to it. In this case the researcher found that the value could be set to a domain outside whisper.sh and that the server would then redirect the client to that foreign domain.

The weakness is classified as an open redirect. The report itself frames it as host header injection, with the redirect being the observable symptom.

Setup

No accounts, roles or special tooling are described. The researcher sent a single plain HTTP request with a modified Host header and recorded the response. The request advertises Firefox 18 on 64-bit Linux in its User-Agent, but nothing in the report depends on that.

Finding it

The researcher observed that the Host header could be changed to something outside the target domain, and that the application would redirect to that domain instead. The example used in the report is crowdshield.com. That behaviour is the whole finding: the server echoes an attacker-controlled hostname back in a Location header.

Exploitation

Step 1: Send a request with a foreign Host header

The researcher issued a GET for the root path, replacing the legitimate host with crowdshield.com:

HTTP
GET / HTTP/1.1
Host: crowdshield.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive

The only part that matters for the bug is the Host line. The remaining headers are ordinary browser defaults and do not influence the result.

Step 2: Read the response

The server answered with a permanent redirect pointing at the injected host:

HTTP
HTTP/1.1 301 Moved Permanently
Content-length: 0
Location: https://crowdshield.com/
Connection: close

The Location header is built from the supplied Host value, so the client is sent to https://crowdshield.com/ rather than to whisper.sh. The body is empty (Content-length: 0), so the redirect is the entire response.

Host_Header_Injection.png
Host_Header_Injection.png From the original on HackerOne

The attachment shows the request and the resulting redirect as captured by the researcher.

Root cause

The application, or the rewrite layer in front of it, derives the redirect target from the request's Host header without checking that the value matches the expected domain. The report notes that this may also be an error in the rewrite functions of the back-end web server, so the exact component at fault is not pinned down. The report's own framing is that most applications reject requests that do not originate from the same origin, and that this one does not.

Impact

The report is explicit that the attack vectors are somewhat limited and depend on how the back-end application code uses the host header. The concrete scenario it gives is password reset: if the code references the hostname from the URL when building links in a password reset page, an attacker could spoof the host header so that the application sends the password reset email pointing at the attacker's domain instead. The report hedges this with "could" and "etc.", so it is a plausible consequence rather than a demonstrated one. It also mentions that other vectors may be possible through manipulation of hyperlinks or other code that relies on the request's host or domain.

Nothing in the report demonstrates a password reset flow, an email, or any victim interaction. The demonstrated impact is the redirect itself.

Fix

The report recommends that the application reject anything that does not match the target domain, and notes that the problem may lie in the back-end web server's rewrite functions. It does not state what was actually changed.

Variants to test

  • Password reset and invitation flows. Trigger a reset for an account you control while supplying a foreign Host. A positive result is a reset link in the delivered email whose hostname is the one you injected.
  • Other absolute-URL generation. Any feature that emits a full URL (canonical links, share links, OAuth or SSO callbacks, email templates) is worth checking with a modified Host. A positive result is your hostname appearing in the generated URL.
  • Redirecting endpoints. Request paths that are known to redirect and vary the Host header. A positive result is a Location header pointing at your host, as in the response above.
  • Cached responses. If a response influenced by the Host header is cached, check whether a later request with the legitimate host receives the poisoned redirect. A positive result is the foreign Location served to a normal visitor.

Hunting notes

This kind of bug hides wherever the application turns the request host into an absolute URL: redirect handlers, password reset and account invitation emails, and link generation in templates. During recon, the signal is any endpoint that answers with a Location header or emits absolute links, since those are the places where the host value is most likely to be trusted. The researcher paired the raw request and response with a speculative password reset scenario, which the report presents as a possible consequence rather than a demonstrated one. The report was disclosed on 6 January 2016 and carries a bounty of 30.00 USD.

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

Whisper is a service at whisper.sh. When your browser asks a website for a page, it sends a small note called the Host header that says which site it wants. Normally the server checks that note and only answers for its own site. Here, the researcher found that the server would accept a different site name in that note and then send the browser off to that other site instead. The report calls this host header injection, and the visible result is an open redirect: the server tells the browser to go somewhere else, and it does so based on a value the visitor controls.

The report shows one request and one response. The request asks for the front page but claims to be for crowdshield.com. The response is a permanent redirect to https://crowdshield.com/. That is the whole demonstrated finding. The report also explains why this can matter in other places, such as password reset emails, but it does not show that part working.

Background you need

A web page is fetched with HTTP. Your browser sends a request made of lines: a method and a path, then headers, which are name and value pairs. The server replies with a status line, headers and sometimes a body.

The Host header is how the browser tells the server which website it wants. One server can host many sites, so the server uses this value to pick the right one. If an application builds full web addresses (for example a redirect or a link in an email) from that value without checking it, an attacker can put their own domain there and the application will use it.

A redirect is a response with a status code in the 300s and a Location header. The browser reads Location and goes there automatically. A 301 means permanent redirect.

An open redirect is a bug where a site will redirect visitors to any address supplied by the request, including addresses outside the site. Attackers use it to make a link that looks like it belongs to the trusted site but leads elsewhere.

A password reset flow is a common feature: you enter your email, the site sends you a message with a link, and that link lets you set a new password. If the site builds that link from the Host header, an attacker who can influence the header could make the link point at their own domain.

Finding it

The researcher noticed that the Host header could be changed to something outside the target domain, and that the application would redirect to that domain instead. The example used in the report is crowdshield.com. In other words, the server takes the hostname from the request and puts it into the Location header of its response.

Exploitation

Step 1: Send a request with a foreign Host header

The researcher sent a request for the root path (/), but replaced the host with crowdshield.com:

HTTP
GET / HTTP/1.1
Host: crowdshield.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive

Line by line:

  • GET / HTTP/1.1 asks for the root page using version 1.1 of HTTP.
  • Host: crowdshield.com is the important line. It tells the server the request is for crowdshield.com instead of whisper.sh.
  • User-Agent says which browser is making the request. Here it claims Firefox 18 on 64-bit Linux. This line does not affect the bug.
  • Accept lists the kinds of content the browser will accept.
  • Accept-Language says the browser prefers US English.
  • Accept-Encoding says the browser can handle compressed responses.
  • Connection: keep-alive asks to keep the network connection open for more requests.

Only the Host line matters for this test. The other headers are normal browser defaults.

Step 2: Read the response

The server replied with a permanent redirect to the injected host:

HTTP
HTTP/1.1 301 Moved Permanently
Content-length: 0
Location: https://crowdshield.com/
Connection: close

Line by line:

  • HTTP/1.1 301 Moved Permanently is the status line. 301 means the page has moved permanently, and the browser should follow the new address.
  • Content-length: 0 says the response body is empty.
  • Location: https://crowdshield.com/ is the new address. It was built from the Host value that was sent, so the browser is sent to https://crowdshield.com/ rather than to whisper.sh.
  • Connection: close says the connection will be closed after this response.

Because the body is empty, the redirect is the entire response.

Host_Header_Injection.png
Host_Header_Injection.png From the original on HackerOne

The attachment shows the request and the resulting redirect as captured by the researcher.

Root cause

The application, or the rewrite layer in front of it, takes the redirect target from the request's Host header without checking that the value matches the expected domain. The report notes that this may also be an error in the rewrite functions of the back-end web server, so the exact component at fault is not pinned down. The report's own framing is that most applications reject requests that do not originate from the same origin, and that this one does not.

Impact

The report is explicit that the attack vectors are somewhat limited and depend on how the back-end application code uses the host header. The concrete scenario it gives is password reset: if the code references the hostname from the URL when building links in a password reset page, an attacker could spoof the host header so that the application sends the password reset email pointing at the attacker's domain instead. The report hedges this with "could" and "etc.", so it is a plausible consequence rather than a demonstrated one. It also mentions that other vectors may be possible through manipulation of hyperlinks or other code that relies on the request's host or domain.

Nothing in the report demonstrates a password reset flow, an email, or any victim interaction. The demonstrated impact is the redirect itself.

Fix

The report recommends that the application reject anything that does not match the target domain, and notes that the problem may lie in the back-end web server's rewrite functions. It does not state what was actually changed.

Variants to test

  • Password reset and invitation flows. Trigger a reset for an account you control while supplying a foreign Host. A positive result is a reset link in the delivered email whose hostname is the one you injected.
  • Other absolute-URL generation. Any feature that emits a full URL (canonical links, share links, OAuth or SSO callbacks, email templates) is worth checking with a modified Host. A positive result is your hostname appearing in the generated URL.
  • Redirecting endpoints. Request paths that are known to redirect and vary the Host header. A positive result is a Location header pointing at your host, as in the response above.
  • Cached responses. If a response influenced by the Host header is cached, check whether a later request with the legitimate host receives the poisoned redirect. A positive result is the foreign Location served to a normal visitor.

Hunting notes

This kind of bug hides wherever the application turns the request host into an absolute URL: redirect handlers, password reset and account invitation emails, and link generation in templates. During recon, the signal is any endpoint that answers with a Location header or emits absolute links, since those are the places where the host value is most likely to be trusted. The researcher paired the raw request and response with a speculative password reset scenario, which the report presents as a possible consequence rather than a demonstrated one. The report was disclosed on 6 January 2016 and carries a bounty of 30.00 USD.

Glossary

  • Host header: a line in an HTTP request that tells the server which website the browser wants.
  • HTTP: the language browsers and servers use to exchange web pages.
  • Header: a name and value pair sent with an HTTP request or response.
  • Redirect: a response that tells the browser to go to a different address.
  • 301: an HTTP status code meaning the page has moved permanently.
  • Location header: the part of a redirect response that holds the new address.
  • Open redirect: a bug where a site will redirect visitors to any address supplied in the request, including outside the site.
  • Host header injection: a bug where an attacker can change the Host header and the application uses that value in a way it should not, such as building a redirect or a link.
  • Origin: the combination of scheme, host and port that identifies a site, for example https://whisper.sh.
  • Password reset flow: the feature that lets you reset your password by email.
  • Rewrite layer: the part of a web server that changes incoming request paths or addresses before passing them to the application.
  • Absolute URL: a full web address that includes the scheme and hostname, such as https://crowdshield.com/.
  • Cache: a store of previous responses that can be reused for later requests.
  • Recon: the early stage of security testing where you look for places worth testing.
  • Bounty: a payment made by a company to a researcher who reports a security bug.

More by xer0dayz

View all

5 more disclosed reports, best first.

More from Whisper

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Security misconfiguration

The lesson behind this report.

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.