Metasploit cheat sheet for penetration testing

This Metasploit Framework cheat sheet covers the essential commands and workflows for comprehensive penetration testing, from initial reconnaissance to post-exploitation and persistence.

Installation & Setup

Installing and configuring the open-source Metasploit Framework across different platforms.

bash

# Install on Kali Linux (pre-installed)
sudo apt update && sudo apt install metasploit-framework

# Install on Ubuntu/Debian
curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall
chmod 755 msfinstall
./msfinstall

# Install on CentOS/RHEL
curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall
chmod 755 msfinstall
./msfinstall

# Install via Git (development)
git clone https://github.com/rapid7/metasploit-framework.git
cd metasploit-framework
bundle install

# Initialize the database
sudo msfdb init
sudo msfdb start

# Update Metasploit
msfupdate

# Verify installation
msfconsole --version

Initial Reconnaissance & Information Gathering

Using Metasploit modules to gather intelligence about targets before exploitation.

bash

Vulnerability Scanning & Assessment

Identifying potential vulnerabilities using Metasploit's built-in scanners.

bash

Exploitation Phase

Launching exploits against identified vulnerabilities to gain initial access.

bash

Payload Configuration & Handlers

Configuring payloads and setting up listeners for reverse connections.

bash

Post-Exploitation & Lateral Movement

Maintaining access, gathering information, and moving through the network.

bash

Persistence & Backdoors

Establishing persistent access to compromised systems.

bash

Network Pivoting & Tunneling

Using compromised systems to access internal network segments.

bash

Web Application Exploitation

Targeting web applications and services specifically.

bash

Password Attacks & Cracking

Conducting password attacks and processing captured credentials.

bash

Evasion & Anti-Forensics

Bypassing security controls and covering tracks.

bash

Database Integration & Automation

Using the database for efficient penetration testing workflow.

bash

Useful Meterpreter Commands Quick Reference

bash

Common Resource Scripts for Automation

bash

Last updated