In the previous three chapters, you got acquainted with the essential tools NMAP, OpenVAS, and Metasploit. You learned about each of the tools in detail as well as how they can be integrated with each other for better efficiency.
Now it’s time to put all that knowledge together and apply it in a practical scenario. In this chapter, you’ll apply the various techniques you’ve learned so far to exploit a vulnerable system and get access to it.
Creating a Virtual Lab
It may not always be possible to try your newly learned skills on live production systems. Hence, you can try your skills in your own virtual lab in a restricted manner.
Vulnhub ( https://www.vulnhub.com ) is a site that provides systems for download that are deliberately made vulnerable. You simply need to download a system image and boot it in VirtualBox or VMware.
You do not have any credentials to log in to the system, so you will have to use your pen testing skills to get inside.
Carrying Out Reconnaissance
Port 21 running ProFTPD 1.3.3c
Port 22 running OpenSSH 7.2p2
Port 80 running Apache httpd 2.4.18
Search and execute any exploit for ProFTPD 1.3.3c in Metasploit
Brute-force user credentials against SSH running on port 22
Explore whether any application is hosted on port 80
Exploiting the System
The output of the script tells you that there’s a folder on the web server named secret, which might have something interesting for you.
You can see a screen that implies it is some kind of blog based on WordPress. However, the web page appears to be broken and incomplete.
Next, add a new line: 192.168.25.132 vtcsec.
In the terminal, run the following: gedit /etc/hosts.
Guess the credentials; many times default credentials work.
Use a password-cracking tool like Hydra to crack the credentials.
Use the Metasploit auxiliary module auxiliary/scanner/http/wordpress_login_enum to launch a brute-force attack against the application credentials.
In this case, the application has the default credentials of admin/admin.
The exploit ran successfully by uploading the malicious plug-in into WordPress and finally giving you the required Meterpreter access.
During your initial NMAP scan, you discovered that your target was also running an FTP server on port 21. The FTP server version is ProFTPd 1.3.3. You can check whether Metasploit has any exploit for this FTP server version. Use the search command.
The exploit code runs successfully and gives you a shell on the target system.
Hence, you were successful in exploiting your target in two different ways, once through WordPress and another through the FTP server. Congratulations!