Metasploit is the world’s most widely used penetration testing framework. It gives security professionals a structured, modular platform to discover vulnerabilities, develop and test exploits, and simulate real-world attacks against authorised targets — all from a single, consistent command-line interface.
This introduction to Metasploit covers everything you need to understand the framework from the ground up. Metasploit was created by HD Moore in 2003, acquired by Rapid7 in 2009, and is today maintained as the open-source Metasploit Framework alongside the commercial Metasploit Pro edition. It ships pre-installed on Kali Linux and is central to virtually every hands-on penetration testing curriculum in the industry.
At its core, Metasploit is a collection of modules — self-contained pieces of code that each perform a specific security testing task. These modules are organised into categories and accessed through a command-line interface called msfconsole. The framework’s modular design means that new exploits, payloads, and post-exploitation tools can be added continuously without changing the core architecture.
Think of Metasploit like a professional tradesperson’s toolbox. Each module is a different specialised tool — a screwdriver, a drill, a wrench. The msfconsole is the toolbox itself, keeping everything organised and accessible in one place. A skilled tradesperson does not use every tool on every job. They select the right tool, configure it for the specific task, and execute with precision.
Metasploit framework architecture: key components
Component 01: Exploits (Core modules)
Code that takes advantage of a specific vulnerability in a target system. Each exploit module targets a precise CVE or weakness in a specific software version, service, or operating system.
Component 02: Payloads (Post-exploit code)
Code that runs on the target after the exploit succeeds. Payloads include Meterpreter (an advanced in-memory shell), reverse shells, bind shells, and command execution stagers.
Component 03: Auxiliary modules(Scanning and recon)
Modules for scanning, enumeration, brute-forcing, and fuzzing that do not use a payload. Include port scanners, service version detectors, SNMP walkers, and credential testers.
Component 04: Post modules (After compromise)
Modules that run on already-compromised targets to gather intelligence, escalate privileges, harvest credentials, pivot to new network segments, and establish persistence.
Component 05: Encoders (Obfuscation)
Transform payloads to avoid signature-based detection by antivirus tools and intrusion detection systems. Encoders modify the byte pattern of a payload without changing its function.
Component 06: Meterpreter (Advanced payload)
Metasploit’s most powerful payload. Runs entirely in memory — leaving no files on disk — and provides an interactive shell with file system access, process injection, screenshot capture, and privilege escalation commands.
Metasploit practical examples with msfconsole




Essential msfconsole commands reference
| search [term] | Search all modules by keyword, CVE number, platform, or module type. The fastest way to find the right module. |
| use [module] | Load a module into the active context. After use, the prompt changes to show the active module name. |
| info | Display full details about the active module including description, required options, targets, and references to CVEs and vulnerability disclosures. |
| show options | List all configurable parameters for the active module — showing which are required, their current values, and descriptions. |
| set [opt] [val] | Set a module option value. Commonly used to set RHOSTS (target), LHOST (listener IP), LPORT (listener port), and payload. |
| run / exploit | Execute the active module. Both commands perform the same action — run is used for auxiliary and post modules, exploit for exploit modules. |
| sessions | List all active sessions including Meterpreter and shell sessions. Use sessions -i [id] to interact with a specific session. |
| db_nmap | List all active sessions, including Meterpreter and shell sessions. Use sessions -i [id] to interact with a specific session. |
The Metasploit workflow for a structured engagement follows four consistent steps: 1 — Use db_nmap or import existing Nmap results to populate the database. 2 — Run auxiliary scanner modules against discovered hosts to confirm vulnerable versions. 3 — Select and configure the appropriate exploit module with the correct payload. 4 — Execute the exploit, interact with the Meterpreter session, and run post-exploitation modules to gather evidence for the report.
Practice platforms for safe Metasploit learning: Never test Metasploit against systems you do not own. Use TryHackMe (free beginner rooms), Hack The Box (structured challenge machines), VulnHub (downloadable vulnerable VMs), or set up Metasploitable 2 — a deliberately vulnerable Linux VM provided by Rapid7 specifically for safe Metasploit practice and certification preparation.
The Metasploit workflow for a structured engagement follows four consistent steps: 1 — Use db_nmap or import existing Nmap results to populate the database. 2 — Run auxiliary scanner modules against discovered hosts to confirm vulnerable versions. 3 — Select and configure the appropriate exploit module with the correct payload. 4 — Execute the exploit, interact with the Meterpreter session, and run post-exploitation modules to gather evidence for the report.
Practice platforms for safe Metasploit learning: Never test Metasploit against systems you do not own. Use TryHackMe (free beginner rooms), Hack The Box (structured challenge machines), VulnHub (downloadable vulnerable VMs), or set up Metasploitable 2 — a deliberately vulnerable Linux VM provided by Rapid7 specifically for safe Metasploit practice and certification preparation.
Legal and ethical requirement. Metasploit is a professional security testing tool designed for authorised penetration testing engagements. Using Metasploit against any system without explicit written permission from the owner constitutes unauthorised computer access and is illegal under the Computer Fraud and Abuse Act in the USA, the Computer Misuse Act in the UK, and equivalent legislation globally. All examples in this guide are for authorised assessments, approved lab environments, and cybersecurity education only.
Frequently asked questions about Metasploit
What is the difference between Metasploit Framework and Metasploit Pro?
Metasploit Framework is the free, open-source version maintained on GitHub that provides the full msfconsole interface, all public exploit and auxiliary modules, Meterpreter, and database integration. It is the version pre-installed on Kali Linux and used in all certification training. Metasploit Pro is the commercial version by Rapid7 — it adds a web-based GUI, automated exploitation workflows, social engineering campaign management, compliance reporting, and team collaboration features designed for enterprise security teams. For penetration testing certification preparation and professional use, the free Metasploit Framework provides everything needed.
What is Meterpreter, and why is it preferred over a standard shell?
Meterpreter is Metasploit’s advanced in-memory payload that runs entirely within the memory of the compromised process — it writes no files to disk, making it significantly harder for antivirus and endpoint detection tools to detect compared to file-based payloads. It provides an interactive command shell with built-in commands for file system navigation, process listing, privilege escalation, credential harvesting, screenshot capture, keylogging, and pivoting to new network segments. Meterpreter sessions can be encrypted and can migrate between processes to maintain persistence. These capabilities make it the preferred payload for post-exploitation phases in professional penetration testing engagements.
Which certifications cover Metasploit in their curriculum?
Metasploit is one of the most heavily tested tools across security certifications. The OSCP (Offensive Security Certified Professional) restricts Metasploit use to one machine during its 24-hour exam to ensure candidates develop manual exploitation skills — but the labs heavily use Metasploit for learning. The CEH (Certified Ethical Hacker) includes Metasploit as a named tool across its exploitation, post-exploitation, and system hacking modules. CompTIA PenTest+ covers Metasploit framework concepts within its exploitation and post-exploitation objectives. The GPEN and eJPT also cover Metasploit as a primary penetration testing platform.

