Hi all,
installers compiled with NSIS 3.02 to 3.03 load the ntmarta.dll from the exe directory which might lead to a vulnerability if an attacker can make a user download a compromised ntmarta.dll.
This is reproducible on Windows 7 with or without SP1 and 32 or 64 Bit. But it requires the system to be rebooted. On a fresh installation the dll is not loaded but after some reboots it will be loaded.
I've attached a gif to show that it loads a dll that opens a cmd window.
Here's the code of the simple installer I used:
# set the name of the installer
Outfile "simple-3.03.exe"
# create a default section.
Section
# create a popup box, with an OK button and the text "Hello world!"
DetailPrint "Just a simple installer"
SectionEnd
I fixed this by adding ntmarta.dll to the Source\exehead\Main.c preloads:
"NTMARTA\0" // Win7 with and without SP1
I added it in line 126.
After compiling with SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all NSIS_CONFIG_CONST_DATA_PATH=no and exchanging makensis.exe and the stubs the simple installer doesn't load the dll anymore.
If you need any more information please let me know.
Regards,
Torben
Looks like the animations were removed during uploading. Here's a screenshot of the running installer.
I could not reproduce this. I used 32-bit Windows 7 SP0 (6.1.7600) and a simple do nothing installer.
I rebooted twice (restart from the start menu) and on the third boot running the test installer does not show ntmarta.dll in Process Explorer (not in the application directory nor system32).
System::Call 'kernel32::GetModuleHandle(t"ntmarta")p.r0'in the installer is also 0.Does your machine have any kind of anti-virus or other security/tweaking software installed? Does it happen in SP0/RTM for you or just service packs?
There's no additional software installed besides the VMWare tools. No Windows updates at all, it also occurs on a fresh installed Win 7 32-bit (same build as yours). Please see the attached screenshot.
I tested on real hardware with no internet connection.
Does it always happen after the first reboot or can it require more than one reboot before it triggers?
Do you have the skills to set a breakpoint in WinDbg so we can get a call stack to find out who is loading it?
I haven't done it yet but maybe you can give me a hint? I already installed windbg (just the debugger from the Windows 7 SDK), here's the output of running the simple installer:
First fix your symbols https://stackoverflow.com/questions/30019889/how-to-set-up-symbols-in-windbg
I was able to reproduce it now, not sure how many times I rebooted or why that matters in the first place.
SetErrorModeis the first function NSIS calls so it is a nice thing to put a breakpoint on to speed things up. Then I didbp kernelbase!LoadLibraryExWand then justkcn;guntil the module in question is loaded. The culprit isADVAPI32!AccProvpLoadMartaFunctionscalled bySetEntriesInAcland that is called deep down in a codepath related to shell pidls and known folders and the top level problematic function isSHGetFileInfo. There is 25 shell functions between us and the issue in the call stack and it should be fixed if you allow Windows Update to update the system (because we restrict loading to system32 only on patched systems) but I guess we need to add this module to the pre-load workaround list as well. Thank you for reporting.You refer to KB2533623, right? I know that updating will help but I wanted to let you know. You never know on which systems the installers are executed. Thank you for taking care of it!
Here is the full callstack from a tool I made:
Not really sure why the shell feels it needs to change the ACL on a folder or how it detects that the ACL is somehow bad.
Last edit: Anders 2018-03-13
And it needed more than one reboot, two or three maybe.