šš¦¶Enumeration/Foothold
Seal is an Medium Linux box from HTB and created by MrR3boot. This box features a web server with an exploitable Tomcat running jmxproxy
alongside nginx
which we use to access the Tomcat host manager and deploy a reverse shell. Once on the box we use ansible playbook alongside a symlink
to escalate.
I begin each box by running a RustScan. This is bundled into my setup.sh script which I’ve mentioned in a few of my other posts. RunningĀ RustScanĀ withĀ nmap
Ā filters. Reviewing the results I see multiple ports open:
Reviewing the results I seeĀ Port 80/443
Ā open. Navigating to theĀ HTTPS
Ā version of the site I am presented with a certificate error. Viewing the certificate provides the following information:

Shows the website seal.htb as well as a possible user.
Seeing this I addĀ seal.htb
Ā into my hosts file:

Seal Market Vegetables Shop
Navigating to the website shows a Seal Market vegetable shop. I see when clicking Search it adds anĀ ?+Vegetable=[input]#
Ā parameter. I note this down and kick off aĀ FeroxBusterĀ scan.
Next after reviewing myĀ nmap
Ā results I can see thatĀ Port 8080
Ā is open and shows a registration form:
I fill out the registration form and log into the website. After logging in I can see two repositories, one of which isĀ seal_market. Navigating to it shows a ToDo and two folders:

ToDo List for Seal Market App
So this tells us a lot as we can see that bothĀ nginx
Ā andĀ tomcat
Ā are running and that the manager/host-manager forĀ tomcat
Ā are still available. Seeing these two items and aĀ tomcat
Ā folder and check if any revisions exist. UsingĀ Ctrl+F
Ā to find in Firefox I search forĀ password=
Ā as that is the string you see forĀ tomcat
Ā based passwords.
Next I reviewed my FeroxBuster scan I kicked off earlier. It showed the manager directory unfortunately it was reporting 302
.
I used FeroxBuster again on the manager directory poking at it further with a tomcat discovery list by SecLists
Seeing that I was able to hit certain modules within Tomcat I began researchingĀ nginx + tomcat exploitĀ traversal and found a great presentation fromĀ Blackhat. I changed theĀ url
Ā and logged into the Host Manager.
I tried uploading a reverse shell but was unable to do so as a CSRF token prevented the upload.

Tomcat host manager screen and deployed reverse shell.
I went into Burp Suite and changed the request on the upload. Reviewing the request I can see theĀ POST
Ā request is going toĀ /manager/html/upload
Ā which will fail as we do not have direct access. Change this to include the traversal exploit above allows the shell to be uploaded:

Burp Suite changing the request for the jmxproxy.
You can see the shell successfully uploaded:

Reverse shell uploaded on the Tomcat host manager.
šEscalation
I spawn aĀ nc
Ā session and navigate over to the reverse shell page I then checkĀ /var/lib/python
Ā to validate Python3
is installed and upgrade my session:
I then navigate to theĀ temp
Ā directory and upload LinPEAS to the box.
ā Attack Machine
šÆ Victim Machine
Reviewing the LinPEAS output I was was able to find both entries above telling me to focus on theĀ run.yml
Ā file. Reviewing the file I can see that its doing a copy to move files from one directory to another. I can also see that theĀ copy_links=yes
Ā means symbolic links are allowed.
I check theĀ /admin/dashboard
Ā directory and notice anĀ uploads
Ā folder with read/write access. I do a symlink to pull theĀ .ssh
Ā directory from Luis’ home directory.
Once the backup is done being created (takes around a minute) I copy the file into my working directory underĀ tmp
I then navigated to the uploads directory and copied the id_rsa
to my attacking machine. Once on the attacking machine I set the permissions to 600 and logged into the box.
Upon entering the box viaĀ SSH
Ā I check what can be run asĀ SUDO
.
Just like the first escalation method we can useĀ ansible-playbook
Ā as root. I create a quickĀ escalate.yml
Ā based off theĀ run.yml
Ā file and upload it to the host.
ā Attack Machine
šÆ Victim Machine
I grab both flags and finalize the box: