HTB - Facts Writeup
HTB Facts – Season 10 write-up (rephrased / restructured version)
Easy Linux box to open the season — classic web → LFI → SSH key → passphrase cracking → sudo misconfiguration.
1. Reconnaissance & Port Scan
Quick full-port scan:
1 | PORT STATE SERVICE |
Added facts.htb to /etc/hosts and ran version + default script scan on the three open ports.
Interesting findings already:
standard SSH
nginx serving a web application on port 80
MinIO-looking service on 54321 (but redirects to
http://facts.htb:9001— most likely unused / leftover)
2. Web application on port 80 – First look
The site presents itself as Camaleon CMS.
Registration → login → dashboard works without issues.
Directory brute-force looking for admin-like locations (focusing on 302 redirects):
1 | admin 302 |
Classic admin panel redirect pattern → most likely the real administration interface.
After logging in → version fingerprint reveals Camaleon CMS 2.9.1.
3. Vulnerability – CVE-2024-46987 (Path Traversal / LFI in private file download)
Affected endpoint:
1 | /admin/media/download_private_file?file=... |
The controller concatenates user input directly:
1 | file = cama_uploader.fetch_file("private/#{params[:file]}") |
No path sanitization → classic ../ traversal possible.
Because the application runs as a user that can read /home/* directories, we can reach user home folders.
4. LFI exploitation – Reading sensitive files
Goal: steal SSH private keys.
From /etc/passwd we saw two interesting users:
trivia
william
Trying to read .ssh/id_* and id_ed25519 worked for user trivia:
1 | GET /admin/media/download_private_file?file=../../../../../../home/trivia/.ssh/id_ed25519 |
→ private key returned in response body (ed25519 format)
5. SSH key usage – Passphrase protected
1 | chmod 600 trivia_ed25519 |
→ prompts for passphrase
Extract hash & crack:
1 | ssh2john trivia_ed25519 > hash |
→ passphrase = dragonballz
Successful login:
1 | trivia@facts:~$ id |
User flag was not in trivia’s home — it was in /home/william/user.txt
6. Privilege Escalation
Quick enumeration:
1 | sudo -l |
Facter (Puppet fact collection tool) executed as root via sudo — very dangerous when custom facts are allowed.
Modern facter still honours --custom-dir even when FACTERLIB is blocked by env_reset.
Exploit plan:
Create malicious custom fact
Tell facter to load facts from a directory we control
Execute code as root inside the fact
1 | mkdir -p /tmp/mfacts |
Result:
1 | -rwsr-sr-x 1 root root ... /bin/bash |
Privilege escalation:
1 | bash -p |
Summary – Attack chain recap
Camaleon CMS 2.9.1 on nginx (port 80)
Account registration → login
Path traversal in private file download (CVE-2024-46987)
Exfiltrate
/home/trivia/.ssh/id_ed25519Crack weak passphrase (
dragonballz)SSH as trivia → find user flag in
/home/williamsudo factermisconfiguration → custom fact → SUID bash → root
Security lessons (short version)
Never concatenate
params[:file]directly into a file pathFile.basename()or strong allow-list is mandatoryWeb-server user should never be able to read
/home/*/SSH keys without passphrase (or very weak one) = single point of failure
Avoid
NOPASSWD: /usr/bin/facter,/usr/bin/python*,/usr/bin/perl, etc.Prefer very narrow sudo rules or dedicated non-interactive mechanisms
Good luck to everyone playing Season 10!See you on the next box. ッ




