UpDown
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
.phpsuffix, a deletion of the uploaded file at the end of the request, and adisable_functionslist that blocks the wholesystem/execfamily. An exposed.gitrepository hands over the source code and a secret header that unlocks the dev vhost; the phar:// wrapper defeats both the extension blacklist and theinclude()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_functionsforgetsproc_open, giving RCE aswww-data. From there, a SUID binary that calls Python 2 — whereinput()iseval()— escalates todeveloper, and asudo NOPASSWDovereasy_install(which by design runs thesetup.pyof any package) closes the chain as root.
| Platform | Hack The Box |
| Operating system | Linux (Ubuntu 20.04 focal) |
| Difficulty | Medium |
| Status | Retired |
| Target IP | 10.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
Resumen ejecutivo — UpDown no cae por una vulnerabilidad aislada, sino por la combinación de cuatro controles que, por separado, casi funcionan: una blacklist de extensiones en la subida de ficheros, un LFI que fuerza el sufijo
.php, un borrado del fichero subido al terminar la petición y undisable_functionsque bloquea toda la familiasystem/exec. Un repositorio.gitexpuesto entrega el código fuente y una cabecera secreta que abre el vhost de desarrollo; el wrapper phar:// anula a la vez la blacklist de extensiones y la restricción delinclude(); y el propio bucle de comprobación de sitios convierte el borrado del fichero en una ventana de ~270 segundos que el atacante controla con el contenido de su propio payload.disable_functionsolvidaproc_open, lo que da RCE comowww-data. De ahí, un binario SUID que invoca Python 2 —dondeinput()eseval()— escala adeveloper, y unsudo NOPASSWDsobreeasy_install(que ejecuta por diseño elsetup.pyde cualquier paquete) cierra la cadena en root.
| Plataforma | Hack The Box |
| Sistema operativo | Linux (Ubuntu 20.04 focal) |
| Dificultad | Medium |
| Estado | Retired |
| IP objetivo | 10.129.227.227 |
Mapa del ataque
[1] /dev/.git expuesto ─────────────► código fuente + cabecera "Special-Dev: only4dev"
│
[2] vhost dev.siteisup.htb (403) ◄────────────┘ acceso concedido con la cabecera
│
[3] subida (blacklist de extensiones) + LFI (sufijo .php forzado)
│ │
└── phar:// resuelve AMBOS a la vez ──┤
│
[4] @unlink tras bucle curl 30 s/línea ──► ventana de ~270 s controlada por el atacante
│
[5] disable_functions sin proc_open ──────────► RCE como www-data
│
[6] SUID siteisup -> /usr/bin/python 2.7 -> input() == eval() ──► developer ✦ user.txt
│
[7] sudo NOPASSWD easy_install -> setup.py como root ──────────► root ✦ root.txt
1. Reconocimiento
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 ?
Superficie mínima: SSH y HTTP. El banner OpenSSH 8.2p1 Ubuntu 4ubuntu0.5 fija la distribución en Ubuntu 20.04 focal sin necesidad de más pruebas, lo que ya descarta de entrada los vectores de kernel típicos de máquinas más antiguas.
La aplicación web es un comprobador de disponibilidad de sitios: un campo site y una casilla Debug mode. El pie de página filtra el dominio real, siteisup.htb:
echo "10.129.227.227 siteisup.htb" | sudo tee -a /etc/hosts
This content is Root Access only. Everything else on the site — the free tier, the whole public library — stays open.
See Root Access plansNo account? Create one free then upgrade from your console.
Este contenido es solo para Root Access. Todo lo demás del sitio — el nivel gratuito, toda la biblioteca pública — sigue abierto.
Ver planes de Root Access¿Sin cuenta? Crea una gratis y luego mejora desde tu consola.