During penetration testing if you’re lucky enough to find a remote command execution vulnerability, you’ll more often than not want to connect back to your attacking machine to leverage an interactive shell.
Below are a collection of reverse shells that use commonly installed programming languages, or commonly installed binaries (nc, telnet, bash, etc). At the bottom of the post are a collection of uploadable reverse shells, present in Kali Linux.
Setup Listening Netcat
Your remote shell will need a listening netcat instance in order to connect back.
Set your Netcat listening shell on an allowed port
Use a port that is likely allowed via outbound firewall rules on the target network, e.g. 80 / 443
To setup a listening netcat instance, enter the following:
NAT requires a port forward
If you’re attacking machine is behing a NAT router, you’ll need to setup a port forward to the attacking machines IP / Port.
ATTACKING-IP is the machine running your listening netcat session, port 80 is used in all examples below (for reasons mentioned above).
Bash Reverse Shells
PHP Reverse Shell
Netcat Reverse Shell
Telnet Reverse Shell
Remember to listen on 443 on the attacking machine also.
Perl Reverse Shell
Perl Windows Reverse Shell
Ruby Reverse Shell
Java Reverse Shell
Python Reverse Shell
Gawk Reverse Shell
Kali Web Shells
The following shells exist within Kali Linux, under /usr/share/webshells/ these are only useful if you are able to upload, inject or transfer the shell to the machine.