CTFroom: Bounty Hacker — Anonymous FTP, Hydra & Sudo Tar Wildcard Exploitation
Investigating an anonymous FTP server to extract task logs and password lists, executing an SSH dictionary attack with Hydra, and escalating privileges to root via an insecure tar wildcard checkpoint command in sudoers.
Challenge Overview
Bounty Hacker is a Cowboy Bebop-themed penetration testing room. It highlights credential exposure through unauthenticated FTP services, targeted SSH brute-forcing using custom wordlists, and abusing Unix utility wildcard parsing in sudo configurations.
Phase 1: Port Scanning & Anonymous FTP
Discovered services:
We connect to the FTP server anonymously:
Analyzing Recovered Artifacts:
We now have a verified username (lin) and a custom password dictionary (locks.txt).
Phase 2: Targeted SSH Password Spraying with Hydra
We execute a fast dictionary attack against the SSH service:
Result:
We authenticate via SSH:
User flag recovered:
Phase 3: Sudo Tar Wildcard Exploitation
We inspect our user's sudo capabilities:
Output:
User lin can run /bin/tar as root with no restrictions.
Understanding Tar Command Injection via Checkpoints:
GNU tar includes command-line options designed to execute shell scripts for progress reporting:
--checkpoint=1--checkpoint-action=exec=<COMMAND>When tar is invoked with wildcards (tar -cf backup.tar *) in a directory containing filenames crafted like command flags, tar parses those filenames as command-line arguments!
Alternatively, because we have direct execution rights over /bin/tar in sudoers, we can call checkpoint actions directly:
Execution:
We are root. We retrieve the root flag at /root/root.txt.
Defense Remediation
anonymous_enable=NO in /etc/vsftpd.conf.tar, zip, gzip, and find have built-in execution primitives documented on GTFOBins.