Pickle Rick is an Easy Linux machine that demonstrates the complete penetration testing loop—enumeration, exploitation, and privilege escalation—on a single host. This Rick and Morty-themed CTF requires you to exploit a web server and find three ingredients to help Rick transform back into a human.
Path to root, at a glance:
Scan the target → discover ports 22 (SSH) and 80 (HTTP)
Enumerate web source → find username in HTML comments
Check robots.txt → discover password string
Login at /login.php with discovered credentials
Bypass command filters to read ingredients
Escalate privileges via sudo misconfiguration
Nmap
┌──(kali㉿kali)-[~/THM/PickleRick] └─$ nmap -sC -sV -p- -A -Pn 10.10.X.X -T5 -oN nmap_scan.txt -v Starting Nmap 7.99 ( https://nmap.org ) at 2020-08-20 18:00 -0400 Nmap scan report for 10.10.X.X Host is up (0.35s latency). Not shown: 65533 closed tcp ports (reset) PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 7.2p2 Ubuntu 4ubuntu2.6 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 2048 8b:7c:2a:1f:85:9c:2c:dc:90:e7:33:dd:64:2c:99:6a (RSA) | 256 9f:fe:5c:42:06:db:9f:47:7d:09:62:d9:7c:ac:d4:18 (ECDSA) |_ 256 68:de:68:f9:c8:e2:1d:91:0c:34:09:f9:12:a1:6e:a0 (ED25519) 80/tcp open http Apache httpd 2.4.18 ((Ubuntu)) | http-robots.txt: 1 disallowed entry |_/ |_http-title: Rick is sup4r cool |_http-server-header: Apache/2.4.18 (Ubuntu) Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 25.15 seconds
The scan reveals:
Port 22/tcp: SSH (OpenSSH 7.2p2 Ubuntu) - potential remote access
Port 80/tcp: HTTP (Apache 2.4.18) - primary attack surface
OS: Ubuntu Linux
The Application
Visiting the website reveals a Rick and Morty-themed page:
Rick tells Morty he needs to log on to Rick’s computer
The challenge is to find three ingredients hidden in text files
Web Enumeration
Source Code Analysis
Viewing the page source reveals a comment containing credentials:
<!-- Note to self, remember username! Username: R1ckRul3s -->
Found username: R1ckRul3s
robots.txt
Checking /robots.txt reveals:
Wubbalubbadubdub
This is a Rick & Morty catchphrase that looks suspiciously like a password.
but nothing interesting, so i ran nikto and found an Admin login page /login.php
Nikto
┌──(r3vpwnx㉿r3vpwnx)-[~] └─$ nikto -h 10.49.135.200 - Nikto v2.6.0 --------------------------------------------------------------------------- + Target IP: 10.49.135.200 + Target Hostname: 10.49.135.200 + Target Port: 80 + Platform: Unknown + Start Time: 2026-08-30 04:08:30 (GMT-4) --------------------------------------------------------------------------- + Server: Apache/2.4.41 (Ubuntu) + ERROR: Failed to check for updates: 403 + No CGI Directories found (use '-C all' to force check all possible dirs). CGI tests skipped. + [999984] /: Server may leak inodes via ETags, header found with file /, inode: 426, size: 5818ccf125686, mtime: gzip. See: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2003-1418 + [013587] /: Suggested security header missing: referrer-policy. See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy + [013587] /: Suggested security header missing: strict-transport-security. See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security + [013587] /: Suggested security header missing: content-security-policy. See: https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP + [013587] /: Suggested security header missing: permissions-policy. See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy + [013587] /: Suggested security header missing: x-content-type-options. See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options + [600050] Apache/2.4.41 appears to be outdated (current is at least 2.4.66). + [999990] OPTIONS: Allowed HTTP Methods: HEAD, GET, POST, OPTIONS . + [95] /login.php: Cookie PHPSESSID created without the httponly flag. See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies + [006333] /login.php: Admin login page/section found. + [007342] /: X-Frame-Options header is deprecated and was replaced with the Content-Security-Policy HTTP header with the frame-ancestors directive. See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-Frame-Options + [007352] /: The X-Content-Type-Options header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type. See: https://www.netsparker.com/web-vulnerability-scanner/vulnerabilities/missing-content-type-header/ + 8285 requests: 16 errors and 12 items reported on the remote host + End Time: 2026-08-30 04:26:11 (GMT-4) (1061 seconds) --------------------------------------------------------------------------- + 1 host(s) tested
Foothold: Command Injection
Navigate to /login.php and use the discovered credentials:
Username: R1ckRul3s
Password: Wubbalubbadubdub
Command Execution Portal
After login, we’re redirected to /portal.php with a command execution interface.
Testing commands:
Bypassing Command Filters
The application blocks cat, more, head, tail, nl etc. but less command and below bypass techniques worked for me:
# Alternative to cat: less Sup3rS3cretPickl3Ingred.txt