Nmap

PORT     STATE SERVICE VERSION
22/tcp   open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.9 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   3072 62:36:1a:5c:d3:e3:7b:e1:70:f8:a3:b3:1c:4c:24:38 (RSA)
|   256 ee:25:fc:23:66:05:c0:c1:ec:47:c6:bb:00:c7:4f:53 (ECDSA)
|_  256 83:5c:51:ac:32:e5:3a:21:7c:f6:c2:cd:93:68:58:d8 (ED25519)
8000/tcp open  http    ttyd 1.7.3-a2312cb (libwebsockets 3.2.0)
| http-methods: 
|_  Supported Methods: GET HEAD POST OPTIONS
|_http-title: ttyd - Terminal
|_http-server-header: ttyd/1.7.3-a2312cb (libwebsockets/3.2.0)
PORT      STATE SERVICE
22/tcp    open  ssh
8000/tcp  open  http-alt
65432/tcp open  unknown
PORT      STATE SERVICE VERSION
65432/tcp open  http    Uvicorn
|_http-title: Site doesn't have a title (text/plain; charset=utf-8).
|_http-server-header: uvicorn

Enumeration

There is a webshell on 8000, we can use it to get a reverse shell.

Privilege Escalation

I transferred and ran linPEAS

Checking “Processes, Crons, Timers, Services & Sockets”, we see an rpc.py file that runs as root.

Searching for rpc.py exploit, we find a POC. Just need to tweak the payload - in this case I’m going to add full sudo permissions to user in the sudoers file.

Set payload, run, and root.

Takeaways:

  • Check linpeas output for listening ports that nmap may have missed.
  • Check for anything in “Processes, Crons, Timers, Services & Sockets” section of linPEAS.
  • It is unlikely that I would have noticed the rpc.py file on a cursory pass.