Unsafe temp directory usage in maintenservice_installer.exe lead to possible privilege escalation
Originally disclosed on Mozilla
- Fixed in 2 months
- Paid in 3 months
- Disclosed after 2 months
Created attachment 8362475
poc.rar
I have seen the following behavior with windows 7 32bit and the maintenservice_installer.exe which is for example executed during an update process with the mozilla maintenance service.
The installer creates during execution a file with the following name format and executes the file:
C:\Windows\Temp\ns{random character a-z generated with GetTickCount%26}{16bit hex value from GetTickCount()}.tmp\ns{16bit hex value from GetTickCount()}.tmp
For example: C:\Windows\Temp\nscFF1B.tmp\nsFFCA.tmp
It is possible to force the executable to load dlls from the current directory with an „executable.local” dirctory in the directory of the executable (windows specific feature).
For the example with a ”C:\Windows\Temp\nsFF1B.tmp\nsFFCA.tmp.local” directory, the dlls loaded from the nsFFCA.tmp executable will be first searched in the nsFFCA.tmp.local directory, then in the nscFF1B.tmp directory and at least at the system path.
Because the temp directory is writable for normal users and the path is easy to guess because of the use of GetTickCount() there is a privilege escalation vulnerability.
POC:
To try out the poc you need firefox 26.0 with the maintenance service installed and a 32bit windows. I used windows 7. My poc tries to force the executable to load a fake mcrvrt.dll from the directory to start a calc.exe with system rights. Because of GetTickCount() this attack is timing dependent.
Steps:
1.) download poc and extract the files
2.) copy the updater.exe from the firefox directory to the poc/update directory
3.) download http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/26.0/update/win32/en-US/firefox-26.0.complete.mar and save the file as update.mar in the poc/update directory
4.) alter the paths in update.bat to your paths
5.) start poc.exe
6.) start update.bat
7.) wait for output from poc.exe
8.) check for calc.exe
9.) if no calc.exe found, start update again
With windows 7 64bit no executable is loaded in the temp directory, so this will not work but maybe there is another way. Maybe the source of this vulnerability is in the nullsoft installer system and not in the script to create the installer, so maybe it's a general nsis problem.
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 access control bug in Installer. Mozilla made it public on 29 March 2014 as CVE-2014-1520.
About 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.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
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.