Skip to content
Info disclosure Write-up Intermediate

Leaking Browser URL/Protocol Handlers

Browsers could be tricked into revealing which custom URL protocol handlers are installed on a system, allowing an attacker to detect the presence of applications including security products. This information disclosure could aid reconnaissance and pre-exploitation detection.

Tabahi Follow

Published on fortinet.com

An important step in any targeted attack is reconnaissance. The more information an attacker can obtain on the victim the greater the chances for a successful exploitation and infiltration.

Tabahi (@_tabahi), on fortinet.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

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

Context

Protocol handlers are the mechanism by which applications register their own URI scheme with the operating system, so that a URI formatted string can launch a process. On Windows, custom URL handlers live under these registry keys:

  • HKEY_CURRENT_USER\SOFTWARE\Classes*
  • HKEY_LOCAL_MACHINE\SOFTWARE\Classes*
  • HKEY_CLASSES_ROOT*

When a URL handler is invoked, the OS searches those locations for keys containing a value named "URL Protocol". For example, inspecting HKEY_CLASSES_ROOT\msteams with regedit shows that special value, and looking further into *HKEY_CLASSES_ROOT\msteams\shell\open\command* shows the actual command that gets invoked. In that example the browser launches Teams.exe when a URL starting with "msteams" is clicked.

Browsers let users click links with non-http schemes, which prompts a message box asking whether to let another application handle the URL. That requires user interaction and so poses a limited risk, but it expands the attack surface beyond the browser: an attacker could craft a page that triggers another, potentially vulnerable application, and in some cases such attacks may bypass protection measures such as Smart Screen and other security products.

The question this research set out to answer is whether browsers somehow disclose which protocol handlers exist on a targeted system. The short answer is yes. Two information disclosure vulnerabilities affecting Firefox, Edge and Chrome were uncovered, and exploiting them lets a remote attacker identify the presence of a vast amount of applications that may be installed on a targeted system. The findings came from manually playing with HTML/CSS components, looking for a difference in behaviour when referring to existing and non-existing URL handlers.

Setup

The testing environment was Windows 10. The Firefox issue was tested on Firefox 78.0.1 (64-bit); the Chrome and Edge issue was tested on Chrome 83.0.4103.116. The author notes it is fair to assume the same vulnerabilities exist on other platforms such as Linux and Mac, and the affected platforms are listed as Windows and Linux, with Chrome, Firefox and Edge impacted. The report describes using the browser, its developer tools and regedit.

Finding it

The starting point was curiosity about whether browsers leak the set of registered protocol handlers. The approach was to compare how a browser renders or behaves when an element refers to an existing handler versus a non-existing one. In Firefox the observable difference is in the rendered size of a broken image; in Chrome and Edge it is whether the document keeps focus when the handler prompt appears. Both differences are measurable from JavaScript, which turns them into an oracle that can be brute-forced over a list of schemes.

Exploitation

Step 1: Leaking Firefox protocol handlers (CVE-2020-15680)

Firefox renders images sourced from existing and non-existing protocol handlers differently. If a page contains an image element whose source points at an existing handler, and you observe the element's styling in developer tools, the default styling for broken images produces an element sized 24x24.

If instead you create an image element and set its source to a non-existent handler, the element ends up sized 0x0.

That difference can be measured with a simple JS script, on the basis of which an attacker may perform a brute-force attack to disclose the different protocol handlers on a targeted system. The example code prints whether a handler exists or not on the targeted system.

Step 2: Leaking Chrome and Edge protocol handlers

The mechanism in Chrome and Edge is different and may be less stealthy, but yields equivalent results. It relies on the window losing focus whenever the user is challenged with the message box.

To detect whether a given handler exists, the page first dynamically generates a link made of the scheme to detect:

It then triggers the link and checks whether the document has focus:

That works for a one-time check. To brute force an entire list of handlers, the message box has to be dismissed each time, otherwise document.hasFocus() will always return true.

The technique used was to redirect the user to an entirely different domain or IP, which eliminates any previously opened message box. The flow is: the Protocol Handler Test page performs the actual test and saves the results to the back-end; if the handler exists, it redirects to the Redirect-Back Page on domain2.com, and the redirection gets rid of the message box; finally the user is sent back to the Protocol Handler Test Page for the next handler test.

