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

UpDown

3 Sep 2022 · 43 min read · root access
UpDown - maquina de Hack The Box

Executive summary — UpDown doesn't fall to a single vulnerability, but to the combination of four controls that, individually, almost work: an extension blacklist on file upload, an LFI that forces a .php suffix, a deletion of the uploaded file at the end of the request, and a disable_functions list that blocks the whole system/exec family. An exposed .git repository hands over the source code and a secret header that unlocks the dev vhost; the phar:// wrapper defeats both the extension blacklist and the include() restriction at once; and the site-checker loop itself turns the file deletion into a ~270-second window the attacker controls through the content of their own payload. disable_functions forgets proc_open, giving RCE as www-data. From there, a SUID binary that calls Python 2 — where input() is eval() — escalates to developer, and a sudo NOPASSWD over easy_install (which by design runs the setup.py of any package) closes the chain as root.

PlatformHack The Box
Operating systemLinux (Ubuntu 20.04 focal)
DifficultyMedium
StatusRetired
Target IP10.129.227.227

Attack map

[1] /dev/.git exposed ──────────────► source code + "Special-Dev: only4dev" header
                                              │
[2] vhost dev.siteisup.htb (403) ◄────────────┘  access granted with the header
                                              │
[3] upload (extension blacklist) + LFI (forced .php suffix)
        │                                     │
        └── phar:// resolves BOTH at once ────┤
                                              │
[4] @unlink after a 30 s/line curl loop ──► ~270 s window controlled by the attacker
                                              │
[5] disable_functions missing proc_open ──────► RCE as www-data
                                              │
[6] SUID siteisup -> /usr/bin/python 2.7 -> input() == eval() ──► developer  ✦ user.txt
                                              │
[7] sudo NOPASSWD easy_install -> setup.py as root ─────────────► root  ✦ root.txt

1. Reconnaissance

sudo nmap -p- --min-rate 3000 -T4 -Pn -oN nmap-allports.txt 10.129.227.227
sudo nmap -p22,80 -sCV -Pn -oN nmap-services.txt 10.129.227.227
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.5 (Ubuntu Linux; protocol 2.0)
80/tcp open  http    Apache httpd 2.4.41 ((Ubuntu))
|_http-title: Is my Website up ?

Minimal surface: SSH and HTTP. The OpenSSH 8.2p1 Ubuntu 4ubuntu0.5 banner pins the distro to Ubuntu 20.04 focal without any further testing, which already rules out the kernel privesc vectors typical of older boxes.

The web app is a website availability checker: a site field and a Debug mode checkbox. The footer leaks the real domain, siteisup.htb:

echo "10.129.227.227 siteisup.htb" | sudo tee -a /etc/hosts
🔒 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.