Skip to content
UI spoofing Disclosed report CVE-2016-5267

Firefox Mobile Address Bar Spoofing

Rafay Baloch Follow

Originally disclosed on Mozilla

  • Fixed in 7 days
  • Paid in 11 days
  • Disclosed after 7 days
```text
Created attachment 8767818
spoofed1.png

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36
Firefox for Android

Steps to reproduce:

- Visit - https://jsfiddle.net/ktfegrhf/3/ using latest version of Firefox Mobile 
- Click on the link and observe the URL 


Actual results:

Due to mishandling of arabic RTL characters firefox for mobile causes the complete URL to be displayed from Right to left instead of left to right. 


Expected results:

The URL should be been displayed from LTR:

Expected Result:

http://عربي.ا�
ارات/google.com/test/test/test

Rendered Results

google.com/test/test/test/عربي.ا�
ارات


This is perfectly fine on firefox for mobile
```

The original report as published on Mozilla's Bugzilla, by Rafay Baloch. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 5 min read.

## What the report shows

The target is Firefox for Android, filed against the Firefox for Android Graveyard: General component. The weakness is classified as spoofing, the severity as medium, and the report was disclosed on 12 July 2016. The researcher is Rafay Baloch. The report does not state a bounty amount or a fix.

The researcher reports that Firefox for Android mishandles Arabic right-to-left (RTL) characters in the address bar. The steps to reproduce are given as:

1. Visit the following page using the latest version of Firefox Mobile:

```text
https://jsfiddle.net/ktfegrhf/3/
```

2. Click on the link and observe the URL.

The user agent recorded in the report is:

```text
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36
```

The actual result, as described, is that because of mishandling of Arabic RTL characters, Firefox for mobile displays the complete URL from right to left instead of left to right.

The expected result is that the URL is displayed left to right:

```text
http://عربي.ا�
ارات/google.com/test/test/test
```

The rendered result, however, is:

```text
google.com/test/test/test/عربي.ا�
ارات
```

The report ends with the line "This is perfectly fine on firefox for mobile". The report attaches one file, `spoofed1.png`, which is not reproduced here.

## Root cause

The report points to the address bar's handling of bidirectional text. Arabic is written right to left, and Unicode's bidirectional algorithm reorders mixed-direction text for display. When a URL contains RTL characters, the visual order of the string can differ from its logical order. The report's own framing is that the complete URL is rendered right to left instead of left to right, so the order in which the parts of the URL are read is reversed.. The report attributes the behaviour to mishandling of Arabic RTL characters in the address bar.

## Impact

The report shows that a URL mixing Arabic and Latin text can be displayed in reversed order. The report demonstrates the display behaviour with a test page and a link; it does not describe a live phishing campaign or any further exploitation. The severity assigned is medium, which fits a spoofing issue that depends on the user reading the address bar rather than on any memory-safety or data-exposure flaw.

## How this kind of bug works

Browsers display URLs as text, and text containing characters from both left-to-right and right-to-left scripts is reordered by the Unicode bidirectional algorithm before it is drawn. The algorithm works on runs of characters and resolves their direction from the surrounding context. A URL is a single logical string, but its visual rendering can place a trailing RTL segment at the left edge and push the LTR portion to the right. If the address bar does not force the scheme and host into a stable, isolated display order, the visible string can be arranged so that a domain the attacker does not control appears in the position users associate with the site they are visiting. The same class of problem appears whenever security-relevant text (URLs, file names, certificate names) is rendered without direction isolation.

The standard defences are to isolate the host component with Unicode directional formatting controls or the equivalent bidi isolation characters, to render the scheme and host in a fixed left-to-right order regardless of the rest of the string, and to avoid displaying raw user-controlled text in security indicators without sanitising its directionality.

## How to test for it

1. Identify every place the application renders a URL, hostname, file name or other identifier in a security-relevant position: address bars, link previews, certificate dialogs, download prompts, email client link displays.
2. Construct inputs that mix scripts, for example a hostname or path containing Arabic, Hebrew or other RTL characters combined with an LTR domain, and place the RTL segment both before and after the LTR segment.
3. Observe the rendered order and compare it with the logical order of the string. A positive result is a rendering in which the domain a user would read as the destination differs from the domain actually contacted.
4. Test the same input in several browsers and platforms, since the handling is per-renderer and per-version.
5. Where the application lets you supply the displayed string (for example a redirect parameter or a link label), check whether the displayed value can be made to disagree with the real target.