Root cause

The root cause is that browsers expose an observable difference between a registered and an unregistered scheme: in Firefox, the intrinsic size of a broken image differs depending on whether the scheme resolves to a handler; in Chrome and Edge, the focus state of the document differs because the handler prompt steals focus. A page can measure the difference and enumerate schemes. The report does not describe the underlying implementation change, so the precise code-level cause is not stated;

Impact

The impact is information disclosure of installed applications, including security products. The report gives these examples of how it could be exploited:

  • Identifying communication channels: listing handlers hints at which platforms an attacker may use to reach the targeted user, for instance detecting social applications such as Slack, Skype, WhatsApp or Telegram.
  • General reconnaissance: a wide range of applications use custom URL handlers and can be detected, including music players, IDE, office applications, crypto-mining, browsers, mail applications, antivirus, video conferencing, virtualizations, database clients, version control clients, chat clients, voice conference apps and shared storages.
  • Pre-exploitation detection: exploit kits may use the information to identify whether a potentially vulnerable application is present without exposing the vulnerability itself.
  • Detecting security solutions: many security solutions such as AV products register protocol handlers whose presence can be exposed, letting attackers customise an attack to circumvent protection mechanisms.
  • User fingerprinting: reading which protocol handlers exist can improve browser/user fingerprinting algorithms.

The severity level assigned in the report is Medium. The Chrome and Edge technique requires user interaction with the prompt and is described as less stealthy than the Firefox one.

Fix

Mozilla's security team responded quickly and issued a fix for the bug, assigned CVE-2020-15680. Microsoft decided not to fix the issue, explaining: "This is by design (and not a security issue) - if we want to support registered protocol handler links from the browser, it seems like there'll be various ways to detect whether a link for a particular protocol handler worked or not". Google decided to treat it as a "user fingerprinting issue" rather than a security issue and were working on a patch, with the security team's consensus being that "none of the concerns here relate to leaking user data, and that this is best handled as a fingerprinting bug". The author's position is that being able to expose the presence of other software, including security software, on targeted devices should be prevented.

Variants to test

  • Other schemes on Firefox: load image elements pointing at candidate schemes and compare rendered sizes. A positive result is a 24x24 element for a registered scheme against 0x0 for an unregistered one.
  • Other schemes on Chrome and Edge: generate links for candidate schemes, trigger them and check document focus, redirecting to a second domain between tests to clear the prompt. A positive result is loss of focus only for registered schemes.
  • Other platforms: repeat the same measurements on Linux and Mac, since the author expects the same behaviour there. A positive result is the same size or focus difference.
  • Security product enumeration: run a list of known AV and endpoint security schemes through either oracle. A positive result identifies installed security software.

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

What happened, in plain words

Every day, when you click a link on a web page, your browser usually opens a new page. But some links do not start with http or https. They start with something else, like msteams: or skype:. When you click one of those, your browser asks you a question: do you want to let another program on your computer handle this link? If you say yes, that program opens.

The feature that makes this possible is called a protocol handler. A program tells your operating system, "I am the program for links that start with this word." The operating system remembers this, and later, when a link with that word is clicked, it knows which program to start.

A security researcher looked at this feature and asked a simple question: can a web page find out which protocol handlers exist on your computer, without you telling it? The answer turned out to be yes, in three popular browsers: Firefox, Chrome and Edge. A malicious web page could quietly test a long list of link types and learn which programs you have installed, including security products such as antivirus software. That kind of leak is called information disclosure: the page does not break anything, it just learns something it should not know.

The researcher found two different tricks, one for Firefox and one for Chrome and Edge. Mozilla fixed the Firefox issue and gave it the identifier CVE-2020-15680. Microsoft said the behaviour is by design and did not fix it. Google treated it as a fingerprinting issue rather than a security issue and worked on a patch.

This article walks through the whole story slowly, explaining every term as it appears.

Background: what a protocol handler is

