Post

Swsctfjournal3

Topic: Pickle Rick

This is a fun and short ctf challenge based on the Rick and Morty characters. It involves basic web exploitation and enumeration.

Penetration Testing Methodology

  • Network scanning (nmap scan)

  • Enumeration
    • enumerating http service
    • extracting username from source codetry
    • directory bruteforce using dirb
    • extracting password from robots.txt
    • logging into the web application
  • Exploitation
    • exploiting command module
    • invoking reverse shell
    • extracting first and second ingredients
    • enumerating rick’s file
  • privelege excalation

Walkthrough

Run a TCP nmap scan

alt text

The scan reveals that the target machine has 2 open ports: 22 and 80.

Enumerating the http service

I inspected the source code of the web page and found a username: R1ckRul3s

alt text

Now i need to find hidden files or directories using gobuster

alt text

I found a hidden directory: /login.php. It takes us to a login page.

alt text

When i tried the /robots.txt path, i found a password: Wubbalubbadubdub

So i login with the credentials and found a command panel that allows me to execute commands.

alt text

We probably need to try and get a reverse shell. I tried to run a python reverse shell command but it didn’t work. So i tried to use the command module to get a reverse shell.

Also try to find the first and second ingredients.

alt text

When i tried to run a series of commands, like ls -la, i found a file named Sup3rS3cretPickl3Ingred.txt. I read the file and found the first ingredient.

alt text

Tried to get source php code to get all blacklisted commands by putting grep -R

alt text

source code alt text

ls seems to not be blacklisted. Check for sudo privileges using sudo -l

alt text

I can run any command as sudo. So i ran sudo ls ../../../ to find the second ingredient.

alt text

Two flags found.

/home/rick/second ingredients: 1 jerry tear /root/third ingredients: fleeb juice

alt text

alt text

I got all the ingredients.

This post is licensed under CC BY 4.0 by the author.

Trending Tags