Hi Ya'll. This is going to be a quick walkthrough of the Cap Box. This box is rated as easy.
Let's Get into it!
# Recon #
Let's start off by kicking off a quick nmap. By looking at the results below we can see that our target has 3 ports open. _____________________________________________________________________________________
## PORTS ##
21/tcp open ftp vsftpd 3.0.3
22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.2 (Ubuntu Linux; protocol 2.0)
80/tcp open http gunicorn
_____________________________________________________________________________________
## Content Discovery ##
Let's start by running dirsearch to see what we can find on this port.
As you can see in the picture above. we found the path /data/2. This allows us to download a pcap file. This allows us to analyse the traffic and look for information we can use to further attack this box.
Looking at all of the pcap files available on this application, we come across the /data/0. As you can see in the picture below this has a lot less packets to inspect. So let's download this one and look at the traffic.
When in Wireshark, apply a filter on FTP packets. You will find the following:
CREDS!!!
User : nathan
Pass : Buck3tH4TF0RM3!
Using these creds we can gain access to the ftp service of this box. Let's see what we can find.
It seems the nathan user is serving his home directory!? And as it turns out, nathan is reusing his password! We can use the same credentials to ssh into the box!
## Privilege Escalation ##
Now that we have a foothold onto the machine let's try and escalate our privileges to root!
in order to do this we first have to enumerate the box. But you are here to save time so let me help you!
I searched for the sudo permissions, SUID binaries and capabilities that I could use to escalate our privileges. Fortunately, this box has the python3.8 binary with the cap_setuid set!
A quick search on gtfobins led me to the root shell. You can read about it -->
Here
Simply run:
python3.8 -c 'import os; os.setuid(0); os.system("/bin/bash")'
Voila! we are root!
There you go peeps! I hope you enjoyed this quick walkthrough of this box. And as always, hopefully this was useful and you learned something new! See you in the next one!
Cheers,
Comments
Post a Comment