Skip to content
Access control Disclosed report Advanced CVE-2020-15663

Mozilla Maintenance Service Privilege Escalation via updater.exe if Firefox is installed in non-default location

When Firefox is installed in a folder a normal user can write to, a local attacker can swap in an old, vulnerable updater.exe and a crafted updater.ini. The Mozilla Maintenance Service then runs that old updater with SYSTEM rights, letting the attacker run their own code at the highest privilege level.

Xiaoyin Liu Follow

Originally disclosed on Mozilla

  • Fixed in 44 days
  • Paid in 55 days
  • Disclosed after 44 days
Text
Created attachment 9154016
poc.zip

This report is inspired by CVE-2019-11753 (Bug 1574980) and CVE-2017-7766 (Bug 1342742).

Summary: If a user has installed Firefox to a standard-user-writable location, then a local attacker who already has non-admin privilege can escalate his privilege to SYSTEM.

Detail: Since the Firefox installation path is user-writable, a local attacker can replace any files in the installation path. What we need to replace are `updater.exe` and `updater.ini`. Although the Maintenance Service checks if `updater.exe` contains an identity string and is signed by Mozilla, it doesn't check its file version. Thus, we can replace the currently installed `updater.exe` with an old and vulnerable version of `updater.exe`, and, from what I observed, the Maintenance Service copies the old `updater.exe` and `updater.ini` to `C:\Program Files (x86)\Mozilla Maintenance Service\update`, and then runs the old `updater.exe` with SYSTEM privilege.

The old `updater.exe` I choose to use is version 51.0.1, so that I can exploit Bug 1342742 again. (Actually exploiting the first part of Bug 1342742 is all we need, because we can edit `updater.ini` directly.)

After `updater.exe` finishes applying `update.mar`, it runs the program specified in [PostUpdateWin] section in `updater.ini`. We specify a full path for `ExeRelPath`. It has to be Mozilla-signed, but since the attacker has total control of the directory, we can use DLL injection to run attacker's code. For example, we can place a malicious `version.dll` in the same directory as `ExeRelPath`. The code in `version.dll` will run with SYSTEM privilege.

Reproduce: (Test environment: OS: Windows 10 x64 Build 19041.264. Firefox version: 76.0.1)
1. Uninstall your current Firefox, and then install it to `C:\Common\Mozilla Firefox`
2. Log in a standard Windows user account
3. Create folder C:\test\poc
4. Unzip the attachment to C:\test\poc
5. Download https://archive.mozilla.org/pub/firefox/releases/51.0.1/update/win32/en-US/firefox-51.0.1.complete.mar, and save it to `C:\test\poc\123\updates\0\update.mar`
6. There are two files under `C:\test\poc\copy to Firefox install dir`: `updater.exe` and `updater.ini`. Copy them to your Firefox installation directory, overwriting the existing ones.
7. Open cmd.exe . Run `sc start MozillaMaintenance MozillaMaintenance software-update unused C:\test\poc\123\updates\0 "C:\Common\Mozilla Firefox" "C:\Common\Mozilla Firefox\updated" -1 . C:\test\poc\uninstall.update`
8. After a few seconds, you can see the poc creates a file "C:\DLLPlanting\dll_output.txt", whose content is: `Filename=C:\test\poc\fakesetup.exe   Integrity level=System`, which proves the PoC is run with SYSTEM privilege.

The original report as published on Mozilla's Bugzilla, by Xiaoyin Liu. 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

Root cause

The Maintenance Service verified that updater.exe was signed by Mozilla but did not check its version, so an outdated and vulnerable updater could be substituted.

Impact

A local attacker with only standard user rights could gain SYSTEM privileges, but only if Firefox was installed in a location that user can write to.

What the attacker needed

Firefox installed in a user-writable folder; Local standard user account; Ability to write to the install directory

How it was found

  1. Install Firefox into a folder that a standard user can write to.
  2. Log in as a standard Windows user and prepare a working folder with the proof-of-concept files.
  3. Download an old complete update package and place it in the expected updates folder.
  4. Copy the old updater.exe and crafted updater.ini over the ones in the Firefox install directory.
  5. Start the Mozilla Maintenance Service update command pointing at the prepared folder.
  6. Observe the created output file showing the code ran at System integrity level.

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.

Windows has a background service that installs Firefox updates for you, and it runs with very high permissions. If Firefox lives in a folder that ordinary users can change, an attacker can put an old, buggy copy of the updater there. The service trusts that old copy and runs it with those high permissions, so the attacker's code gets them too.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by Xiaoyin Liu

View all

2 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.