root@thehacksparrow:~/writeups$ SYSTEM ONLINE
root@sparrow:~/writeups$ cat titanic.md
// writeups

Titanic

15 Feb 2025 · 12 min read · root access
Titanic - maquina de Hack The Box

Executive summary — Titanic chains a path traversal in the ticket-download endpoint of a Flask app, allowing arbitrary file read as www-data. That LFI is used to steal the SQLite database of an internal Gitea instance, crack a PBKDF2-HMAC-SHA256 hash, and reuse the recovered password to get SSH access. The final escalation abuses CVE-2024-41817 in ImageMagick: a root cron job runs magick from a directory writable by the user, which loads a malicious shared library planted there.

PlatformHack The Box
Operating systemLinux
DifficultyEasy
StatusRetired
Target IP10.129.231.221

Attack map

[80] titanic.htb — booking app (Flask/Werkzeug)
   │  /download?ticket= does not confine the path to the tickets directory
   ▼
[LFI]  arbitrary file read as www-data
   │  steals gitea.db (SQLite) from the dev.titanic.htb vhost
   ▼
[Gitea DB]  developer's PBKDF2-HMAC-SHA256 hash -> cracked (hashcat -m 10900)
   │  password reused as the SSH password
   ▼
[SSH]  developer  (user.txt)
   │  a root cron job runs every minute a script that cd's into a
   │  directory writable by developer before invoking magick
   │  CVE-2024-41817 — ImageMagick looks for libxcb.so.1 in the CWD
   ▼
[ROOT]  malicious libxcb.so.1 -> constructor executed as root  (root.txt)

1. Reconnaissance

The host doesn't respond to ICMP, and a quick top-100 scan came back all filtered — a typical artifact of a firewall dropping pings, not an actual absence of services. A full scan with -Pn (not relying on ping) clears up the real surface:

nmap -p- --min-rate 2000 -Pn -oN recon/nmap-allports.txt 10.129.231.221
nmap -sCV -p22,80 -Pn -oN recon/nmap-services.txt 10.129.231.221
22/tcp open  ssh     OpenSSH 8.9p1 Ubuntu 3ubuntu0.10 (Ubuntu 22.04)
80/tcp open  http    Apache 2.4.52
|_http-title: Did not follow redirect to http://titanic.htb/

Apache's redirect reveals the vhost titanic.htb. After adding it to /etc/hosts, response headers show Server: Werkzeug/3.0.3 Python/3.10.12 — the real app is Flask, with Apache sitting in front as a reverse proxy:

curl -s http://titanic.htb/ | grep -oiE '<title>[^<]*|action="[^"]*"'
<title>Titanic - Book Your Ship Trip
action="/book"

A ticket-booking form (/book) is all the visible functionality on the homepage.

🔒 Clearance required

This content is Root Access only. Everything else on the site — the free tier, the whole public library — stays open.

See Root Access plans

No account? Create one free then upgrade from your console.