Invalid Host detection at https://hackerone.com/redirect
The external link warning page on hackerone.com/redirect detects and highlights the host to prevent phishing, but the detection can be bypassed using whitespace characters like %0D, %0A, %00, %09. An attacker can craft a link that appears to go to a trusted host but actually redirects the victim to a different host, including an IDN homograph site.
Originally disclosed on HackerOne
- Triaged in 11 hours
- Fixed in 18 days
- Paid in 18 days
- Disclosed after 48 days
Hello,99
Summary: Host detection at https://hackerone.com/redirect is invalid and insecure.
Description : On redirection page, host is detected and highlighted to prevent phishing attacks. But that protection is weak and can be bypassed. So an attacker can redirect victim on another host instead of highlighted host. Also, it possible to redirect victim on a IDN homograph website.
Host filtration can be bypassed using whitespace characters like %0D,%0A,%00,%09 etc.
Steps To Reproduce
- Use this markdown code
[Go to yelp.com](https://yelp.com%0A.evil.com%5C@x)in a comment - Click on
Go to yelp.comlink. - External link warning page will be shown
yelp.comwill be highlighted as targeted Host.- Click on Proceed button.
- You will be redirected on https://yelp.com.evi.com (a subdomain of evil.com)
- Done
####Using IDN homograph :
- Try
[Yelp.com](https://yelp.com%0A.уelp.com%5C@x) - Click on
Yelp.com yelp.comwill be highlighted- You will be redirected on https://yelp.com.xn--elp-cfd.com/@x after clicking on Proceed button
- Done
Thanks, Shailesh
Context
HackerOne runs an external link warning page at https://hackerone.com/redirect. When a user clicks a link that leaves the platform, the page shows a warning and highlights the destination host, so the user can see where they are about to go before pressing Proceed. The purpose of the highlight is to make phishing harder: the user is told which host they will land on, and a mismatch between the visible link text and the real destination should be obvious.
The researcher, shailesh4594, reported that the host detection on this page is invalid and insecure. The highlighted host can be made to differ from the host the victim actually lands on, and the same weakness also allows a redirect to an IDN homograph domain. The report was rated low severity under the weakness category Violation of Secure Design Principles and was disclosed on 3 December 2017.
Setup
No special tooling, account or role is described. The precondition is simply the ability to post a comment containing a Markdown link, which is how the malicious link reaches the victim. The attack relies on the victim clicking that link and then confirming the warning page.
Finding it
The researcher noticed that the redirect page detects and highlights the host in order to prevent phishing, but that this protection is weak and can be bypassed. The host filtration can be bypassed using whitespace characters such as %0D, %0A, %00 and %09. Because the host filtration can be bypassed, an attacker can redirect the victim to another host instead of the highlighted one, and can also redirect to an IDN homograph website.
Exploitation
Step 1: Post the Markdown link
The attacker places the following Markdown in a comment:
[Go to yelp.com](https://yelp.com%0A.evil.com%5C@x)
The visible link text says Go to yelp.com, while the URL contains %0A (a line feed) after yelp.com, followed by .evil.com, then %5C (a backslash) and @x. The encoded whitespace is what breaks the host detection.
Step 2: The victim clicks the link
Clicking Go to yelp.com takes the victim to the external link warning page.
Step 3: The warning page highlights the wrong host
The page shows yelp.com as the targeted host. This is the misleading part: the highlighted value is not the host the victim will actually reach.
Step 4: The victim presses Proceed
After clicking Proceed, the victim is redirected to https://yelp.com.evi.com, which is a subdomain of evil.com. The highlighted host and the real destination differ, so the warning page has failed at its one job.
IDN homograph variant
The researcher also demonstrated a second payload that abuses an internationalised domain name:
[Yelp.com](https://yelp.com%0A.уelp.com%5C@x)
Here the second label uses a Cyrillic у rather than the Latin y. The steps are the same:
- The victim clicks
Yelp.com. - The warning page highlights
yelp.com. - After pressing Proceed, the victim is redirected to
https://yelp.com.xn--elp-cfd.com/@x.
The punycode form xn--elp-cfd.com is the homograph domain, visually close to yelp.com but a different registrable domain. The highlighted host again does not match the destination.
Root cause
The report does not describe the parsing code, so the exact mechanism is not stated. The host shown to the user is therefore not the host the browser ultimately resolves and navigates to. The report does not describe the parsing code, so the exact mechanism is not stated; likely the highlighted host is taken from a naive split or string match on the URL, while the browser applies its own URL parsing rules and treats the whitespace and the \@ sequence differently, ending up at a different host.
Because the two views of the URL disagree, the existing defence (highlighting the host) does not stop the attack. The report also shows an IDN homograph variant that highlights yelp.com while redirecting to a punycode domain.
Impact
An attacker who can post a Markdown link in a comment can make a victim see a trusted host highlighted on the warning page and then land on an attacker-controlled host, or on an IDN homograph domain that looks like the trusted one. This undermines the anti-phishing purpose of the redirect page.
Fix
Variants to test
- A positive result is a warning page that highlights one host while the browser navigates to another.
- A positive result is the highlighted host differing from the host after the
@. - A positive result is the warning page showing the ASCII host while the browser resolves to a punycode domain.
Hunting notes
What happened, in plain words
HackerOne is a platform where security researchers report bugs to companies. When you click a link on HackerOne that leads to another website, the platform first shows a warning page at https://hackerone.com/redirect. That page is meant to protect you from phishing: it tells you which website you are about to visit and highlights the host (the main part of the web address, like yelp.com). The idea is that if the link text says one thing but the highlighted host says another, you will notice and stop.
The researcher shailesh4594 found that this protection can be fooled. By putting special encoded characters (like %0A, which represents a line break) inside the link, an attacker can make the warning page highlight a trusted host such as yelp.com, while the browser actually takes you to a different, attacker-controlled website. The same trick also works with an internationalised domain name (IDN) that looks almost identical to a real one, using a Cyrillic letter instead of a Latin one.
The report was rated low severity under the category "Violation of Secure Design Principles" and was disclosed on 3 December 2017. No bounty amount is mentioned.
Background: the pieces you need to know
Before walking through the attack, here are the basic ideas it relies on.
- Host: the part of a web address that identifies the website, for example
yelp.cominhttps://yelp.com/redirect. It is like the street name in a postal address. - URL encoding: some characters cannot appear directly in a web address, so they are written as a percent sign followed by two hexadecimal digits. For example, a line break is written
%0A, a carriage return is%0D, a null byte is%00, and a tab is%09. Think of it as spelling out a letter when you cannot pronounce it. - Markdown: a simple way to format text. A link is written as
[visible text](URL). HackerOne lets users post comments containing Markdown links. - Phishing: tricking someone into visiting a fake website that looks real, usually to steal passwords or other information.
- IDN homograph: an internationalised domain name that uses letters from different alphabets which look the same. For example, the Cyrillic letter
уlooks like the Latiny. An attacker can register a domain that appears identical to a trusted one but is actually different. - Punycode: the ASCII representation of an internationalised domain name. It starts with
xn--and is what the browser actually uses behind the scenes. For example, a domain containing Cyrillic characters might be shown asxn--elp-cfd.com.
The setup
The report does not describe any special tools, accounts or permissions. The only requirement is that the attacker can post a comment containing a Markdown link. That is how the malicious link reaches the victim. The victim then has to click the link and confirm the warning page.
Finding the weakness
The researcher observed that the redirect page tries to detect and highlight the host to prevent phishing, but that this protection is weak. The host filtration can be bypassed using whitespace characters such as %0D, %0A, %00 and %09. Because the host filtration can be bypassed, an attacker can make the warning page show one host while the browser goes to another. The same flaw also allows redirecting to an IDN homograph website.
Step-by-step exploitation
Step 1: Post the Markdown link
The attacker posts a comment containing this Markdown:
[Go to yelp.com](https://yelp.com%0A.evil.com%5C@x)
Let us break this down:
[Go to yelp.com]is the visible text the victim will see and click.(https://yelp.com%0A.evil.com%5C@x)is the actual URL behind the link.%0Ais an encoded line feed (a newline character). It appears right afteryelp.com..evil.comfollows the encoded newline.%5Cis an encoded backslash (\).@xcomes after the backslash.
The encoded whitespace is the key: it breaks the host detection on the warning page.
Step 2: The victim clicks the link
When the victim clicks the text Go to yelp.com, they are taken to HackerOne's external link warning page.
Step 3: The warning page highlights the wrong host
The warning page shows yelp.com as the targeted host. This is the misleading part: the highlighted value is not the host the victim will actually reach.
Step 4: The victim presses Proceed
After clicking the Proceed button, the victim is redirected to https://yelp.com.evi.com, which is a subdomain of evil.com. The highlighted host and the real destination differ, so the warning page has failed at its one job.
IDN homograph variant
The researcher also demonstrated a second payload that abuses an internationalised domain name:
[Yelp.com](https://yelp.com%0A.уelp.com%5C@x)
Here the second label uses a Cyrillic у rather than the Latin y. The steps are the same:
- The victim clicks
Yelp.com. - The warning page highlights
yelp.com. - After pressing Proceed, the victim is redirected to
https://yelp.com.xn--elp-cfd.com/@x.
The punycode form xn--elp-cfd.com is the homograph domain, visually close to yelp.com but a different registrable domain. The highlighted host again does not match the destination.
Why it works
The report does not describe the parsing code, so the exact mechanism is not stated. The host shown to the user is therefore not the host the browser ultimately resolves and navigates to.
Because the two views of the URL disagree, the existing defence (highlighting the host) does not stop the attack. The report also shows an IDN homograph variant that highlights yelp.com while redirecting to a punycode domain.
Impact
An attacker who can post a Markdown link in a comment can make a victim see a trusted host highlighted on the warning page and then land on an attacker-controlled host, or on an IDN homograph domain that looks like the trusted one. This undermines the anti-phishing purpose of the redirect page.
Fix
Variants to test
- A positive result is a warning page that highlights one host while the browser navigates to another.
- A positive result is the highlighted host differing from the host after the
@. - A positive result is the warning page showing the ASCII host while the browser resolves to a punycode domain.
Hunting notes
Glossary
- Host: the part of a web address that identifies the website, such as
yelp.cominhttps://yelp.com/redirect. - URL encoding: a way to represent characters that cannot appear directly in a URL, using a percent sign followed by two hexadecimal digits (e.g.
%0Afor a line feed). - Markdown: a lightweight markup language for formatting text, where links are written as
[text](URL). - Phishing: a social engineering attack that tricks people into visiting fake websites or revealing sensitive information.
- IDN homograph: an internationalised domain name that uses characters from different scripts which look identical, making it visually confusable with another domain.
- Punycode: the ASCII-compatible encoding of an internationalised domain name, starting with
xn--. - Authority: the part of a URL that includes the host (and optionally the port and user information).
- Whitespace character: a character that represents space, such as space, tab, line feed, or carriage return.
- Subdomain: a domain that is part of a larger domain, e.g.
yelp.com.evi.comis a subdomain ofevil.com. - Registrable domain: the part of a domain that can be registered by an individual or organisation, e.g.
evil.com. - Interstitial page: a page shown before the final destination, often used for warnings or confirmations.
- Recon: the reconnaissance phase of security testing, where you gather information about a target.
- Payload: the malicious input or code used in an attack.