Try-hack-me
PICKLE-RICK : Walkthrough
Today I completed an other room on tryhackme with a Rick and Morty theme to it! Let's go and complete the room Pickle Rick from try Hack Me!
Scanning & Enumeration
A good rule of thumb is to start by scanning your machine for any open ports.
#nmap -T4 -sC -sV -A -p- <target IP>
Enumerating Services
Port 22- ssh
Here we are able to see that our SSH port is open. This port isn't too vulnerable unless we have found some credentials. So we will not mess with it.
Port 80- http
It's here where we find a webservice. Lets see if there is anything interesting.
This webpage comes up on port 80. There’s no useful data in here.
But what if we check the page source?
Checking out the source code of a page can reveal all sorts of things.
Most websites will have a robots.txt file that will tell a browser what is and isn't allowed to index. So lets see if there is one for this site.
Success! It seems that there is a robots.txt for this site and in that file is a very obvious reference to the show Rick and Morty! Lets try this and see if it our password.
<target IP>/robots.txt
Finding hidden directories
We are going to be using gobuster to try and locate any directories that may have been hidden from us.
#gobuster dir -u http://<target IP> -w /usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt -x php,sh,html
It looks like GoBuster was able to find a few directories for us.
Let's check out the login.php.
YES! We do have credentials through which we are able to login and were redirected to the command panel.
Now since this page is called the command panel, lets try and actually enter in some command and see what happens.
If we enter in the #ls command we can see that some results are being returned. It would reflect that we have also found our first ingredient as Sup3rS3cretPickl3Ingred.txt. Let's explore the file on url:
<IP>/ Sup3rS3cretPickl3Ingred.txt
Lets go back to our command portal and use the ls command again. We see that there is a file call clue.txt, on opening the particular file we got the message as "Look around the file system for the other ingredient."
So lets go to the command portal and use #ls /home.
This will list out everything in our home directory.. and also look there is a directory called rick. Lets keep digging and use #ls /home/rick and within the rick directory we have a file called second ingredients.
On trying to retrieve this file using cat command it reflected an error telling us that the command has been disabled.
As an alternative, after searching on google we found out about less command. Let's use this and see if we can retrieve our second ingredient.
# less '/home/rick/second ingredients'
And Mission accomplished, we got the second ingredient.
Now that we know the less command will work for us we just need to track down the third and final ingredient.
Lets see if we are able to use ls and get into the /root directory. It seems that we are not able to view anything in from the /root.. if we are able to use sudo to elevate our user privileges.
#sudo -l
#sudo ls /root
Now that we have found the location of the third ingredient we are going to use less command to receive the contents of it, but remember since we are in the root directory we will need to add sudo to the front of our command.
#sudo less /root/3rd.txt
Thank you very much for reading. I hope you find this blog useful.
!!!!Happy Hacking!!!!
Comments
Post a Comment