Titanic is an easy-difficulty machine from Hack The Box dealing initially with a Local File Inclusion concluded from some source code analysis to retrieve the gita app.ini file and later a database file with hashes to crack which will grant us system access. We’ll then abuse an arbitray code execution in ImageMagic CVE-2024–41817 by creating a shared library that’ll copy the root flag to our directory.
└─$ nmap -A -Pn 10.10.11.55 Starting Nmap 7.95 ( https://nmap.org ) at 2025-06-21 04:42 EDT Nmap scan report for 10.10.11.55 Host is up (0.64s latency). Not shown: 998 closed tcp ports (reset) PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.10 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 256 73:03:9c:76:eb:04:f1:fe:c9:e9:80:44:9c:7f:13:46 (ECDSA) |_ 256 d5:bd:1d:5e:9a:86:1c:eb:88:63:4d:5f:88:4b:7e:04 (ED25519) 80/tcp open http Apache httpd 2.4.52 |_http-title: Did not follow redirect to http://titanic.htb/ |_http-server-header: Apache/2.4.52 (Ubuntu) Device type: general purpose Running: Linux 5.X OS CPE: cpe:/o:linux:linux_kernel:5 OS details: Linux 5.0 - 5.14 Network Distance: 2 hops Service Info: Host: titanic.htb; OS: Linux; CPE: cpe:/o:linux:linux_kernel
TRACEROUTE (using port 1723/tcp) HOP RTT ADDRESS 1 651.04 ms 10.10.16.1 2 320.60 ms 10.10.11.55
OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 48.67 seconds
We can see we have our usual 22 ssh port alongside a web app deployed on port 80 that’s redirecting us to titanic.htb, so let’s go ahead and add that entry to our /etc/hosts file.
The dev subdomain is a Gitea instance that has a couple of repositories: Web Application
flask-app - Local File Inclusion
The flask-app seems like the main domain application: Web Application
We can confirm this too: Web Application
Looking at this source code, we can see that we can download our trip’s ticket by providing a ticket parameter in the url after the download endpoint. Which tells us this is vulnerable to LFI: LFI
Hash-mode was not specified with -m. Attempting to auto-detect hash mode. The following mode was auto-detected as the only one matching your input hash:
10900 | PBKDF2-HMAC-SHA256 | Generic KDF
NOTE: Auto-detect is best effort. The correct hash-mode is NOT guaranteed! Do NOT report auto-detect issues unless you are certain of the hashtype.
Minimum password length supported by kernel: 0 Maximum password length supported by kernel: 256
* Append -w 3 to the commandline. This can cause your screen to lag.
* Append -S to the commandline. This has a drastic speed impact but can be better for specific attacks. Typical scenarios are a small wordlist but a large ruleset.
* Update your backend API runtime / driver the right way: https://hashcat.net/faq/wrongdriver
* Create more work items to make use of your parallelization power: https://hashcat.net/faq/morework
┌──(kali㉿kali)-[~] └─$ ssh [email protected] The authenticity of host 'titanic.htb (10.10.11.55)' can't be established. ED25519 key fingerprint is SHA256:Ku8uHj9CN/ZIoay7zsSmUDopgYkPmN7ugINXU0b2GEQ. This key is not known by any other names. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added 'titanic.htb' (ED25519) to the list of known hosts. [email protected]'s password: Welcome to Ubuntu 22.04.5 LTS (GNU/Linux 5.15.0-131-generic x86_64)
ImageMagick is a free and open-source software suite, used for editing and manipulating digital images. The AppImage version ImageMagick might use an empty path when setting MAGICK_CONFIGURE_PATH and LD_LIBRARY_PATH environment variables while executing, which might lead to arbitrary code execution by loading malicious configuration files or shared libraries in the current working directory while executing ImageMagick. The vulnerability is fixed in 7.11-36.
We can use this simple PoC which creates a shared library that copies the flag file and changes its permissions:
We will head to /opt/app/static/assets/images/ since the script is going there, create our payload and just wait a bit for it to execute and we get our root flag: