{"id":39883,"date":"2023-09-19T04:39:47","date_gmt":"2023-09-19T04:39:47","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=39883"},"modified":"2023-09-22T07:24:32","modified_gmt":"2023-09-22T07:24:32","slug":"what-is-metasploit-and-use-cases-of-metasploit","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/what-is-metasploit-and-use-cases-of-metasploit\/","title":{"rendered":"What is Metasploit and use cases of Metasploit?"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">What is Metasploit?<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2023\/09\/image-457-1024x576.png\" alt=\"\" class=\"wp-image-39931\" style=\"width:678px;height:382px\" width=\"678\" height=\"382\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2023\/09\/image-457-1024x576.png 1024w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2023\/09\/image-457-300x169.png 300w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2023\/09\/image-457-768x432.png 768w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2023\/09\/image-457-355x199.png 355w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2023\/09\/image-457.png 1200w\" sizes=\"auto, (max-width: 678px) 100vw, 678px\" \/><figcaption class=\"wp-element-caption\"><strong><em>What is Metasploit<\/em><\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<p><strong>Metasploit<\/strong> is a widely used penetration testing framework and tool that provides security professionals and ethical hackers with a comprehensive platform for testing and verifying the security of computer systems, networks, and applications. It offers a wide range of features and capabilities for conducting security assessments, including vulnerability scanning, exploitation, and post-exploitation activities.<\/p>\n\n\n\n<p>It can help organizations proactively identify and address security weaknesses and vulnerabilities, ultimately improving their overall security posture.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Top 10 use cases of Metasploit:<\/h2>\n\n\n\n<p>Here are the top 10 use cases of Metasploit:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Vulnerability Assessment<\/strong>: Metasploit can be used to scan and identify vulnerabilities in systems and applications. It provides information about open ports, services, and potential security weaknesses.<\/li>\n\n\n\n<li><strong>Exploitation Testing<\/strong>: Security professionals can use Metasploit to test the exploitation of known vulnerabilities to determine if they can be successfully compromised.<\/li>\n\n\n\n<li><strong>Penetration Testing<\/strong>: Ethical hackers and penetration testers use Metasploit to simulate real-world cyberattacks on systems and networks, helping organizations identify and fix vulnerabilities.<\/li>\n\n\n\n<li><strong>Privilege Escalation<\/strong>: Metasploit includes modules and tools for testing and exploiting privilege escalation vulnerabilities to gain higher-level access on compromised systems.<\/li>\n\n\n\n<li><strong>Payload Delivery<\/strong>: Users can create and deliver malicious payloads to target systems, including reverse shells and Meterpreter sessions, to gain remote access and control.<\/li>\n\n\n\n<li><strong>Client-Side Attacks<\/strong>: Metasploit supports client-side attacks, such as exploiting vulnerabilities in web browsers, document viewers, and email clients, through malicious files and phishing.<\/li>\n\n\n\n<li><strong>Password Cracking<\/strong>: Security professionals can use Metasploit&#8217;s password cracking modules to test the strength of user passwords and identify weak credentials.<\/li>\n\n\n\n<li><strong>Post-Exploitation<\/strong>: After gaining access to a system, Metasploit provides a suite of post-exploitation modules for tasks like lateral movement, data exfiltration, and maintaining persistence.<\/li>\n\n\n\n<li><strong>Exploit Development<\/strong>: Advanced users can leverage Metasploit&#8217;s development environment to create custom exploits for previously unknown vulnerabilities.<\/li>\n\n\n\n<li><strong>Security Awareness Training<\/strong>: Metasploit can be used in security awareness training programs to educate IT staff and employees about the risks of social engineering and phishing attacks.<\/li>\n<\/ol>\n\n\n\n<p>Metasploit is a powerful tool for security professionals, but it should be used responsibly and only in authorized and controlled environments.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What are the feature of Metasploit?<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2023\/09\/image-458.png\" alt=\"\" class=\"wp-image-39932\" style=\"width:666px;height:374px\" width=\"666\" height=\"374\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2023\/09\/image-458.png 961w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2023\/09\/image-458-300x169.png 300w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2023\/09\/image-458-768x432.png 768w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2023\/09\/image-458-740x414.png 740w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2023\/09\/image-458-355x199.png 355w\" sizes=\"auto, (max-width: 666px) 100vw, 666px\" \/><figcaption class=\"wp-element-caption\"><strong><em>Feature of Metasploit<\/em><\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<p><strong>Metasploit<\/strong> is a comprehensive penetration testing framework and toolset that offers a wide range of features and capabilities for conducting security assessments, identifying vulnerabilities, and testing the security of computer systems, networks, and applications. Here are the key features of Metasploit, along with insights into how it works and its typical architecture:<\/p>\n\n\n\n<p><strong>Features of Metasploit:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Exploit Development<\/strong>: Metasploit provides tools and resources for developing and testing custom exploits for vulnerabilities in target systems.<\/li>\n\n\n\n<li><strong>Vulnerability Scanning<\/strong>: Users can perform vulnerability scanning to identify potential security weaknesses in systems and applications.<\/li>\n\n\n\n<li><strong>Exploitation<\/strong>: Metasploit offers a vast collection of ready-to-use exploits and payloads for targeting vulnerabilities in various systems and applications.<\/li>\n\n\n\n<li><strong>Payload Delivery<\/strong>: It enables the creation and delivery of malicious payloads to compromised systems, allowing for remote access and control.<\/li>\n\n\n\n<li><strong>Post-Exploitation<\/strong>: Metasploit includes post-exploitation modules for tasks such as privilege escalation, lateral movement, data exfiltration, and maintaining persistence.<\/li>\n\n\n\n<li><strong>Password Cracking<\/strong>: The framework supports password cracking, allowing users to assess the strength of user passwords and credentials.<\/li>\n\n\n\n<li><strong>Client-Side Attacks<\/strong>: Metasploit can simulate client-side attacks, including those involving web browsers, email clients, and document viewers, through malicious files and phishing.<\/li>\n\n\n\n<li><strong>Module Ecosystem<\/strong>: It has a vast module ecosystem, including exploits, payloads, auxiliary modules, and post-exploitation modules, covering a wide range of vulnerabilities and scenarios.<\/li>\n\n\n\n<li><strong>Integration with Other Tools<\/strong>: Metasploit can be integrated with other security tools and services, allowing for seamless workflow integration.<\/li>\n\n\n\n<li><strong>Community and Commercial Versions<\/strong>: Metasploit is available in both open-source and commercial versions, providing flexibility to users based on their needs and requirements.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">How Metasploit works and Architecture?<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2023\/09\/image-460.png\" alt=\"\" class=\"wp-image-39934\" style=\"width:581px;height:377px\" width=\"581\" height=\"377\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2023\/09\/image-460.png 800w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2023\/09\/image-460-300x195.png 300w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2023\/09\/image-460-768x498.png 768w\" sizes=\"auto, (max-width: 581px) 100vw, 581px\" \/><figcaption class=\"wp-element-caption\"><strong><em>Metasploit works and Architecture<\/em><\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<p>Metasploit follows a modular architecture that consists of the following components:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Framework<\/strong>: The Metasploit Framework is the core component responsible for managing and coordinating various tasks, including module loading, payload generation, and communication with target systems.<\/li>\n\n\n\n<li><strong>Console<\/strong>: The Metasploit Console is the primary interface for interacting with the framework. Users can use the console to configure and execute modules, as well as view and analyze results.<\/li>\n\n\n\n<li><strong>Modules<\/strong>: Modules are the building blocks of Metasploit and include exploits, payloads, auxiliary modules, and post-exploitation modules. Exploits are used to target vulnerabilities, payloads are used for remote control, auxiliary modules perform various tasks, and post-exploitation modules are used for post-compromise activities.<\/li>\n\n\n\n<li><strong>Exploit Database<\/strong>: Metasploit maintains a comprehensive database of exploits, payloads, and module information. Users can search for modules based on specific criteria, including target systems and vulnerabilities.<\/li>\n<\/ol>\n\n\n\n<p>The typical workflow for using Metasploit involves these steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Information Gathering<\/strong>: Security professionals gather information about target systems, services, and applications using various reconnaissance techniques.<\/li>\n\n\n\n<li><strong>Vulnerability Scanning<\/strong>: Metasploit can perform vulnerability scanning to identify potential weaknesses in the target environment.<\/li>\n\n\n\n<li><strong>Exploit Selection<\/strong>: Users select appropriate exploits based on identified vulnerabilities and target systems.<\/li>\n\n\n\n<li><strong>Payload Generation<\/strong>: Metasploit generates payloads (e.g., reverse shells or Meterpreter sessions) to be delivered to the target systems.<\/li>\n\n\n\n<li><strong>Exploitation<\/strong>: The chosen exploits are executed against target systems, with payloads delivered to establish remote access and control.<\/li>\n\n\n\n<li><strong>Post-Exploitation<\/strong>: After compromising a system, users can utilize post-exploitation modules to perform additional tasks, maintain persistence, and explore the target environment.<\/li>\n\n\n\n<li><strong>Reporting and Remediation<\/strong>: Security professionals document findings, prioritize vulnerabilities, and provide recommendations for remediation to enhance the security of the target systems.<\/li>\n<\/ol>\n\n\n\n<p>Metasploit&#8217;s modular architecture and extensive module library make it a versatile tool for both security professionals and ethical hackers to conduct penetration tests, security assessments, and vulnerability management. However, it is crucial to use Metasploit responsibly and within authorized and controlled environments to avoid any misuse or harm.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Install Metasploit?<\/h2>\n\n\n\n<p>To install Metasploit, you can follow these steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Download the Metasploit installer for your operating system from the Rapid7 website: https:\/\/www.rapid7.com\/products\/metasploit\/download.<\/li>\n\n\n\n<li>Run the installer and apply the screen instructions.<\/li>\n\n\n\n<li>Once the installation is complete, you can start Metasploit by running the following command in a terminal window:<\/li>\n<\/ol>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">  msfconsole<\/code><\/span><\/pre>\n\n\n<p>This will launch the Metasploit console, where you can start exploring Metasploit&#8217;s features and capabilities.<\/p>\n\n\n\n<p><strong>Additional notes:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Metasploit can be installed on a variety of operating systems, including Windows, macOS, Linux, and Kali Linux.<\/li>\n\n\n\n<li>If you are installing Metasploit on a Windows machine, you may need to disable your antivirus software before running the installer.<\/li>\n\n\n\n<li>Once you have installed Metasploit, it is important to update it regularly to ensure that you have access to the latest security vulnerabilities and exploits.<\/li>\n<\/ul>\n\n\n\n<p><strong>Installing Metasploit as a service:<\/strong><\/p>\n\n\n\n<p>If you want Metasploit to start automatically when your system boots up, you can install it as a service. To do this, follow these steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open a terminal window.<\/li>\n\n\n\n<li>Navigate to the Metasploit installation directory.<\/li>\n\n\n\n<li>Run the following command:<\/li>\n<\/ol>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">  sudo msfconsole -x<\/code><\/span><\/pre>\n\n\n<ol class=\"wp-block-list\" start=\"4\">\n<li>At the Metasploit console prompt, type the following command and press Enter:<\/li>\n<\/ol>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">  service install<\/code><\/span><\/pre>\n\n\n<ol class=\"wp-block-list\" start=\"5\">\n<li>Follow the on-screen instructions to install Metasploit as a service.<\/li>\n<\/ol>\n\n\n\n<p>Once you have installed Metasploit as a service, it will start automatically when your system boots up. You can stop and start the Metasploit service using the following commands:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">  sudo service metasploit start\n  sudo service metasploit stop<\/code><\/span><\/pre>\n\n\n<h2 class=\"wp-block-heading\">Basic Tutorials of Metasploit: Getting Started<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2023\/09\/image-461-1024x576.png\" alt=\"\" class=\"wp-image-39935\" style=\"width:667px;height:375px\" width=\"667\" height=\"375\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2023\/09\/image-461-1024x576.png 1024w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2023\/09\/image-461-300x169.png 300w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2023\/09\/image-461-768x432.png 768w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2023\/09\/image-461-355x199.png 355w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2023\/09\/image-461.png 1280w\" sizes=\"auto, (max-width: 667px) 100vw, 667px\" \/><figcaption class=\"wp-element-caption\"><strong><em>Basic Tutorials of Metasploit<\/em><\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<p>Following are the stepwise Basic Tutorials of Metasploit<\/p>\n\n\n\n<p><strong>Metasploit<\/strong> is a penetration testing framework that provides a wide range of tools and resources for exploiting vulnerabilities, delivering payloads, and maintaining access to compromised systems. It is one of the most popular and widely used penetration testing tools available.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Requirements<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A Linux operating system (e.g., Kali Linux, Ubuntu, Debian)<\/li>\n\n\n\n<li>Metasploit installed on your system<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Getting Started<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open a terminal window and navigate to the Metasploit directory:<\/li>\n<\/ol>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">  cd \/usr\/share\/metasploit-framework\n<\/code><\/span><\/pre>\n\n\n<ol class=\"wp-block-list\" start=\"2\">\n<li>Start the Metasploit console:<\/li>\n<\/ol>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">  msfconsole\n<\/code><\/span><\/pre>\n\n\n<h3 class=\"wp-block-heading\">Basic Commands<\/h3>\n\n\n\n<p>Once you have started the Metasploit console, you can use the following basic commands to get started:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>help:<\/strong> Displays a list of all available commands and their descriptions.<\/li>\n\n\n\n<li><strong>search:<\/strong> Searches for exploits, payloads, encoders, and other modules in the Metasploit database.<\/li>\n\n\n\n<li><strong>use:<\/strong> Loads a specific module into memory.<\/li>\n\n\n\n<li><strong>show options:<\/strong> Displays a list of all options available for the currently loaded module.<\/li>\n\n\n\n<li><strong>set:<\/strong> Sets the value of a specific option for the currently loaded module.<\/li>\n\n\n\n<li><strong>run:<\/strong> Executes the currently loaded module.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Exploits<\/h3>\n\n\n\n<p>Exploits are modules that take advantage of vulnerabilities in target systems to gain unauthorized access. Metasploit includes a wide range of exploits for a variety of different vulnerabilities.<\/p>\n\n\n\n<p><strong>Loading an Exploit<\/strong><\/p>\n\n\n\n<p>To load an exploit, use the <code>use<\/code> command followed by the name of the exploit module. For example, to load the <code>exploit\/unix\/webapps\/tomcat_jsp_include<\/code> exploit, you would type the following command:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">  <span class=\"hljs-keyword\">use<\/span> <span class=\"hljs-title\">exploit<\/span>\/<span class=\"hljs-title\">unix<\/span>\/<span class=\"hljs-title\">webapps<\/span>\/<span class=\"hljs-title\">tomcat_jsp_include<\/span>\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><strong>Setting Exploit Options<\/strong><\/p>\n\n\n\n<p>Once you have loaded an exploit, you can use the <code>show options<\/code> command to view a list of all available options. You can then use the <code>set<\/code> command to set the values of these options.<\/p>\n\n\n\n<p>For example, the <code>exploit\/unix\/webapps\/tomcat_jsp_include<\/code> exploit has an option called <code>RHOST<\/code> which specifies the IP address of the target system. To set the value of this option to <code>192.168.1.100<\/code>, you would type the following command:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\">  <span class=\"hljs-selector-tag\">set<\/span> <span class=\"hljs-selector-tag\">RHOST<\/span> 192<span class=\"hljs-selector-class\">.168<\/span><span class=\"hljs-selector-class\">.1<\/span><span class=\"hljs-selector-class\">.100<\/span>\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><strong>Running an Exploit<\/strong><\/p>\n\n\n\n<p>Once you have set all of the necessary options, you can run the exploit by typing the following command:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">  run\n<\/code><\/span><\/pre>\n\n\n<p>If the exploit is successful, Metasploit will gain a shell on the target system.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Payloads<\/h3>\n\n\n\n<p>Payloads are modules that are executed on the target system after a successful exploitation. Payloads can be used to perform a variety of tasks, such as gathering information, installing malware, or gaining persistence on the system.<\/p>\n\n\n\n<p><strong>Loading a Payload<\/strong><\/p>\n\n\n\n<p>To load a payload, use the <code>use<\/code> command followed by the name of the payload module. For example, to load the <code>linux\/x86\/meterpreter\/reverse_tcp<\/code> payload, you would type the following command:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">  <span class=\"hljs-keyword\">use<\/span> <span class=\"hljs-title\">linux<\/span>\/<span class=\"hljs-title\">x86<\/span>\/<span class=\"hljs-title\">meterpreter<\/span>\/<span class=\"hljs-title\">reverse_tcp<\/span>\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><strong>Setting Payload Options<\/strong><\/p>\n\n\n\n<p>Once you have loaded a payload, you can use the <code>show options<\/code> command to view a list of all available options. You can then use the <code>set<\/code> command to set the values of these options.<\/p>\n\n\n\n<p>For example, the <code>linux\/x86\/meterpreter\/reverse_tcp<\/code> payload has an option called <code>LHOST<\/code> which specifies the IP address of the system that Metasploit should listen on for incoming connections. To set the value of this option to <code>192.168.1.100<\/code>, you would type the following command:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\">  <span class=\"hljs-selector-tag\">set<\/span> <span class=\"hljs-selector-tag\">LHOST<\/span> 192<span class=\"hljs-selector-class\">.168<\/span><span class=\"hljs-selector-class\">.1<\/span><span class=\"hljs-selector-class\">.100<\/span>\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><strong>Setting the Payload for an Exploit<\/strong><\/p>\n\n\n\n<p>Once you have loaded a payload, you can set it as the payload for the exploit you are using. To do this, use the <code>set payload<\/code> command followed by the name of the payload module. For example, to set the <code>linux\/x86\/meterpreter\/reverse_tcp<\/code> payload for the <code>exploit\/unix\/webapps\/tomcat_jsp_include<\/code> exploit, you would type the following command:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">  <span class=\"hljs-keyword\">set<\/span> payload linux\/x86\/meterpreter\/reverse_tcp\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><strong>Running an Exploit with a Payload<\/strong><\/p>\n\n\n\n<p>Once you have loaded an exploit, set its payload, and set all of the necessary options, you can run the exploit by typing the following command:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">  run\n<\/code><\/span><\/pre>","protected":false},"excerpt":{"rendered":"<p>What is Metasploit? Metasploit is a widely used penetration testing framework and tool that provides security professionals and ethical hackers with a comprehensive platform for testing and verifying the security of computer systems, networks, and applications. It offers a wide range of features and capabilities for conducting security assessments, including vulnerability scanning, exploitation, and post-exploitation&#8230;<\/p>\n","protected":false},"author":25,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_joinchat":[],"footnotes":""},"categories":[2],"tags":[],"class_list":["post-39883","post","type-post","status-publish","format-standard","hentry","category-uncategorised"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/39883","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/25"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=39883"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/39883\/revisions"}],"predecessor-version":[{"id":39936,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/39883\/revisions\/39936"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=39883"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=39883"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=39883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}