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

Bashed

9 Dec 2017 · 11 min read · root access
Bashed - maquina de Hack The Box

Executive summary — Bashed is an Easy Linux box with an instructive double-pivot chain: a forgotten web shell (phpbash) in /dev/ gives execution as www-data; from there, sudo lets us act as scriptmanager, who owns a /scripts directory whose test.py is run by root via cron. The first attempt to overwrite that script fails for a very instructive reason about how shell redirection works under sudo; the fix is tee. A web shell → www-data → scriptmanager → root cron → root path.

PlatformHack The Box
Operating systemLinux
DifficultyEasy
StatusRetired
Target IP10.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.

🔒 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.