
evil-winrm v4.1
The ultimate WinRM shell for hacking/pentesting
Evil-WinRM ![Version-shield] ![Ruby2.3-shield] ![Gem-Version] ![License-shield] ![Docker-shield]
The ultimate WinRM shell for hacking/pentesting

Description & Purpose
This shell is the ultimate WinRM shell for hacking/pentesting.
WinRM (Windows Remote Management) is the Microsoft implementation of WS-Management Protocol. A standard SOAP based protocol that allows hardware and operating systems from different vendors to interoperate. Microsoft included it in their Operating Systems in order to make life easier to system administrators.
This program can be used on any Microsoft Windows Servers with this feature enabled (usually at port 5985), of course only if you have credentials and permissions to use it. So we can say that it could be used in a post-exploitation hacking/pentesting phase. The purpose of this program is to provide nice and easy-to-use features for hacking. It can be used with legitimate purposes by system administrators as well but the most of its features are focused on hacking/pentesting stuff.
It is based mainly in the WinRM Ruby library which changed its way to work since its version 2.0. Now instead of using WinRM protocol, it is using PSRP (Powershell Remoting Protocol) for initializing runspace pools as well as creating and processing pipelines.
Features
- Compatible to Linux and Windows client systems
- Load in memory Powershell scripts
- Load in memory dll files bypassing some AVs
- Load in memory C# (C Sharp) assemblies bypassing some AVs
- Load x64 payloads generated with awesome [donut] technique
- Dynamic AMSI Bypass to avoid AV signatures
- Pass-the-hash support
- Kerberos auth support including also ccache and kirbi files
- SSL and certificates support
- Upload and download files showing progress bar
- List remote machine services without privileges
- Command History
- WinRM command completion
- Local files/directories completion
- Remote path (files/directories) completion (can be disabled optionally)
- Colorization on prompt and output messages (can be disabled optionally)
- Optional logging feature
- Docker support (prebuilt images available at [Dockerhub])
- Trap capturing to avoid accidental shell exit on Ctrl+C
- Customizable user-agent using legitimate Windows default one
- ETW (Event Tracing for Windows) bypass
Help
Usage: evil-winrm -i IP -u USER [-s SCRIPTS_PATH] [-e EXES_PATH] [-P PORT] [-a USERAGENT] [-p PASS] [-H HASH] [-U URL] [-S] [-c PUBLIC_KEY_PATH ] [-k PRIVATE_KEY_PATH ] [-r REALM] [-K TICKET_FILE] [--spn SPN_PREFIX] [-l]
-S, --ssl Enable ssl
-c, --pub-key PUBLIC_KEY_PATH Local path to public key certificate
-k, --priv-key PRIVATE_KEY_PATH Local path to private key certificate
-r, --realm DOMAIN Kerberos auth, it has to be set also in /etc/krb5.conf file using this format -> CONTOSO.COM = { kdc = fooserver.contoso.com }
-K, --ccache TICKET_FILE Path to Kerberos ticket file (ccache or kirbi format, auto-detected)
-s, --scripts PS_SCRIPTS_PATH Powershell scripts local path
--spn SPN_PREFIX SPN prefix for Kerberos auth (default HTTP)
-e, --executables EXES_PATH C# executables local path
-i, --ip IP Remote host IP or hostname. FQDN for Kerberos auth (required)
-U, --url URL Remote url endpoint (default /wsman)
-u, --user USER Username (required if not using kerberos)
-p, --password PASS Password
-H, --hash HASH NTHash
-P, --port PORT Remote host port (default 5985)
-a, --user-agent Specify connection user-agent (default Microsoft WinRM Client)
-V, --version Show version
-n, --no-colors Disable colors
-N, --no-rpath-completion Disable remote path completion
-l, --log Log the WinRM session
-h, --help Display this help message
Requirements
Ruby 2.3 or higher is needed. Some ruby gems are needed as well: winrm >=2.3.7, winrm-fs >=1.3.2, stringio >=0.0.2, logger >= 1.4.3, fileutils >= 0.7.2, readline ~> 0.0.4, readline-ext ~> 0.2.0.
Depending of your installation method (4 availables) the installation of them could be required to be done manually.
Another important requirement only used for Kerberos auth is to install the Kerberos package used for network authentication.
For some Linux like Debian based (Kali, Parrot, etc.) it is called krb5-user. For BlackArch it is called krb5 and probably it could be called in a different way for other Linux distributions.
The remote path completion feature requires the native readline-ext binding, which is installed automatically as an Evil-WinRM dependency. Some systems require additional development packages to compile it. Check the section below for more info.
Installation & Quick Start (4 methods)
Method 1. Installation directly as ruby gem (dependencies will be installed automatically on your system)
- Step 1. Install it (it will install automatically dependencies):
gem install evil-winrm - Step 2. Ready. Just launch it!
evil-winrm -i 192.168.1.100 -u Administrator -p 'MySuperSecr3tPass123!' -s '/home/foo/ps1_scripts/' -e '/home/foo/exe_files/'
Method 2. Git clone and install dependencies on your system manually
- Step 1. Install dependencies manually:
sudo gem install winrm winrm-fs stringio logger fileutils readline readline-ext - Step 2. Clone the repo:
git clone https://github.com/Hackplayers/evil-winrm.git - Step 3. Ready. Just launch it!
cd evil-winrm && ruby evil-winrm.rb -i 192.168.1.100 -u Administrator -p 'MySuperSecr3tPass123!' -s '/home/foo/ps1_scripts/' -e '/home/foo/exe_files/'
Method 3. Using bundler (dependencies will not be installed on your system, just to use evil-winrm)
- Step 1. Install bundler:
gem install bundler - Step 2. Clone the repo:
git clone https://github.com/Hackplayers/evil-winrm.git - Step 3. Install dependencies with bundler:
cd evil-winrm && bundle install --path vendor/bundle - Step 4. Launch it with bundler:
bundle exec evil-winrm.rb -i 192.168.1.100 -u Administrator -p 'MySuperSecr3tPass123!' -s '/home/foo/ps1_scripts/' -e '/home/foo/exe_files/'
Method 4. Using Docker
- Step 1. Launch docker container based on already built image:
docker run --rm -ti --name evil-winrm -v /home/foo/ps1_scripts:/ps1_scripts -v /home/foo/exe_files:/exe_files -v /home/foo/data:/data oscarakaelvis/evil-winrm -i 192.168.1.100 -u Administrator -p 'MySuperSecr3tPass123!' -s '/ps1_scripts/' -e '/exe_files/'
Documentation
Clear text password
If you don't want to put the password in clear text, you can optionally avoid to set -p argument and the password will be prompted preventing to be shown.
Ipv6
To use IPv6, the address must be added to /etc/hosts. Just put the already set name of the host after -i argument instead of an IP address.
Basic commands
- upload: local files can be auto-completed using tab key.
- usage:
upload local_filenameorupload local_filename destination_filename
- usage:
- download:
- usage:
download remote_filenameordownload remote_filename destination_filename
- usage: