Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
5673178
Prepare version numbers for v3.8
OscarAkaElvis Oct 24, 2024
9a31d25
Modify .editorconfig file to adapt it to the indentation used in the …
OscarAkaElvis Oct 24, 2024
1c95823
Update logo
OscarAkaElvis Oct 24, 2024
4b5312f
Update README.md to show new logo existing in dev branch
OscarAkaElvis Oct 24, 2024
0fe16c7
Fix 2nd install method and add more cleaning to delete lately added u…
OscarAkaElvis Oct 24, 2024
40cf299
Set correct order of user-agent param to match order on README.md
OscarAkaElvis Oct 24, 2024
dd7ba0f
Update alpine version in Dockerfile. Remove redundant packages
OscarAkaElvis Oct 25, 2024
185ee0b
Modify .editorconfig file to add indentation definition for gemspec file
OscarAkaElvis Oct 28, 2024
aba2ace
Update ruby gem badge
OscarAkaElvis Oct 28, 2024
1f5352c
Add trailing slash in docker badge link to standardize
OscarAkaElvis Oct 28, 2024
e75f1e0
fix(kerberos): need krb5-libs to auth w/ gssapi
ArchiMoebius Dec 1, 2024
d734ccb
Merge pull request #68 from ArchiMoebius/dev
OscarAkaElvis Dec 2, 2024
c22b7c2
Update CHANGELOG.md
OscarAkaElvis Dec 2, 2024
27e9e48
add missing dependencies
noraj Sep 4, 2025
da21200
add version requirements
noraj Sep 5, 2025
b144694
reflect gemspec dependencies to docker
noraj Sep 5, 2025
e22ea42
Merge pull request #69 from noraj/patch-1
OscarAkaElvis Sep 6, 2025
d5631a1
Update CHANGELOG.md
OscarAkaElvis Sep 6, 2025
42421cd
Support Kerberos authentication over SSL
birk0 Sep 26, 2025
69f1c86
Merge pull request #70 from birk0/feature/ssl-kerberos-support
OscarAkaElvis Sep 26, 2025
c5403ed
Remove comment
OscarAkaElvis Sep 26, 2025
88285fe
Update CHANGELOG.md
OscarAkaElvis Sep 26, 2025
75558b5
Add clear/cls commands and Ctrl+L support for clearing screen
cybervaca Dec 6, 2025
9555daa
Fix autocomplete logic for upload/download commands and improve relat…
cybervaca Dec 6, 2025
26badab
Add persistent command history per user/host (stored in ~/.evil-winrm…
cybervaca Dec 6, 2025
46b0277
Add support for Kerberos ticket files with -K parameter, including au…
cybervaca Dec 6, 2025
87ee6e6
Add *.kirbi and *.ccache files to .gitignore
cybervaca Dec 6, 2025
4f8c2e2
Update success messages
OscarAkaElvis Dec 6, 2025
7f33609
Fix order of the messages shown in the screen to show always header (…
OscarAkaElvis Dec 6, 2025
5db78dd
Add controlled error message for expired Kerberos tickets
cybervaca Dec 6, 2025
0790eee
Reorder commands in menu
OscarAkaElvis Dec 6, 2025
73669fc
Update docs (README.md)
OscarAkaElvis Dec 6, 2025
a02c2e7
Fix missing param in docs (README.md)
OscarAkaElvis Dec 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,17 @@ charset = utf-8
end_of_line = lf
insert_final_newline = true

[*.{rb,md}]
[*.gemspec]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true

[*.rb]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true

[*.md]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ vendor/
.bundle/
.vscode/
*.gem
*.kirbi
*.ccache
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
### 3.8
- Added support for Kerberos ticket files (ccache and kirbi formats) with -K parameter, including automatic format detection/conversion and optional reverse DNS lookup for FQDN
- Added persistent command history per user/host (stored in ~/.evil-winrm/history/)
- Fixed autocomplete logic for upload/download commands and improved relative path handling with file validation
- Added clear/cls commands and Ctrl+L support for clearing screen
- Updated logo
- Fixed minor problem in Dockerfile, updated to new alpine version
- Added dependency to Dockerfile to make Kerberos to work (thanks ArchiMoebius)
- Added dependencies to Dockerfile and gemspec file to make it compatible with newer Ruby versions
- Fix error using Kerberos and SSL at the same time (thanks birk0)

### 3.7
- Fixed menu command to avoid being detected as malware
- Improved EDR evasion randomizing powershell function names and variables
Expand Down
36 changes: 24 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Evil-WinRM Dockerfile

# Base image
FROM alpine:3.14 AS final
FROM alpine:3.14 AS build
FROM alpine:3.20.3 AS final
FROM alpine:3.20.3 AS build

# Credits & Data
LABEL \
Expand Down Expand Up @@ -33,7 +33,8 @@ RUN apk --no-cache add cmake \
zlib-dev \
openssl-dev \
openssl \
bash
bash \
git

# Make the ruby path available
ENV PATH=$PATH:/opt/rubies/ruby-3.2.2/bin
Expand All @@ -45,9 +46,12 @@ RUN cd /tmp/ && \
cd ruby-install-0.8.1/ && make install && \
ruby-install -c ruby 3.2.2 -- --with-readline-dir=/usr/include/readline --with-openssl-dir=/usr/include/openssl --disable-install-rdoc

# Set directory for the deploy of the application
WORKDIR /opt

# Evil-WinRM install method 1 (only one method can be used, other must be commented)
# Install Evil-WinRM (DockerHub automated build process)
RUN mkdir /opt/evil-winrm
RUN mkdir evil-winrm
COPY . /opt/evil-winrm

# Evil-WinRM install method 2 (only one method can be used, other must be commented)
Expand All @@ -58,19 +62,28 @@ COPY . /opt/evil-winrm
#RUN git clone -b ${BRANCH} ${EVILWINRM_URL}

# Install Evil-WinRM ruby dependencies
RUN gem install winrm \
winrm-fs \
stringio \
RUN gem install benchmark \
csv \
fileutils \
logger \
fileutils
stringio \
syslog \
winrm \
winrm-fs

# Clean and remove useless files
RUN rm -rf /opt/evil-winrm/resources > /dev/null 2>&1 && \
rm -rf /opt/evil-winrm/.github > /dev/null 2>&1 && \
rm -rf /opt/evil-winrm/CONTRIBUTING.md > /dev/null 2>&1 && \
rm -rf /opt/evil-winrm/CODE_OF_CONDUCT.md > /dev/null 2>&1 && \
rm -rf /opt/evil-winrm/Dockerfile > /dev/null 2>&1 && \
rm -rf /opt/evil-winrm/Gemfile* > /dev/null 2>&1
rm -rf /opt/evil-winrm/Gemfile* > /dev/null 2>&1 && \
rm -rf /opt/evil-winrm/evil-winrm.gemspec > /dev/null 2>&1 && \
rm -rf /opt/evil-winrm/.rubocop.yml > /dev/null 2>&1 && \
rm -rf /opt/evil-winrm/.editorconfig > /dev/null 2>&1 && \
rm -rf /opt/evil-winrm/.gitignore > /dev/null 2>&1 && \
rm -rf /opt/evil-winrm/.gitattributes > /dev/null 2>&1 && \
rm -rf /opt/evil-winrm/bin > /dev/null 2>&1

# Rename script name
RUN mv /opt/evil-winrm/evil-winrm.rb /opt/evil-winrm/evil-winrm && \
Expand All @@ -83,9 +96,8 @@ FROM final
RUN apk --no-cache add \
readline \
yaml \
libffi \
zlib \
openssl
krb5-libs \
libffi

# Make the ruby and Evil-WinRM paths available
ENV PATH=$PATH:/opt/rubies/ruby-3.2.2/bin:/opt/evil-winrm
Expand Down
41 changes: 30 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Evil-WinRM [![Version-shield]](https://raw.githubusercontent.com/Hackplayers/evil-winrm/master/evil-winrm.rb) [![Ruby2.3-shield]](https://www.ruby-lang.org/en/news/2015/12/25/ruby-2-3-0-released/) [![Gem-Version]](https://rubygems.org/gems/evil-winrm) [![License-shield]](https://raw.githubusercontent.com/Hackplayers/evil-winrm/master/LICENSE) [![Docker-shield]](https://hub.docker.com/r/oscarakaelvis/evil-winrm)
# Evil-WinRM [![Version-shield]](https://raw.githubusercontent.com/Hackplayers/evil-winrm/master/evil-winrm.rb) [![Ruby2.3-shield]](https://www.ruby-lang.org/en/news/2015/12/25/ruby-2-3-0-released/) [![Gem-Version]](https://rubygems.org/gems/evil-winrm) [![License-shield]](https://raw.githubusercontent.com/Hackplayers/evil-winrm/master/LICENSE) [![Docker-shield]](https://hub.docker.com/r/oscarakaelvis/evil-winrm/)
The ultimate WinRM shell for hacking/pentesting

![Banner](https://raw.githubusercontent.com/Hackplayers/evil-winrm/master/resources/evil-winrm_logo.png)
![Banner](https://raw.githubusercontent.com/Hackplayers/evil-winrm/dev/resources/evil-winrm_logo.png)

## Description & Purpose
This shell is the ultimate WinRM shell for hacking/pentesting.
Expand All @@ -26,7 +26,7 @@ protocol, it is using PSRP (Powershell Remoting Protocol) for initializing runsp
- Load x64 payloads generated with awesome [donut] technique
- Dynamic AMSI Bypass to avoid AV signatures
- Pass-the-hash support
- Kerberos auth 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
Expand All @@ -43,11 +43,12 @@ protocol, it is using PSRP (Powershell Remoting Protocol) for initializing runsp

## Help
```
Usage: evil-winrm -i IP -u USER [-s SCRIPTS_PATH] [-e EXES_PATH] [-P PORT] [-p PASS] [-H HASH] [-U URL] [-S] [-c PUBLIC_KEY_PATH ] [-k PRIVATE_KEY_PATH ] [-r REALM] [--spn SPN_PREFIX] [-l]
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
Expand Down Expand Up @@ -126,6 +127,7 @@ To use IPv6, the address must be added to /etc/hosts. Just put the already set n

- **services**: list all services showing if there your account has permissions over each one. No administrator permissions needed to use this feature.
- **menu**: load the `Invoke-Binary`, `Dll-Loader` and `Donut-Loader` functions that we will explain below. When a ps1 is loaded all its functions will be shown up.
- **clear** or **cls**: clear the terminal screen. You can also use `Ctrl+L` keyboard shortcut to clear the screen.

```
*Evil-WinRM* PS C:\> menu
Expand All @@ -149,6 +151,8 @@ _".,_,.__).,) (.._( ._), ) , (._..( '.._"._, . '._)_(..,_(_".) _( _')
[+] services
[+] upload
[+] download
[+] clear
[+] cls
[+] menu
[+] exit

Expand Down Expand Up @@ -346,16 +350,25 @@ This script contains malicious content and has been blocked by your antivirus so
### Kerberos
- First you have to sync date with the DC: `rdate -n <dc_ip>`

- To generate ticket there are many ways:
- To generate ticket there are many ways:

* Using [ticketer.py] from impacket
* If you get a kirbi ticket using [Rubeus] or [Mimikatz] you have to convert to ccache using [ticket_converter.py]
* Using [Rubeus] or [Mimikatz] to get kirbi tickets (automatic conversion to ccache is supported)

- Add ccache ticket. There are 2 ways:
- Add ticket file. There are 3 ways:

`export KRB5CCNAME=/foo/var/ticket.ccache`
`export KRB5CCNAME=/foo/var/ticket.ccache`

`cp ticket.ccache /tmp/krb5cc_0`
`cp ticket.ccache /tmp/krb5cc_0`

Use the `-K` parameter: `evil-winrm -i hostname -r DOMAIN.COM -K /path/to/ticket.ccache` or `evil-winrm -i hostname -r DOMAIN.COM -K /path/to/ticket.kirbi`

When using `-K`, the tool will automatically:
- Detect the ticket format (ccache or kirbi)
- Convert kirbi tickets to ccache format if needed (requires ticket_converter.py or impacket-ticketConverter)
- Validate the file exists and is readable
- Set the `KRB5CCNAME` environment variable
- Resolve IP addresses to FQDN for better Kerberos compatibility

- Add realm to `/etc/krb5.conf` (for linux). Use of this format is important:

Expand Down Expand Up @@ -467,6 +480,12 @@ It is recommended to use this new installed ruby only to launch evil-winrm. If y

This feature will create files on your $HOME dir saving commands and the outputs of the WinRM sessions.

### Command History

Evil-WinRM maintains a persistent command history for each host and user combination. The history is stored in `~/.evil-winrm/history/` directory with files named as `{host}_{user}.hist`.

When you connect to a machine you've previously accessed, you can use the arrow keys (Up/Down) to navigate through your previous commands. The history is automatically saved after each command execution and loaded when you reconnect to the same host with the same user.

### Known problems. OpenSSL errors

Sometimes, you could face an error like this:
Expand Down Expand Up @@ -561,8 +580,8 @@ Use it at your own servers and/or with the server owner's permission.
[@arale61]: https://twitter.com/arale61

<!-- Badges URLs -->
[Version-shield]: https://img.shields.io/badge/version-3.7-blue.svg?style=flat-square&colorA=273133&colorB=0093ee "Latest version"
[Version-shield]: https://img.shields.io/badge/version-3.8-blue.svg?style=flat-square&colorA=273133&colorB=0093ee "Latest version"
[Ruby2.3-shield]: https://img.shields.io/badge/ruby-2.3%2B-blue.svg?style=flat-square&colorA=273133&colorB=ff0000 "Ruby 2.3 or later"
[License-shield]: https://img.shields.io/badge/license-LGPL%20v3%2B-blue.svg?style=flat-square&colorA=273133&colorB=bd0000 "LGPL v3+"
[Docker-shield]: https://img.shields.io/docker/automated/oscarakaelvis/evil-winrm.svg?style=flat-square&colorA=273133&colorB=a9a9a9 "Docker rules!"
[Gem-Version]: https://badge.fury.io/rb/evil-winrm.svg "Ruby gem"
[Gem-Version]: https://img.shields.io/gem/v/evil-winrm?style=flat-square&colorA=273133&colorB=46c249 "Ruby gem"
5 changes: 4 additions & 1 deletion evil-winrm.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gem::Specification.new do |spec|
spec.name = 'evil-winrm'
spec.version = '3.7'
spec.version = '3.8'
spec.license = 'LGPL-3.0'
spec.authors = %w[CyberVaca OscarAkaElvis Jarilaos Arale61]
spec.email = ['oscar.alfonso.diaz@gmail.com']
Expand All @@ -25,9 +25,12 @@ Gem::Specification.new do |spec|
spec.bindir = "bin"
spec.executables = ["evil-winrm"]

spec.add_dependency 'benchmark', '>= 0.1.0'
spec.add_dependency 'csv', '>= 2.4.8'
spec.add_dependency 'fileutils', '~> 1.0'
spec.add_dependency 'logger', '~> 1.4', '>= 1.4.3'
spec.add_dependency 'stringio', '~> 3.0'
spec.add_dependency 'syslog', '>= 2.1.0'
spec.add_dependency 'winrm', '~> 2.3', '>= 2.3.7'
spec.add_dependency 'winrm-fs', '~> 1.3', '>= 1.3.2'

Expand Down
Loading
Loading