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

Alert

23 Nov 2024 · 10 min read · root access
Alert - maquina de Hack The Box

Executive summary — Alert is an Easy Linux box with an elegant, very instructive web chain. A Markdown Viewer lets you upload .md files and share them; the viewer renders the Markdown without sanitising the resulting HTML, so a stored XSS fires when the administrator opens the link we send through the site's contact form. With that XSS we abuse an LFI in messages.php?file= to read the .htpasswd of a hidden vhost protected with basic auth (statistics.alert.htb, found by subdomain fuzzing); we crack albert's md5crypt hash with rockyou and SSH in. For the escalation, linpeas reveals that root runs a PHP development server on 127.0.0.1:8080 over /opt/website-monitor, whose config directory is group-writable by management (which albert belongs to): we drop a PHP reverse shell there, trigger it through an SSH tunnel, and land a shell as root. Path: vhost fuzzing → stored XSS → LFI → md5crypt → SSH → root's local PHP server with a writable config directory.

PlatformHack The Box
Operating systemLinux
DifficultyEasy
StatusRetired
Target IP10.129.231.188

Attack map

[80] Markdown Viewer → vhost fuzzing reveals statistics.alert.htb (basic auth)
   │  uploading a .md with <script> → stored XSS, fires when the admin opens the shared link
   ▼
[LFI]  messages.php?file=../../.. → exfiltrates the statistics vhost .htpasswd
   │  albert : $apr1$... (md5crypt) → cracked with rockyou → manchesterunited
   ▼
[SSH]  albert  (user.txt)
   │  root serves PHP on 127.0.0.1:8080 over /opt/website-monitor; config/ is group-writable (management)
   ▼
[ROOT]  reverse shell via shell.php in config/ + SSH -L tunnel → root.txt

1. Reconnaissance

Before touching anything, we map what's exposed. A full nmap scan avoids surprises later on (e.g. a third port that only shows up when scanning everything).

nmap -sC -sV -oN nmap.txt 10.129.231.188
22/tcp open  ssh     OpenSSH 8.2p1 Ubuntu
80/tcp open  http    Apache httpd 2.4.41 (Ubuntu)

Port 80 serves a Markdown Viewer: an app that lets you upload .md files, render them as HTML and share the result via a link.

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