Common false positives: the browser may display the URL correctly but the test page's own text is misleading; the reordering may affect only the path, not the host, which is far less useful to an attacker; and some clients deliberately show the punycode form, which removes the ambiguity. Confirm that the host, not just the path, is what appears misleading before reporting.

## How it is fixed

The usual fix is to render the scheme and host with explicit direction isolation so that the registrable domain always appears in a fixed position, and to apply the same treatment to any other security-relevant string. Browsers have also moved toward displaying the host in punycode or otherwise normalising it when it contains characters that could reorder the display. Regression tests should cover mixed-direction URLs in the address bar and in any other place a URL is shown to the user.

## Hunting notes

This class of bug tends to hide in address bars and URL preview surfaces, in mobile browsers where the address bar is small and the URL is truncated, in link previews in messaging and email clients, and in certificate or download dialogs. Recon signals include any feature that displays a user-supplied URL or hostname, especially where the display is truncated or where the client supports internationalised domain names. To make a report accepted, show the exact input, the rendered output and the actual destination side by side, and demonstrate that a user acting on the displayed text would be misled. Keep the demonstration to the display discrepancy; claims of live phishing without evidence weaken the report.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 7 min read.

## What happened, in plain words

Every web page has an address, called a URL. When you type one in or tap a link, the browser shows that address in the address bar at the top of the screen. People glance at that bar to check they are on the site they expect, for example their bank. This report is about a case where the address bar showed something different from what the user would reasonably read.

The product involved is Firefox for Android, the mobile version of the Firefox browser. The report was filed against the Firefox for Android Graveyard: General component, classified as a spoofing weakness with medium severity, and disclosed on 12 July 2016. The researcher is Rafay Baloch. The report does not state a bounty amount or a fix.

Spoofing means making something look like something else. Here, the address bar displayed the parts of a URL in reversed order. The report concerns how the browser draws Arabic characters in the address bar.

### The steps in the report

The researcher gives two steps to reproduce the behaviour:

1. Visit the following page using the latest version of Firefox Mobile:

```text
https://jsfiddle.net/ktfegrhf/3/
```

2. Click on the link and observe the URL.

The report gives the page as the starting point and then asks the reader to click a link. The point of the second step is the observation: after tapping the link, you look at what the address bar shows, not just at what page loads.

The report also records the user agent string of the browser used:

```text
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36
```

A user agent is a line of text a browser sends to identify itself. The report records this user agent string without further comment.

### What the browser showed

The actual result, as described, is that because of mishandling of Arabic right-to-left characters, Firefox for mobile displays the complete URL from right to left instead of left to right.

Arabic is written right to left, while addresses in Latin letters are written left to right. When one string mixes both, the browser has to decide how to lay the characters out on screen. The report says that decision went wrong for the whole address.

The expected result is that the URL is displayed left to right:

```text
http://عربي.ا�
ارات/google.com/test/test/test
```

The report gives this as the expected left-to-right display. In a correct left-to-right display, the domain comes first and the path follows.

The rendered result, however, is:

```text
google.com/test/test/test/عربي.ا�
ارات
```

Now the order on screen is reversed, with `google.com` appearing first and the Arabic domain at the end.

The report ends with the line "This is perfectly fine on firefox for mobile". It attaches one file, `spoofed1.png`, which is not reproduced here.

### Why it matters

The report shows that a URL mixing Arabic and Latin text can be displayed in reversed order. The report demonstrates the display behaviour with a test page and a link; it does not describe a live phishing campaign or any further exploitation. The medium severity fits a spoofing issue that depends on the user reading the address bar rather than on any memory-safety or data-exposure flaw.

## In general, how this kind of bug works

Browsers display URLs as text, and text containing characters from both left-to-right and right-to-left scripts is reordered by the Unicode bidirectional algorithm before it is drawn. Think of a bilingual sign where one line runs left to right and the next runs right to left: the reader has to know which way each line goes. The algorithm works on runs of characters and resolves their direction from the surrounding context. A URL is a single logical string, but its visual rendering can place a trailing right-to-left segment at the left edge and push the left-to-right portion to the right.