A protocol is simply a set of rules for how something is done. The part of a web address before the colon, such as http in http://example.com, is called a scheme. The scheme tells the computer what kind of address this is and which program should deal with it.

A protocol handler (also called a URL handler) is a program that registers its own scheme with the operating system. Once registered, a link using that scheme can start that program. For example, a chat application might register the scheme msteams, so that clicking a msteams: link opens the chat application.

On Windows, these registrations are stored in a part of the system called the registry. The registry is a large database of settings that Windows and its programs use. It is organised in folders, and each folder is called a key. The report lists three places where custom URL handlers are stored:

  • HKEY_CURRENT_USER\SOFTWARE\Classes*
  • HKEY_LOCAL_MACHINE\SOFTWARE\Classes*
  • HKEY_CLASSES_ROOT*

A quick word on those three names. HKEY_CURRENT_USER holds settings for the person currently logged in. HKEY_LOCAL_MACHINE holds settings for the whole computer. HKEY_CLASSES_ROOT is a combined view that Windows presents, merging information from the other locations. The asterisk at the end means "and everything below this folder".

When a URL handler is invoked, the operating system searches those locations for keys that contain a value named "URL Protocol". A value here is a named entry inside a registry key, a bit like a labelled field in a form. The presence of a value called "URL Protocol" is the marker that says: this key describes a program that can open links.

To look at the registry by hand, Windows includes a tool called regedit (the Registry Editor). The report uses it to inspect the path HKEY_CLASSES_ROOT\msteams and shows that it contains the special value "URL Protocol".

Figure 1

Looking further into *HKEY_CLASSES_ROOT\msteams\shell\open\command* shows the actual command that gets invoked.

Figure 2

Figure 3

In this example, when a URL that starts with "msteams" is clicked, the browser launches Teams.exe. The shell\open\command part of the path is where Windows stores the exact instruction it will run, in this case the instruction that starts the Teams program.

Now, what happens in the browser? Browsers let users click links with non-http schemes. Because starting another program is a bigger step than opening a web page, the browser first shows a message box asking whether you want to let another application handle this URL.

Figure 4

This message box is a safety measure: it requires user interaction, meaning you have to click something before anything happens. Because of that, the report describes the risk as limited. But it also notes that the feature expands the attack surface, which means the total set of ways an attacker might get in. The browser is no longer the only program involved; another application is now reachable through it. An attacker could craft a special web page that triggers another, potentially vulnerable application. In some cases, such attacks may bypass protection measures such as Smart Screen and other security products. Smart Screen is a Windows feature that warns you about suspicious downloads and sites.

While exploring how browsers could be attacked through the different protocol handlers, the researcher got curious about a different question: do web browsers somehow disclose which protocol handlers exist on a targeted system? The short answer is yes.

Leaking protocol handlers: the idea

The report describes how Chrome, Edge and Firefox were circumvented in order to disclose which protocol handlers exist on a targeted system. Circumvented here means the browser's normal behaviour was used in a way it was not intended for, to get information out.

It is worth mentioning that these findings came from manually playing with HTML and CSS components. HTML is the language used to build web pages, and CSS is the language used to describe how those pages look. The emphasis was on finding a difference in behaviour when referring, using some elements, to existing and non-existing URL handlers. In other words: build a page element that points at a link type, and see whether the browser treats it differently depending on whether that link type is registered on the computer.

The testing environment was Windows 10, but the report says it is fair to assume that the same vulnerabilities exist on other platforms, such as Linux and Mac.

Leaking Firefox protocol handlers (CVE-2020-15680)

This vulnerability was tested on Firefox 78.0.1 (64-bit) under Windows 10. To leak the protocol handlers in Firefox, the trick uses differences in the way Firefox renders images sourced from existing and non-existing protocol handlers. Renders means draws on the screen.

For example, if you load a web page containing an image element whose source points at an existing handler, and then observe the element's styling using developer tools, you will see that the default styling for broken images produces an element with a size of 24x24. Developer tools are the built-in inspection panel in browsers, usually opened with a keyboard shortcut, that let you look at the page's structure and styling. A broken image is an image the browser could not load; browsers show a small placeholder for it.

Figure 5

