Kioptrix 1.2 (Level 3) Walkthrough
Introduction
Today we're doing another pentest walkthrough in the Kioptrix series. Kioptrix 1.2 (Level 3) was created by the Kioptrix team, and is hosted at https://www.vulnhub.com/entry/kioptrix-level-12-3,24/ .
For this pentest walkthrough we will be using two virtual machines, a Kali Linux machine as the attacking system, and the Kioptrix 1.2 machine as the target machine.
Locating the Target
After booting up both virtual machines, we run netdiscover from our attacking system to find out where the target system is on the network.
It looks like our target is at 10.0.2.16.
Additional Configuration
The documentation for Kioptrix 1.2 instructs us to edit our attacking system's hosts file after we identify the address of the target system.
On Linux, we'll use gedit to edit the file, which is located at /etc/hosts/ on our Kali machine.
We simply insert the IP address and kioptrix3.com. Now where we browse "kioptrix3.com" in our web browser, we'll go directly to the page served by the Kioptrix machine.
Scanning and Enumeration
We'll start our scans with a quick nmap scan of both TCP and UDP ports to see what ports are open.
Looks like just a couple of open ports on this target. Let's plug these two ports into nmap again for a more in-depth scan.
Not getting a lot from the scans so far. We also run a Nikto scan, but it doesn't give us usable info. Finally, we take a look at the Kioptrix webpage in our browser. Specifically, it's hosting a blog which points to a potential user on the system.
We know that SSH is available on the system, and we have a username, so we can brute-force loneferret's SSH login with Hydra like so:
Armed with these credentials, we can log into the system using SSH.
Privilege Escalation
After a bit of investigation, we find that we are not able to download, create, or modify any files on the system, because Kioptrix is a read-only system. However, looking through loneferret's home directory, we see two files, including CompanyPolicy.README, which reads:
HT (among other things) can be used as a text editor, and loneferret can run HT with sudo access, meaning that we can potentially use sudo ht to open any file on the system. For instance, we could edit the etc/sudoers file to give our user loneferret root access on the system.
However, we encounter a problem. Even though loneferret is supposed to have sudo access when using the HT command, we encountered a Segmentation Fault when we tried to save anything in the program, so we had to get creative to gain access to the flag on the system.
Specifically, we browsed the filesystem while in the Open File dialogue inside HT, so we were able to navigate to the /root/ directory and see the flag there, which we opened to get the "win".
This was a bit of a cheeky win, but alternatively, we could have used HT to open the /etc/shadow file, extracted the hash, cracked it offline, and logged in as root, but that would have taken a lot more time.
Finish
Comments
Post a Comment