Pickle Rick

Date: 18, May, 2021

Author: Dhilip Sanjay S


Click Herearrow-up-right to go to the TryHackMe room.

Nmap Enumeration

nmap -sC -sV -p- 10.10.241.9 -oN nmap.out
Starting Nmap 7.91 ( https://nmap.org ) at 2021-05-18 22:22 IST

Nmap scan report for 10.10.241.9
Host is up (0.17s latency).
Not shown: 65533 closed ports
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 7.2p2 Ubuntu 4ubuntu2.6 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   2048 b0:7b:e7:02:7d:b7:f0:c7:e9:c3:bc:b4:e8:dd:7f:f3 (RSA)
|   256 23:cb:f6:b0:5b:52:d5:97:96:09:66:40:81:b2:e8:c0 (ECDSA)
|_  256 36:5a:dc:a0:79:06:c2:3d:51:ab:0b:6a:bb:4d:ce:c5 (ED25519)
80/tcp open  http    Apache httpd 2.4.18 ((Ubuntu))
|_http-server-header: Apache/2.4.18 (Ubuntu)
|_http-title: Rick is sup4r cool
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 501.79 seconds

Gobuster Enumeration on port 80

Information leaked

Username

  • By viewing the source code on the index page, we find the username: R1ckRul3s

Robots.txt

  • The robots.txt file surprisingly didn't contain Disallow, instead it had:

Login.php

  • Visit http://10.10.241.9/login.php

  • Enter the username as R1ckRul3s.

  • For the password, try to enter the content of robots.txt: Wubbalubbadubdub

  • And voila! we are logged in!

Executing commands

  • The portal.php allowed us to run any bash command.

  • By running ls, the following result was obtained:

  • Encoded string in portal.php:

    • By repeated base64 decoding it, it turned out to be a rabbit hole.

  • But the files in this particular directory can be read without using the above two commands - by just visiting http://10.10.241.9/clue.txt

What is the first ingredient Rick needs?

  • Answer: mr. meeseek hair

  • Steps to Reproduce:

    • Commands to read Sup3rS3cretPickl3Ingred.txt file:


What is the second ingredient Rick needs?

  • Answer: 1 jerry tear

  • Steps to Reproduce:

  • As per the clue, I was searching for the other ingredient in the file system and the second ingredient was in the directory /home/rick.


Whats the final ingredient Rick needs?

  • Answer: fleeb juice

  • Steps to Reproduce:

    • By Running sudo -l, you can find the permission of user to run the commands as root user.

    • Apparently www-data had permission to run all the commands without password.

    • Locating the third ingredient:


Attempt 2 - getting reverse shell

  • After watching John's video, I realised that proper way of pwing a room/box is by using reverse shell. So, here we go again!

  • Using python reverse shell and listening on netcat:

  • Upgrading shell:

  • Gaining root acess and all the ingredients:

References

Last updated