Bashed
Executive summary — Bashed is an Easy Linux box with an instructive double-pivot chain: a forgotten web shell (phpbash) in
/dev/gives execution aswww-data; from there,sudolets us act asscriptmanager, who owns a/scriptsdirectory whosetest.pyis run by root via cron. The first attempt to overwrite that script fails for a very instructive reason about how shell redirection works undersudo; the fix istee. A web shell → www-data → scriptmanager → root cron → root path.
| Platform | Hack The Box |
| Operating system | Linux |
| Difficulty | Easy |
| Status | Retired |
| Target IP | 10.129.15.157 |
Attack map
[80] gobuster → /dev/ (forgotten phpbash web shell)
▼
[RCE] www-data
│ direct reverse shell (nc) → fails: the web shell gives no real TTY
│ sudo -l → (scriptmanager) NOPASSWD: ALL
▼
[scriptmanager] owns /scripts/ (test.py editable; test.txt is owned by root)
│ ROOT cron runs /scripts/test.py periodically
│ echo ... > test.py fails (the redirection is handled by www-data, not scriptmanager)
│ echo ... | tee test.py DOES write the file as scriptmanager
▼
[ROOT] tee overwrites test.py with a reverse shell → the cron runs it as root
1. Reconnaissance
As with practically any HTB box, the first step is a network scan to see what services are exposed.
nmap -Pn -n -sC -sV -T4 10.129.15.157
80/tcp open http
A single open port: the entire attack surface sits in the web application, so reconnaissance moves straight to HTTP.
Resumen ejecutivo — Bashed es un Linux Easy con una cadena muy didáctica de doble pivote: una web shell (phpbash) olvidada en
/dev/da ejecución comowww-data; desde ahí,sudopermite actuar comoscriptmanager, que es dueño de un directorio/scriptscuyotest.pyejecuta root por cron. El primer intento de sobrescribir ese script falla por un detalle muy instructivo sobre cómo funciona la redirección de shell bajosudo; la solución pasa portee. Recorrido web shell → www-data → scriptmanager → cron root → root.
| Plataforma | Hack The Box |
| Sistema operativo | Linux |
| Dificultad | Easy |
| Estado | Retired |
| IP objetivo | 10.129.15.157 |
Mapa del ataque
[80] gobuster → /dev/ (phpbash: web shell olvidada)
▼
[RCE] www-data
│ reverse shell directa (nc) → falla: la web shell no da un TTY real
│ sudo -l → (scriptmanager) NOPASSWD: ALL
▼
[scriptmanager] dueño de /scripts/ (test.py editable; test.txt es de root)
│ cron de ROOT ejecuta /scripts/test.py periódicamente
│ echo ... > test.py falla (la redirección la procesa www-data, no scriptmanager)
│ echo ... | tee test.py SÍ escribe el fichero como scriptmanager
▼
[ROOT] tee sobrescribe test.py con una reverse shell → el cron la ejecuta como root
1. Reconocimiento
Como en cualquier máquina de HTB, el primer paso es un escaneo de red para ver qué servicios están expuestos.
nmap -Pn -n -sC -sV -T4 10.129.15.157
80/tcp open http
Un único puerto abierto: toda la superficie de ataque está en la aplicación web, así que el reconocimiento se traslada directamente a HTTP.
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.