Practice library / Penetration testing, first steps
Lab · Medium · 75 minutesFree account
Metasploit Framework Basics
msfconsole, searching modules, setting options, running exploits, and Meterpreter.
On this page 11 sections
Before you start
Metasploit is the penetration testing framework that turns a confirmed vulnerability into a shell in a few minutes. Security engineers meet it on every red-team engagement and in every public breach report that names "a known exploit, weaponised with a public tool". Here you drive msfconsole from scratch: pick a module, set its options, catch a Meterpreter session and generate a standalone payload with MSFvenom.
Lab Objectives
- Navigate the msfconsole interface and understand the module structure
- Search for, select, and configure exploit modules
- Understand the difference between staged and stageless payloads
- Gain a Meterpreter shell and navigate it effectively
- Perform basic post-exploitation: system info, privilege check, file access
- Generate standalone payloads with MSFvenom
Authorised Use Only. Metasploit is a powerful exploitation framework. Only use it against systems you own or have explicit written permission to test. Use Metasploitable2 or a local VM as your practice target.
What is Metasploit?
The Metasploit Framework is the world's most widely used penetration testing platform, developed by Rapid7. It contains hundreds of pre-built exploits, payloads, encoders, and post-exploitation modules — letting you go from vulnerability to shell quickly and reliably.
Key components:
- Exploits — Code that takes advantage of a vulnerability
- Payloads — Code that runs on the target after exploitation (e.g. a shell)
- Auxiliaries — Scanners, fuzzers, and other support modules
- Post modules — Post-exploitation: credential dumping, pivoting, persistence
- Encoders — Obfuscate payloads to evade AV detection
Step 1: Starting msfconsole
# Start the PostgreSQL database (Metasploit uses it to store data)
sudo systemctl start postgresql
# Initialise the database on first run
sudo msfdb init
# Launch the console
sudo msfconsole
# Verify database connection
msf6 > db_status
Connected to msf. Connection type: postgresql.
# Check version
msf6 > versionStep 2: Searching for Modules
# Search by keyword
msf6 > search eternalblue
msf6 > search type:exploit platform:linux apache
# Search by CVE number
msf6 > search cve:2021-44228
# Search by service
msf6 > search name:smb type:exploit
# List all auxiliary scanners for a service
msf6 > search type:auxiliary name:sshThe search results show a Rank column. Ranks from best to worst: excellent, great, good, normal, average, low, manual. Always prefer excellent or great ranked modules.
Sign in to continue
8 more sections are for signed-in members. It is free: sign in with Google.