Metasploit Cheatsheet

Source https://docs.metasploit.com/

Metasploit Cheat Sheet

The Metasploit Project is a computer security project that provides information on vulnerabilities, helping in the development of penetration tests and IDS signatures.

Metasploit is a popular tool used by pentest experts. I have prepared a document for you to learn.

Metasploit :

Search for module:

msf > search [regex]

Specify and exploit to use:

msf > use exploit/[ExploitPath]

Specify a Payload to use:

msf > set PAYLOAD [PayloadPath]

Show options for the current modules:

msf > show options

Set options:

msf > set [Option] [Value]

Start exploit:

msf > exploit 

Useful Auxiliary Modules

Port Scanner:

DNS Enumeration:

FTP Server:

Proxy Server:

msfvenom :

The msfvenom tool can be used to generate Metasploit payloads (such as Meterpreter) as standalone files and optionally encode them. This tool replaces the former msfpayload and msfencode tools. Run with ‘'-l payloads’ to get a list of payloads.

Example :

Reverse Meterpreter payload as an executable and redirected into a file:

Format Options (specified with –f) --help-formats – List available output formats exe – Executable pl – Perl rb – Ruby raw – Raw shellcode c – C code

Encoding Payloads with msfvenom

The msfvenom tool can be used to apply a level of encoding for anti-virus bypass. Run with '-l encoders' to get a list of encoders.

Example

Encode a payload from msfpayload 5 times using shikata-ga-nai encoder and output as executable:

Metasploit Meterpreter

Base Commands:

  • Target process must have same or lesser privileges

  • Target process may be a more stable process

  • When inside a process, can access any files that process has a lock on.

Network Commands:

Misc Commands:

Additional Modules:

Managing Sessions

Multiple Exploitation:

Run the exploit expecting a single session that is immediately backgrounded:

Run the exploit in the background expecting one or more sessions that are immediately backgrounded:

List all current jobs (usually exploit listeners):

Kill a job:

Multiple Sessions:

List all backgrounded sessions:

Interact with a backgrounded session:

Background the current interactive session:

Routing Through Sessions:

All modules (exploits/post/aux) against the target subnet mask will be pivoted through this session.

Last updated

Was this helpful?