URL bar spoofing with bidirectional Unicode characters (also link hover text)
Firefox and Chrome display URLs containing bidirectional Unicode characters in a way that reorders the protocol, host and path, so a crafted link can appear to point at a trusted site while actually loading a different one. An attacker could use this to make a phishing link look like it goes to a legitimate HTTPS host.
Originally disclosed on Mozilla
- Fixed in 2.7 years
- Paid in 19 months
- Disclosed after 2.7 years
The URL bar content can be spoofed by mixing bidirectional Unicode characters in specific ways, allowing an attacker to forge the displayed protocol and host.
I'm reporting two variants. (1) is Firefox-specific and seems to be facilitated by URL trimming. (2) affects both Firefox and Google Chrome and seems to point to a general issue with how the parts of bidirectional URLs are reordered.
**(1)**
In a text, the first occurring *strong* (i.e. directional) character determines the base direction. In the URL bar, this is usually the `h` of `http`. However, Firefox strips `http://` from plain HTTP URLs (if `browser.urlbar.trimURLs == true`, as is the default). In that case, the first character of the hostname determines the text direction. So, if a hostname from an RTL script is chosen (which passes the IDN display algorithm without being altered, e.g. an Arabic or Hebrew word), the entire URL string is displayed with RTL as the base direction. This arranges parts of the URL in unexpected ways.
**Proof of concept**
- [`http://xn--tib.ml/index%F0%90%A9%96https://www.mozilla.org/articles`](http://xn--tib.ml/index%F0%90%A9%96https://www.mozilla.org/articles) appears in the URL bar as `https://www.mozilla.org/articles𐩖ml/index.ٴ`, spoofing both the HTTPS protocol and full host. (I've chosen an Arabic letter as the second-level domain name and an RTL slash-lookalike (`U+10A56`) as a convincing path separator, although the latter isn't a requirement for the attack.)
- Similarly, a hostname with European numbers (because they aren't *strongly* directional) and an RTL top-level domain could be used, e.g.: [`http://123.456.קום/https://www.mozilla.org/articles`](http://123.456.קום/https://www.mozilla.org/articles) which displays as `https://www.mozilla.org/articles/קום.123.456`
**(2)**
Both Firefox and Google Chrome seem to implement the same display algorithm for URLs with bidirectional text, which gives unexpected results if both the hostname and path contain RTL sequences. In particular, if the hostname ends with an RTL part, and the path starts with an RTL character, both are interpreted as a continuous RTL context and get visually re-ordered. This way part of the path ends up in the hostname and vice versa. This also means that an attacker can (visually) inject characters into the hostname which are on the IDN blocklist but don't get blocked here because they are actually part of the path segment, not the domain name.
**Proof of concept**
- [`https://www.mozilla.org.xn--tib.xn--9dbq2a/#%F0%90%A9%96/app/main`](https://www.mozilla.org.xn--tib.xn--9dbq2a/#%F0%90%A9%96/app/main) displays as `https://www.mozilla.org.𐩖#...`
- Also, an RTL-only hostname can trivially be shadowed by another RTL hostname: [`https://ק.קום/�
.كو�
/foo`](https://ק.קום/�
.كو�
/foo) requests `ק.קום` although visually `�
.كو�
` follows after the protocol part.
- Since numbers aren't strongly directional, one can also trivially spoof IP hosts. E.g., [`https://127.xn--9dbq2a/0.0.1/`](https://127.xn--9dbq2a/0.0.1/) and [`https://127.ק.קום/0.0.1/index.php`](https://127.ק.קום/0.0.1/index.php) both visually start with `https://127.0.0.1/` but request a different hostname.
All examples were tested on Linux + Nightly with default settings.Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the browser's URL display algorithm applies bidirectional text reordering across the whole URL string without isolating the host from the path, so RTL characters in one part visually merge with another.
Impact
An attacker could make a link appear to point at a trusted HTTPS host while it actually requests a different hostname, aiding phishing; the report notes the issue affects both Firefox and Chrome.
What the attacker needed
Victim views or clicks a crafted link; browser renders URL with bidi reordering
How it was found
- Craft a URL whose hostname or path contains right-to-left Unicode characters arranged to reorder the displayed text.
- Open the URL in the browser and observe the address bar showing a different protocol and host than the real one.
- For the Firefox variant, rely on URL trimming so the hostname's first character sets the text direction.
- For the cross-browser variant, place an RTL sequence at the end of the hostname and another at the start of the path so they merge visually.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Some scripts, such as Arabic and Hebrew, are written right to left, and browsers reorder mixed text so it reads correctly. When a web address mixes those characters with ordinary ones, the browser can shuffle the pieces on screen, so the address you see is not the address you visit. An attacker can craft such a link so it looks like it goes to a trusted site but actually goes somewhere else.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.