Hack Like a Pro: Metasploit for the Aspiring Hacker, Part 9 (How to Install New Modules) « Null Byte :: WonderHowTo

Welcome back, my tenderfoot hackers!One of the issues we often encounter withMetasploitis how to add new modules. Although Rapid7 (Metasploit's owner and developer) periodically updates Metasploit with new exploits,payloads, and other modules, at times, new modules appear that are not added to the Metasploit repository.In addition, when we re-encode a module to obscure its malicious nature withmsfvenomorVeil-Evasion, we will often need to re-insert them into Metasploit for use by the framework.In this tutorial, we will look at how to insert a module into Metasploit. In this case, we will be inserting an exploit module that has never been included in the Metasploit Framework, but is available from multiple sources.Step 1: Fire Up Kali & Open MsfconsoleLet's begin, as usual, by firing upKali, opening a terminal, and starting the Metasploit console by typing:kali > msfconsoleStep 2: Search Joomla on Exploit-DBLet's go to one of my favorite places to find new exploits,Exploit Database(exploit-db.com).Click on the "Search" button in the upper right of the screen, then on "Advanced search." This will open a search window similar to the one shown below. There, type in "joomla" in the "Free Text Window" and "metasploit" in the "Author" window. (All exploits developed for Metasploit are categorized with metasploit as the author, no matter who wrote them.) This should pull up all Joomla exploits developed for use in the Metasploit Framework. Joomla is the popular, open-source web application CMS.As we can see, there are three. The first one, "Joomla Akeeba Kickstart," is the newest and may not be included yet in the Metasploit Framework.Step 3: Search Joomla in MsfconsoleLet's go back to our msfconsole and search to see whether that new Joomla exploit has been included. Type:msf > search type:exploit joomlaAs you can see, there are three exploits in Metasploit as well, but not the "Joomla Akeeba Kickstart" exploit we found in Exploit-DB.Step 4: Insert the New Exploit in MetasploitNow that we have established that this new Metasploit exploit is not in the updated Metasploit, the question becomes, how do we insert it into Metasploit so that we can use it?The first step is to make a copy of the exploit. In this case, I will simply make a copy and paste operation to save it to a text file on the Desktop of Kali.Go back to Exploit-DB and click on the "Joomla Akeeba Kickstart Unserialize Remote Code Execution" exploit. When you do so, it will open a screen like below that displays the entire exploit.Let's copy it and put it into a text editor such as Leafpad and save it to our Desktop. In my case, I used "joomla_kicktstart.rb" as the file name. What you name the exploit is not really important, but where you place it is.Step 5: Insert It into the Metasploit ModulesFirst, we need to open another terminal. To load this new module, we will need to create a directory in a format that Metasploit will understand and can read. We can use themkdircommand with the-pswitch (create subdirectories as well).kali >mkdir -p /root/.msf4/modules/exploits/unix/joomlaNote that the .msf4 is a hidden directory and will not appear when doing a directory listing unless you use the-aswitch, such asls -al.Now that we have created the directory, let's navigate to that directory with thecdcommand.kali > cd /root/.msf4/modules/exploits/unix/joomlaLastly, we need to move our new exploit to this directory. We can do that with themvcommand. Since our exploit is on our Desktop, we need to move it from there to our new directory where Metasploit can use it. We can move it by typing:kali > mv /root/Desktop/joomla_kickstart.rb /root/.msf4/modules/exploits/unix/joomlaStep 6: Test Whether You Can Use ItNow that we have moved our new exploit to Metasploit, let's test whether we can use it. We will need to restart Metasploit in order for it to load new exploit. When we have a new msf prompt, let's search for our new module by typing:msf > search type:exploit joomla_kickstartAs you can see, Metasploit found our new exploit and it is ready to use! Now, let's load it for use with theusecommand. Type;msf > use exploit/unix/joomla/joomla_kickstartOur new exploit loaded successfully and is ready to start using. Finally, let's stake a look to see whether the options fields loaded successfully by typing:msf > show optionsAs you can see in the screenshot above, Metasploit responded with the options we need to set to use this new module. We are ready to begin exploiting Joomla with our new module!We can use this same method to load a new payload, post exploitation, orauxiliary module(with the minor difference that the subdirectory would not be exploits, but rather payloads, etc.).Keep coming back, my tenderfoot hackers, as we continue expand our knowledge and capability of the world's most popular exploitation framework.Want to start making money as a white hat hacker?Jump-start your hacking career with our2020 Premium Ethical Hacking Certification Training Bundlefrom the newNull Byte Shopand get over 60 hours of training from cybersecurity professionals.Buy Now (90% off) >Other worthwhile deals to check out:97% off The Ultimate 2021 White Hat Hacker Certification Bundle99% off The 2021 All-in-One Data Scientist Mega Bundle98% off The 2021 Premium Learn To Code Certification Bundle62% off MindMaster Mind Mapping Software: Perpetual LicenseRelatedHack Like a Pro:How to Exploit and Gain Remote Access to PCs Running Windows XPHow to Hack Like a Pro:Getting Started with MetasploitHack Like a Pro:Metasploit for the Aspiring Hacker, Part 4 (Armitage)Hack Like a Pro:Metasploit for the Aspiring Hacker, Part 10 (Finding Deleted Webpages)Hack Like a Pro:Metasploit for the Aspiring Hacker, Part 1 (Primer & Overview)Hack Like a Pro:How to Use Hacking Team's Adobe Flash ExploitHack Like a Pro:Metasploit for the Aspiring Hacker, Part 8 (Setting Up a Fake SMB Server to Capture Domain Passwords)News:How to Study for the White Hat Hacker Associate Certification (CWA)Hack Like a Pro:Metasploit for the Aspiring Hacker, Part 13 (Web Delivery for Windows)Hack Like a Pro:Metasploit for the Aspiring Hacker, Part 14 (Creating Resource Script Files)Hack Like a Pro:Metasploit for the Aspiring Hacker, Part 2 (Keywords)Hack Like a Pro:Metasploit for the Aspiring Hacker, Part 7 (Autopwn)Hack Like a Pro:How to Hack Windows Vista, 7, & 8 with the New Media Center ExploitHack Like a Pro:Metasploit for the Aspiring Hacker, Part 11 (Post-Exploitation with Mimikatz)Hack Like a Pro:Hacking the Heartbleed VulnerabilityHack Like a Pro:Exploring Metasploit Auxiliary Modules (FTP Fuzzing)Hack Like a Pro:Exploring the Inner Architecture of MetasploitHack Like a Pro:Python Scripting for the Aspiring Hacker, Part 1Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 12 (Loadable Kernel Modules)Hack Like a Pro:How Windows Can Be a Hacking Platform, Pt. 1 (Exploit Pack)Hack Like a Pro:Metasploit for the Aspiring Hacker, Part 3 (Payloads)How to Hack Databases:Hunting for Microsoft's SQL ServerMac for Hackers:How to Install the Metasploit FrameworkHack Like a Pro:Reconnaissance with Recon-Ng, Part 1 (Getting Started)Hack Like a Pro:Metasploit for the Aspiring Hacker, Part 6 (Gaining Access to Tokens)Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 11 (Apache Web Servers)Hack Like a Pro:How to Remotely Install a Keylogger onto Your Girlfriend's ComputerHow To:The Essential Skills to Becoming a Master HackerHack Like a Pro:How to Hijack Software Updates to Install a Rootkit for Backdoor AccessHack Like a Pro:How to Hack the Shellshock VulnerabilityHow to Hack Databases:Cracking SQL Server Passwords & Owning the ServerHack Like a Pro:How to Hack Facebook (Same-Origin Policy)News:What to Expect from Null Byte in 2015Hacking Windows 10:How to Steal & Decrypt Passwords Stored in Chrome & Firefox RemotelyHack Like a Pro:Metasploit for the Aspiring Hacker, Part 5 (Msfvenom)Hack Like a Pro:Hacking Samba on Ubuntu and Installing the Meterpreter