Hetemit
Gaining Access
Nmap scan:
$ nmap -p- --min-rate 4000 -Pn 192.168.201.117
Starting Nmap 7.93 ( https://nmap.org ) at 2023-07-08 15:27 +08
Warning: 192.168.201.117 giving up on port because retransmission cap hit (10).
Nmap scan report for 192.168.201.117
Host is up (0.18s latency).
Not shown: 65479 filtered tcp ports (no-response), 49 closed tcp ports (conn-refused)
PORT STATE SERVICE
21/tcp open ftp
22/tcp open ssh
80/tcp open http
139/tcp open netbios-ssn
445/tcp open microsoft-ds
18000/tcp open biimenu
50000/tcp open ibm-db2Lots of ports. FTP allows for anonymous access, but just hangs.
Web Enumeration -> Python Code Injection
Port 80 had the default Apache HTTP Server:

Ran a directory scan on this and didn't find much.
Port 50000 had a simple API running:

If we use the /generate option, it just returns us this:
I tried sending POST requests to this:

Not too sure what to do with that token. However, we notice that this is running a Python server. The /verify endpoint also accepts POST requests, but it always seems to fail:

Since this was running a Python based server, we can try some Python code injection.

This looks like it works. Another test confirms that it works:

So this script has the os module imported, meaning we can get an easy reverse shell:

Privilege Escalation
Misconfigured Services + Reboot
The user is able to reboot the system:
This indicates to me that there is some kind of startup script to exploit. I ran a linpeas.sh scan on the machine to enumerate, and it found quite a few misconfigured services:

We can overwrite this to execute a script that gives us a reverse shell. I included the SUID bit in my script just in case the shell doesn't work:
I also included my SSH key within the authorized_keys folder for backdoor access.
Afterwards, using vi we can edit the service file:
Then, we can run sudo /sbin/reboot to restart the machine. Then we just have to wait for a bit before we can SSH back in. The reverse shell didn't work for some reason, but the SUID binary command did:

Rooted!
Last updated