Arbitrary code execution by Maintenance Service with junctions
Originally disclosed on Mozilla
- Fixed in 25 days
- Paid in 20 days
- Disclosed after 25 days
Created attachment 724211
Proof-of-concept source + binaries
I was having a bit of a poke around the Mozilla Maintenance Service and believe I've come across a vulnerability that lets unprivileged users execute arbitrary code as the SYSTEM user.
The crux of the problem is that updatehelper.cpp:IsLocalFile() doesn't take into account the existence of junctions (which standard users can create). We can fool the Maintenance Service into thinking the updater.exe is on a local drive, by creating a junction, eg. c:\thumbdrive to a removable drive d:. PathStripToRootW returns c: so the process continues.
This leads to a race condition since we can dismount the drive after the updater.exe has been validated (workmonitor.cpp:403). This kills the write-lock the Maintenance Service has on the updater.exe. Between the validation and when the process is run (workmonitor.cpp:182) we can replace the lockless file with our malicious payload which the Maintenance Service then happily executes as the SYSTEM user.
I've attached a proof-of-concept to this bug. It executes reliably for me on Windows 7 x64, FF 19.0.2. I believe Vista and XP would be vulnerable as well, but haven't confirmed.
To run the proof-of-concept, you will need to have the binaries run_exploit.exe and payload.exe in "C:\exploit", Firefox installed to "C:\Program Files (x86)\Mozilla Firefox", and a removable drive mounted.
run_exploit.exe takes one mandatory parameter - the drive letter of your removable drive (eg. c:\exploit\run_exploit.exe d:). It will create updater.exe and updater.ini on the removable drive, and a c:\thumbdrive junction.
payload.exe can be replaced with your payload of choice. This one just executes system("whoami > /foo.txt"); to verify the process has SYSTEM credentials. It will create foo.txt in the root drive.
Source code for both are contained in the attached zip file.
If you need any more info please let me know.
Seb
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is known
A high-severity RCE bug in Application Update. Mozilla made it public on 7 April 2013 as CVE-2013-1672.
About RCE
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.