3 minute read

  Difficulty   IP Address   Room Link  
  Easy   10.10.28.153   Pickle Rick  

Deploy the virtual machine on this task and explore the web application.

[ What is the first ingredient Rick needs? ]

First, let’s run a basic nmap scan (top 1000 ports) on the machine:

sudo nmap -sC -sV -vv 10.10.28.153

screenshot1

From the results of the scan, we see that 2 ports are open: 22 (SSH) and 80 (HTTP)

Let’s check out the HTTP webserver:

screenshot2

We are brought to a Rick and Morty themed page.

The first thing we can do is to run a gobuster directory scan to enumerate any hidden directories. We’ll also be checking for PHP files, which we can specify by using the -x option:

gobuster dir -u http://10.10.28.153/ -x php -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt

While Gobuster was working its magic, I went ahead and did some manual enumeration. I first looked at the source code of the site:

screenshot3

Interestingly enough, we find a username:

R1ckRul3s

Next, I took a look at the /robots.txt file on the webserver:

screenshot4

It had a strange phrase:

Wubbalubbadubdub

We’ll take note of this phrase for now.

Checking back on our Gobuster scan, we see that it has managed to find two interesting directories: /login.php and /portal.php:

screenshot5

Let’s check them out!

/login.php brings us to a login page:

screenshot6

/portal.php just redirects us back to /login.php. My first thought was to try and brute-force some login credentials using the username that we found earlier. However, before committing to that, I had a thought. What if the strange phrase that we found in the robots.txt file earlier was actually the password?

I tried logging in with

R1ckRul3s : Wubbalubbadubdub

and it worked! We are brought to a command panel:

screenshot12

Could we execute shell commands on the target machine through this panel?

Before testing this out, I tried to visit the other pages such as ‘Potions’ and ‘Creatures’. However it seems that we do not have the necessary permissions to access them:

screenshot13

Next, I wanted to check the source code of the page in case I missed anything important:

screenshot15

We get yet another strange phrase (in the green comment).

It seems that the phrase has been base64-encoded. After decoding it once, I realized that it has been base64-encoded multiple times in a row. Hence, after decoding and decoding, we find out that the phrase actually reads “rabbit hole”. What a rabbit hole indeed.

Alright, let’s try out that command panel. Running a simple whoami gives us:

screenshot14

Nice! This proves that we can indeed inject commands here. With that, let’s list out the current directory using ls:

screenshot16

There is a file that interests me: Sup3rS3cretPickl3Ingred.txt

I tried to cat it:

screenshot17

Hmmm no luck there. With that, let’s try to set up a reverse shell so that we can explore more freely within the target machine! We begin by checking whether Python is installed on the target (python3 -V):

screenshot18

Great, looks like Python3 is installed.

Next, we’ll be using pentestmonkey’s reverse shell cheatsheet to find a Python-based reverse shell command:

screenshot19

I set up a netcat listener on my local machine, ran the command above and successfully opened the reverse shell:

screenshot20

And we’re in!

We can then obtain the first ingredient in the home directory of the www-data user:

screenshot21


[ Whats the second ingredient Rick needs? ]

There is another interesting file in www-data’s home directory called clue.txt:

screenshot22

It tells us to look around the file system for the other ingredient. Doing just that, I navigated to the /home directory to see what other users were on the machine. Turns out there are 2 other users on the machine: rick and ubuntu:

screenshot24

In rick’s home directory, we find the second ingredient:

screenshot25


[ Whats the final ingredient Rick needs? ]

Before continuing on, let’s check out our sudo privileges:

screenshot23

It turns out that we actually have full sudo privileges! This means that we can basically run any program or command as root.

With that, escalating our privileges is as simple as opening a bash shell with sudo. This will land us in a privileged shell!

sudo bash

screenshot26

From there, we can obtain the last ingredient that is located in /root:

screenshot27