πŸ₯’Pickle Rick

A Rick and Morty CTF. Help turn Rick back into a human!

This Rick and Morty themed challenge requires you to exploit a webserver to find 3 ingredients that will help Rick make his potion to transform himself back into a human from a pickle.

1. Reconnaissance

1.1 Nmap

  • Using nmap to find open ports and services. nmap -sC -sV -oN {outputfile} {IP}

We find ports 22 (ssh) and port 80 (http) open

1.2 Gobuster

Using gobuster to brue-force web directories gobuster dir -u http://{ip} -w {wordlist} -o {outputfile} -x php,txt,html,css,js

1.3 Website

Upon navigating to the website,

  • Inspecting source code we see,

Directories

Checking out the directories we got from Gobuster

/assets

  • fail.gif

  • picklerick.gif

  • portal.jpg

  • rickandmorty.jpeg

Nothing hidden in the images

/robots.txt

Wubbalubbadubdub

2. Gaining Access

2.1 /login.php

Using the username we got previously and hoping that the random gibberish from robots.txt might be the password,

Username:R1ckRul3s Password: Wubbalubbadubdub

..and,we're in

2.2 /portal.php (redirected to, after login)

We see a command panel right after login.Convenient huh?

  • Inspecting source code, we see

Vm1wR1UxTnRWa2RUV0d4VFlrZFNjRlV3V2t0alJsWnlWbXQwVkUxV1duaFZNakExVkcxS1NHVkliRmhoTVhCb1ZsWmFWMVpWTVVWaGVqQT0== which is a RABBIT HOLE (literally!!, keep on base64 decoding and you'll get the text "RABBIT HOLE")`

Upon further inspection, we are denied permission to all the other pages. Something about the real rick

  • Running ls on command panel

  • cat cannot run since it is disable(well, there goes our convenience)

WORKAROUND (thank you ,JOHN HAMMOND): using grep . (to grep for everything in a specific file) we find :

  • Sup3rS3cretPickl3Ingred.txt

1st ingredient: xx. xxxxxxx xxxx

  • Clue.txt : Look around the file system for the other ingredient

2.3 Reverse Shell

We can try a reverse shell to get a more stable connection since navigating the file system through the given command panel can be cumbersome.

  • netcat reverse shell not working.

  • Python3 found(which python3)

    • python reverse shell from pentest monkey with netcat listening on the attacker's machine and running this command in the command panel

Stabilizing the reverse-shell using python3 pty(not required for now,but is a cool trick)

  • Second ingredient can be found in /home/rick/second ingredients

    2nd ingredient: x xxxxx xxxx

3 Privilege Escalation

  • Running sudo -l, we find that www-data can run as root without password. So sudo bash gives root access - We find 3rd ingredient.txt in /root/3rd.txt

    3rd ingredient: xxxxx xxxxx

Last updated