Nmap
PORT STATE SERVICE VERSION
21/tcp open ftp vsftpd 3.0.3
22/tcp open ssh OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)
| ssh-hostkey:
| 2048 10:62:1f:f5:22:de:29:d4:24:96:a7:66:c3:64:b7:10 (RSA)
| 256 c9:15:ff:cd:f3:97:ec:39:13:16:48:38:c5:58:d7:5f (ECDSA)
|_ 256 90:7c:a3:44:73:b4:b4:4c:e3:9c:71:d1:87:ba:ca:7b (ED25519)
80/tcp open http Apache httpd 2.4.38 ((Debian))
|_http-title: Enter a title, displayed at the top of the window.
| http-methods:
|_ Supported Methods: GET POST OPTIONS HEAD
|_http-server-header: Apache/2.4.38 (Debian)
139/tcp closed netbios-ssn
445/tcp closed microsoft-ds
PORT STATE SERVICE
21/tcp open ftp
22/tcp open ssh
80/tcp open http
139/tcp closed netbios-ssn
445/tcp closed microsoft-ds
5437/tcp open pmip6-data
Enumeration
The site on port 80 is static, there is little to attack
FTP on 21 does not allow anonymous access, brute forcing did not work with nmap’s ftp-brute or hydra.
We can try brute forcing postgres on 5437.

We log in to postgres with the psql cli and poke around, but the databases are empty.
Using SELEC version(); give us a version of psql (18.4 (Debian 18.4-1), server 11.7 (Debian 11.7-0+deb10u1)).
Exploitation
Hunting for exploits. Found an RCE POC that our postgres instance should be vulnerable to.
Had to try different reverse shell payloads before one worked. The mkfifo reverse shell seems to be very reliable in my tests. The key here though was setting the lport to 21, as the common 4444 was blocked.


We find local.txt in user wilson’s home directory.
Privilege Escalation
Wasn’t able to get linpeas on the target, it would not connect to my python server.
Running our find command to hunt for SUID Binaries did produce an interesting result:

GTFOBins gives up the recipe:

Now we can read /etc/shadow and try to crack root’s password hash.

I tried cracking both root & wilson’s hashes but had no luck. I did find a way to get linpeas onto the box though by using port 21 once again, this time for my python3 http server.
I realized eventually that we don’t have to crack the hashes, we can use our SUID find binary to pop a root shell…


Done!