Imagery HTB Writeup | HacktheBox | Season 9
Linux · Medium
2025-09-27 06:01:22 - xone
High level attack flow
- Recon — port 8000: web app (image gallery) and SSH open.
- Register a regular account, use bug report / XSS to steal an admin session cookie → access admin panel.
- Admin log endpoint has LFI (directory traversal) — retrieve db.json and other app files.
- Analyse api_edit.py (image transform handler) — crop operation uses shell=True and concatenates parameters → command injection possible.
- Use a privileged account (test user) to upload an image and trigger the crop transform with a command injection payload → reverse shell.
- On the box: read /var/backup/web_20250806_120723.zip.aes (world-readable) and exfiltrate.
- Crack / decrypt the AES-Crypt .aes backup offline with a wordlist (rockyou) using pyAesCrypt wrapper → recover archive → inspect db.json to find other credentials/hashes.
- Use an obtained user credential to SSH/switch to the user account and read user.txt.
- Privilege escalation: the user can run /usr/local/bin/charcol via sudo — use charcol -R or the interactive charcol shell to reset/pass into a no-password shell, then schedule a recurring task (or set SUID on /usr/bin/bash) to get root → read root.txt.
Access is restricted by HackTheBox rules#
The solution to the problem can be published in the public domain after her retirement.
Look for a non-public solution to the problem in the telegram channel .