Unlike the example above, if you create an image element and set its source to some non-existent handler, the element ends up with a different size, 0x0.

Figure 6

So the browser behaves differently in a way you can see: 24x24 when the handler exists, 0x0 when it does not. That difference can be measured with a simple JavaScript script. JavaScript is the programming language that runs inside web pages and can read things like the size of an element. On the basis of this, a malicious actor may perform a brute-force attack, which means trying many possibilities one after another, to disclose the different protocol handlers on a targeted system. The example code prints whether a handler exists or not on a targeted system.

Why does this matter? Because a web page can run that script and build a list of which programs are installed.

Leaking Chrome and Edge protocol handlers

This vulnerability was tested on Chrome 83.0.4103.116 under Windows 10. The report says the exploitability of this vulnerability may be less stealthy, meaning it is easier for the user to notice something is happening, but it still yields equivalent results to the Firefox vulnerability.

The mechanism here is different from the one in Firefox. It uses the fact that the window loses focus whenever the user is challenged with the message box. Focus is which window or element is currently receiving your keyboard input; when a message box appears, it takes focus away from the page.

Figure 7

So, to detect whether a given handler exists on the victim, the page takes the following steps.

First, it dynamically generates a link that is made of the scheme we would like to detect, like this:

This line is a placeholder in the report for the code that builds the link. The idea is simple: the page creates a link whose address starts with the scheme being tested, for example a link beginning with the word for the chat application. The page builds the link dynamically from the scheme being tested.

Then it triggers the link and detects whether the document has focus:

Again this is a placeholder. Triggering the link means making the browser act as if the user clicked it. document.hasFocus() is a built-in JavaScript function that answers a yes or no question: does the page currently have focus? If the handler exists, the browser shows the message box and the window loses focus; the page checks document.hasFocus(). That difference is the signal.

That will work for a one-time check. However, if we would like to brute force an entire list of handlers, we would have to get rid of the message box every time it pops up, or else document.hasFocus() will always return true. Think about it: once the message box is open, it stays open, and the page stays unfocused, so the next test would give the same answer no matter what scheme is tried.

Figure 8

The technique the researcher came up with was to redirect the user to an entirely different domain or IP, which eliminates any previously opened message box. A domain is a name on the internet, such as example.com, and an IP is the numerical address behind such a name. Navigating away from the page eliminates the previously opened message box.

Figure 8 draws the general idea of how the flow should be carried out in order to work. The Protocol Handler Test page performs the actual test and saves the results to the back-end. The back-end is the part of a website that runs on the server and stores data, as opposed to the part that runs in your browser. In case the handler exists, the page redirects to the Redirect-Back Page, which exists on domain2.com. The redirection gets rid of the message box. Finally, the user is sent back to the Protocol Handler Test Page for the next handler test.

So the loop is: test one scheme, jump to a second domain to clear the prompt, come back, test the next scheme. Repeating this over a long list of schemes gives the attacker the full picture.

Why this matters: the impact

Such an information disclosure vulnerability could be exploited in several different ways. The report gives these examples:

  • Identifying communication channels: by listing the handlers, an attacker can get a hint about which platforms they may use for reaching the targeted user. For instance, detecting social applications such as Slack, Skype, WhatsApp or Telegram may be used for communicating with the target.
  • General reconnaissance: a wide range of applications nowadays uses custom URL handlers and can be detected using this vulnerability. Some examples: music players, IDE, office applications, crypto-mining, browsers, mail applications, antivirus, video conferencing, virtualizations, database clients, version control clients, chat clients, voice conference apps, shared storages. Reconnaissance means gathering information about a target before an attack, the way a burglar might first look at which windows are open.
  • Pre-exploitation detection: exploit kits may leverage this information in order to identify if a potentially vulnerable application is present without exposing the vulnerability itself. An exploit kit is a collection of attack code that tries many known weaknesses automatically.
  • Detecting security solutions: many security solutions, such as antivirus products, register protocol handlers whose presence can be exposed by leveraging the vulnerabilities, because they have custom protocol handlers installed. Attackers may use this to further customise their attack to be able to circumvent any protection mechanism set by those security solutions.
  • User fingerprinting: reading what protocol handlers exist on a system may also be used in order to improve browser or user fingerprinting algorithms. Fingerprinting means collecting small details about a visitor to build a profile that can recognise them again later, even without a login.

