Retired machine. Flags redacted - solve it yourself.
Summary
A Flask app for a cruise company saves bookings by filename, which allows directory traversal to read arbitrary files (user flag). A Gitea instance leaks config, and a cron job running ImageMagick is abused via CVE-2024-41817 (library loaded from the working directory) for root.
Enumeration
nmap -p- --min-rate 10000 10.10.11.55
nmap -p 22,80 -sCV 10.10.11.55
- 22/tcp SSH (OpenSSH 8.9p1), 80/tcp HTTP (Apache 2.4.52, Ubuntu 22.04). HTTP redirects to
titanic.htb.
Subdomain fuzzing:
ffuf -u http://10.10.11.55 -H "Host: FUZZ.titanic.htb" -w subdomains.txt -ac
Found dev.titanic.htb → add both to /etc/hosts.
Web Enumeration
titanic.htb: static booking site./booktakes POST and saves submissions to a JSON file under a fixedticketsdirectory.dev.titanic.htb: Gitea with public repos:docker-config→ Docker volumes and MySQL credentialsflask-app→ confirms/bookbuilds paths withos.path.join→ traversal
Foothold (user)
/book saves submissions to a GUID filename. Manipulating the filename passed to /download allows directory traversal to read arbitrary files:
read /home/developer/user.txt # user flag
Privilege Escalation
- Gitea/Docker enum:
docker-compose.ymlexposes MySQL creds and shared volume paths; thedeveloperuser can write to theimagesfolder. - ImageMagick RCE (CVE-2024-41817): ImageMagick loads libraries from the current working directory. Drop a malicious
libxcb.so.1in the images folder:
# malicious libxcb.so.1 runs when ImageMagick processes an image
# a cron job invokes ImageMagick -> payload runs as root
bash -p
id
cat /root/root.txt
Lessons Learned
- Directory traversal can appear even in Flask if input isn’t sanitized before
os.path.join. - Public Git repos (Gitea) frequently leak secrets and config.
- Library-loading bugs in tools like ImageMagick become privesc when a cron/SetUID process calls them.