Maintenance Service helper.exe File Deletion Elevation of Privilege
The Mozilla Maintenance Service's helper.exe creates a temporary directory in a world-writable location and later deletes it. A non-privileged user can replace that directory with a junction to an arbitrary target, causing helper.exe to delete files in that target, potentially leading to privilege escalation.
Originally disclosed on Mozilla
- Fixed in 18 months
- Paid in 19 months
- Disclosed after 18 months
Created attachment 8675071
poc.zip
The helper.exe creates a directory "ns{random character a-z generated with GetTickCount%26}{16bit hex value from GetTickCount()}.tmp" during execution in the C:\Windows\Temp directory und deletes it later.
At least in win7 the temp directory is writable for non privileged users. If during the execution a junction is created in the nsXXXX.tmp directory also the content of the target directory of the junction will be deleted from the helper.exe.
With the maintenance service and this vulnerbility it is possible to delete arbitrary files for non privileged users. Further with the ability to delete arbitrary files it´s possible to elevate privilege further.
The poc tries to empty the C:\test directory by creating a junction to it in the C:\Windows\temp\nsXXXX.tmp during the execution of the helper.exe. I have tested it with win7.
1.) first create the test directory which contains a file.
2.) in the updatework directory right to the loop.bat copy the updater.exe from the firefox directory and a current complete update mar file named to update.mar of the target firefox version (for example: https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/latest/update/win32/de/firefox-41.0.2.complete.mar)
3.) alter the paths in the loop.bat
4.) start the poc.exe and poc.bat and after a short time if the poc.exe is closed the C:\test directory will be empty.
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
Likely the helper.exe uses a predictable temporary directory name in a world-writable location and follows junctions when deleting, without verifying the directory's identity or restricting access.
Impact
A non-privileged user could delete arbitrary files, and the report claims this could be used to elevate privileges further.
What the attacker needed
Windows 7 (tested); non-privileged user account; Mozilla Maintenance Service installed
How it was found
- Create a test directory containing a file.
- Copy updater.exe and a complete update mar file into the updatework directory next to loop.bat.
- Alter the paths in loop.bat.
- Start poc.exe and poc.bat; after a short time, close poc.exe and the test directory will be empty.
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 privileged program creates a temporary folder in a place any user can write to. A regular user can swap that folder for a shortcut (junction) pointing to a sensitive folder. When the program cleans up, it deletes the contents of the sensitive folder instead, which can let the user remove protected files and possibly gain higher 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.