The severity level assigned in the report is Medium. The Chrome and Edge technique requires user interaction with the prompt and is described as less stealthy than the Firefox one.

What the vendors said

Below is a table specifying the vendor responses:

Vendor Vendor Response
Mozilla The security team at Mozilla were quick to respond and have issued a fix for the bug. CVE-2020-15680
Microsoft The vendor decided not to fix the issue due to the following explanation: "This is by design (and not a security issue) - if we want to support registered protocol handler links from the browser, it seems like there'll be various ways to detect whether a link for a particular protocol handler worked or not"
Google The vendor decided to treat this as a "user fingerprinting issue" rather than a security issue and are working on a patch. "The general consensus on the security team is that none of the concerns here relate to leaking user data, and that this is best handled as a fingerprinting bug"

A CVE is a public identifier for a known security flaw, so that people can refer to the same issue unambiguously. Mozilla makes Firefox, Microsoft makes Edge and Windows, and Google makes Chrome.

Microsoft's position is that the behaviour is a necessary consequence of the feature: if the browser is going to support these links at all, there will always be some way to tell whether a link worked. Google's position is that this is about recognising users rather than leaking their data, so it belongs in the fingerprinting bucket. The author's position is that being able to expose the presence of other software, including security software, on targeted devices should be prevented.

Summary

The report uncovered a new type of information disclosure vulnerabilities in Chrome, Edge and Firefox and identified how attackers can leverage them to gain valuable insights which could assist them in compromising their targets. When browsers enable the interaction with other applications through URL handlers, they may be easing the engagement with third party software, but they also enable a wider attack surface by giving the attacker a chance to attack the user through other applications.

While Microsoft and Google currently do not consider it a security issue, the author believes that being able to expose the presence of other software, including security software, on targeted devices should be prevented. The report anticipates that in the near future we shall see an increase in the number of attacks which exploit the different URL handlers through the user's web browser.

Glossary

  • Protocol: a set of rules for how something is done; in a web address, the part before the colon that says what kind of address it is.
  • Scheme: the word at the start of an address, such as http or msteams, that tells the computer how to handle it.
  • Protocol handler (URL handler): a program that registers its own scheme with the operating system so that links using that scheme can start it.
  • Registry: the database of settings used by Windows and its programs.
  • Key: a folder-like entry in the Windows registry.
  • Value: a named entry inside a registry key, like a labelled field in a form.
  • regedit: the Registry Editor tool included with Windows for viewing and editing the registry.
  • User interaction: an action the person has to take, such as clicking a button, before something happens.
  • Attack surface: the total set of ways an attacker might get into a system.
  • Smart Screen: a Windows feature that warns about suspicious downloads and websites.
  • HTML: the language used to build web pages.
  • CSS: the language used to describe how web pages look.
  • Render: to draw something on the screen.
  • Developer tools: the built-in browser panel for inspecting a page's structure and styling.
  • Broken image: an image the browser could not load, shown as a small placeholder.
  • JavaScript: the programming language that runs inside web pages.
  • Brute-force attack: trying many possibilities one after another until the answer is found.
  • Focus: which window or element is currently receiving keyboard input.
  • Trigger: to make the browser act as if the user clicked something.
  • Domain: a name on the internet, such as example.com.
  • IP: the numerical address behind a domain name.
  • Back-end: the part of a website that runs on the server and stores data.
  • Information disclosure: a flaw where something that should stay private is revealed.
  • Reconnaissance: gathering information about a target before an attack.
  • Exploit kit: a collection of attack code that tries many known weaknesses automatically.
  • Fingerprinting: collecting small details about a visitor to build a profile that can recognise them later.
  • CVE: a public identifier for a known security flaw.
  • Mozilla: the organisation that makes Firefox.
  • Microsoft: the company that makes Windows and Edge.
  • Google: the company that makes Chrome.
  • Severity level: a rough rating of how serious a flaw is; this report assigns Medium.

More by Tabahi

View all

3 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.