If the address bar does not force the scheme and host into a stable, isolated display order, the visible string can be arranged so that a domain the attacker does not control appears in the position users associate with the site they are visiting. The same class of problem appears whenever security-relevant text (URLs, file names, certificate names) is rendered without direction isolation.

The standard defences are to isolate the host component with Unicode directional formatting controls or the equivalent bidi isolation characters, to render the scheme and host in a fixed left-to-right order regardless of the rest of the string, and to avoid displaying raw user-controlled text in security indicators without sanitising its directionality.

### How to test for it

1. Identify every place the application renders a URL, hostname, file name or other identifier in a security-relevant position: address bars, link previews, certificate dialogs, download prompts, email client link displays.
2. Construct inputs that mix scripts, for example a hostname or path containing Arabic, Hebrew or other right-to-left characters combined with a left-to-right domain, and place the right-to-left segment both before and after the left-to-right segment.
3. Observe the rendered order and compare it with the logical order of the string. A positive result is a rendering in which the domain a user would read as the destination differs from the domain actually contacted.
4. Test the same input in several browsers and platforms, since the handling is per-renderer and per-version.
5. Where the application lets you supply the displayed string (for example a redirect parameter or a link label), check whether the displayed value can be made to disagree with the real target.

Common false positives: the browser may display the URL correctly but the test page's own text is misleading; the reordering may affect only the path, not the host, which is far less useful to an attacker; and some clients deliberately show the punycode form, which removes the ambiguity. Punycode is a way of writing international domain names in plain Latin letters, so a name that could be reordered is shown in a form that cannot. Confirm that the host, not just the path, is what appears misleading before reporting.

### How it is fixed

The usual fix is to render the scheme and host with explicit direction isolation so that the registrable domain always appears in a fixed position, and to apply the same treatment to any other security-relevant string. Browsers have also moved toward displaying the host in punycode or otherwise normalising it when it contains characters that could reorder the display. Regression tests should cover mixed-direction URLs in the address bar and in any other place a URL is shown to the user.

### Hunting notes

This class of bug tends to hide in address bars and URL preview surfaces, in mobile browsers where the address bar is small and the URL is truncated, in link previews in messaging and email clients, and in certificate or download dialogs. Recon signals include any feature that displays a user-supplied URL or hostname, especially where the display is truncated or where the client supports internationalised domain names. To make a report accepted, show the exact input, the rendered output and the actual destination side by side, and demonstrate that a user acting on the displayed text would be misled. Keep the demonstration to the display discrepancy; claims of live phishing without evidence weaken the report.

## Glossary

- **URL**: the address of a page on the web, made of a scheme, a domain and a path.
- **Address bar**: the field in a browser that shows the URL of the page you are on.
- **Spoofing**: making something appear to be something else, here making the address bar show a trusted name for an untrusted destination.
- **Firefox for Android**: the mobile version of the Firefox browser.
- **User agent**: a line of text a browser sends to identify itself and its platform.
- **Right-to-left (RTL)**: writing direction used by scripts such as Arabic, where text runs from the right edge to the left.
- **Left-to-right (LTR)**: writing direction used by scripts such as Latin, where text runs from the left edge to the right.
- **Domain**: the part of a URL that names the site, such as `google.com`.
- **Path**: the part of a URL after the domain that points to a page inside the site.
- **Unicode bidirectional algorithm**: the rule set browsers use to decide the on-screen order of text that mixes left-to-right and right-to-left characters.
- **Direction isolation**: keeping a piece of text, such as the host, in a fixed display direction so surrounding text cannot reorder it.
- **Punycode**: a plain Latin-letter encoding of international domain names, used so names with non-Latin characters can be shown unambiguously.
- **Phishing**: tricking a user into trusting a page or link so they hand over information or follow a malicious link.
- **False positive**: a test result that looks like a bug but is not one.
- **Regression test**: an automated check that a fixed bug stays fixed.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Clickjacking and UI spoofing

The lesson behind this report.

The interface lies to the user: a framed page catches their clicks, or a browser shows the wrong address or a fake prompt. Paid when it leads to a sensitive action or convincing phishing.