Skip to content
Misconfiguration Disclosed report Intermediate CVE-2023-6871

Protocol handler warning should not be skipped for external scheme URLs entered directly in the addressbar (or other UI)

Firefox shows a warning before launching an external protocol handler when a link, script redirect or header redirect triggers it, but skips that warning when the same URL is typed into the address bar or set as the homepage. An attacker who can get a victim to paste such a URL, or who can change the homepage setting, could launch external programs without the warning, which the report links to possible code execution and a persistent soft-lock.

Roy.Gunsen Follow

Originally disclosed on Mozilla

  • Fixed in 7 months
  • Paid in 7 months
  • Disclosed after 7 months
Text
Created attachment 9328716
Protocol Handler Warning Bypass.pdf

A full copy of this bug bounty submission with full screenshots can be found in the attached PDF file. I have also attached a video recording of the persistent soft lock. However, as this can't be recorded on the soft-locked device, the recording quality is quite low.

Issue Context

A protocol handler is an application that knows how to interpret particular types of links: for example, a mail client is a protocol handler for "mailto:" links. This allows external applications to be opened via a browser by navigating to a link such as “mailto:[address removed]”.

Upon navigating to a protocol handler URL such as “calculator:calc” or “microsoft.windows.camera:aaaa”, browsers warn the user prior to triggering the protocol handler. This is due to how protocol handlers allow for the execution of programs outside of the browser context, and the security of these protocol handlers is outside of the browsers control.

Firefox will raise a warning prior to triggering the protocol handler in the following circumstances:
~ Navigation to a URL via an “<a>” tag.
~ A JavaScript redirect, such as window.open("calculator:calc").
~ Header based-redirects.



Issue description

Despite using a warning if a protocol handler URL is navigated to via the previously specified method, Firefox skips this check if the URL is directly navigated to directly via the URL bar. This can be done by entering it into the URL bar and pressing the “enter” key, or by setting the browser homepage to a URL containing a protocol handler and then re-opening Firefox.

One caveat to the above description is that the first time Firefox encounters a new protocol handler, it appears to silently ignore the request, and then upon any subsequent request it will automatically open.

This effectively circumvents the protection to prevent users from inadvertently executing protocol handlers.



Impact

Windows protocol handlers have been vulnerable to a number of remote code execution vulnerabilities in the past, any of which could have been leveraged in combination with this to function as a zero-click remote code execution vulnerability. Three such vulnerabilities are shown below:
~ https://positive.security/blog/ms-officecmd-rce
~ https://blog.doyensec.com/2018/05/24/electron-win-protocol-handler-bug-bypass.html
~ https://www.bleepingcomputer.com/news/security/new-windows-search-zero-day-added-to-microsoft-protocol-nightmare/

Zero-click Remote Code Execution

Real world situations where this is able to be leveraged as a zero-click remote code execution would include: 
~ Social engineering, where a user is coerced into copy-pasting a URL into Firefox.
~ Compromising a cloud-sync session and setting the user's homepage to a protocol handler URL.
~ Lateral movement within a network, where a user can modify a user’s homepage via modifying config files on a victim's machine via an SMB share functionality.
~ User or system level persistence on a device via modifying either the Firefox configuration files or the windows registry keys to allow setting the user’s homepage.

If an attacker has file access to the victim machine machine, such as the previous two examples, this can be done without the need for a protocol handler vulnerability, as the user can simply add an unsafe protocol handler with user level privileges.

One-click Remote Code Execution

Alternatively for a one-click remote code execution, an attacker could use the Java Network Launch Protocol if Java is installed upon the host. Further information on this can be found in the following whitepaper:
https://cybir.com/wp-content/uploads/2021/06/JNLP-Injection-and-Attacks-Release.pdf

A example of this attack is the the following URL 
“jnlp:https://docs.oracle.com/javase/tutorialJWS/samples/deployment/dynamictree_webstartJWSProject/dynamictree_webstart.jnlp”:

Upon clicking the run button, the Jar file referenced in the URL above is executed, in this case, opening a sample application.

Persistent Denial of Service

Another notable use for this vulnerability would be via the use of the “ms-cxh” and “ms-cxh-full” protocol handlers which can softlock some windows versions by creating a persistent black screen. This can be fixed through a series of commands found in the paper below, but is usually fixed with a full system reboot.
https://papers.vx-underground.org/papers/Windows/Analysis%20and%20Internals/2022-01-16%20-%20Notes%20on%20Windows%20MS-CXH%20and%20MS-CXH-FULL%20handlers.pdf


This was confirmed on an up-to-date windows version found here:
Edition: Windows 10 Home
Version: 21H2
OS Build: 19044.2846
Experience: Windows Feature Experience Pack 120.2212.4190.0

Once this setting is saved and Firefox is closed, every subsequent reopening of Firefox will soft-lock the computer. This will prevent all use of Firefox on the device without changing the specific file system configuration, as Firefox cannot be opened to remove this homepage setting. As this is a saved configuration, this will persist between reboots. To remove this soft-lock, the prefs.js file must be modified to remove the browser.startup.homepage value.



Steps to Replicate

Submit a protocol handler into the URL bar and press the “enter” key. If no applications open, re-submit the value and press the “enter” key again.

Here are three sample protocol handlers that will open an application on a default windows machine:
~ ms-photos:photos
~ microsoft.windows.camera:camera
~ ldap:ldap

To observe the homepage functionality, set the homepage at about:preferences#home to one of the above settings, then close and reopen Firefox. Once again, if no application opens on first reboot, close and reopen Firefox.



Remediation

Implement a protocol handler warning on all instances where a protocol handler is triggered from Firefox.

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

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

Impact

External programs could be launched without the usual warning, which the report says could be chained with past Windows protocol handler flaws for zero-click code execution, or used with certain handlers to soft-lock a machine persistently; the report notes that file access alone would already allow similar abuse.

What the attacker needed

Victim pastes or types the URL; or attacker can edit the homepage setting; first attempt may be silently ignored

The fix

A protocol handler warning should be shown in every case where Firefox triggers a protocol handler.

How it was found

  1. Type a protocol handler URL into the address bar and press enter.
  2. If nothing opens, submit the same value again and press enter.
  3. To test the homepage route, set the homepage to such a URL in preferences, then close and reopen Firefox.
  4. If nothing opens on the first restart, close and reopen Firefox again.

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.

A protocol handler is a program on your computer that the browser can hand a special kind of link to, such as a mail app for mailto links. Because these links can start programs outside the browser, Firefox normally asks you first. This report says that warning is missing when the link is typed straight into the address bar or saved as the homepage, so a program could start without you being asked.

What is Misconfiguration?

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

More from Mozilla

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.