Wednesday, November 23, 2011

Setting up your own Pentesting/Hacking Network using a single Machine



Hello friends. Sorry for the long delay in writing a new post. I was out for some days and had no internet connectivity. When I came back and checked my mail, I found more than 10 mails asking me how to test for hacking. Actually this problem is because of the fact that there are too many theoretical tutorials available on the internet but there are hardly any practical implimentations shown.

 So the big problem lies in testing your knowledge. Unless you don't have practical exposure to hacking, you cannot really understand the strength of it. So I decided to reveal the professionals secret of pentesting/hacking. The technique I will discuss here will be advantageous for those who have only single system and want to set up a testing network using it. In case you have multiple systems then you can easily test for your skills by making one system as target and other as attacker. But what to do when we have only a single system at our disposal. Need not to worry. Virtual machine is the ultimate solution. You can set up your own hacking network and apply your skills to gain practical exposure to hacking.
The only thing to look for is your systems hardware configuration. You should have minimum 2 GB RAM but it is highly recommended to use 3 GB RAM for a 32 bit operating system.
We will be using Oracle VirtualBox in this tutorial. You can download virtualbox from this link - VBox.
Once you have installed Vbox, the next step is to download the Extensions pack. You can get it from this link - VBox Extension pack.

Once you have followed this initial steps, you are half done. The next step is to setup a target operating system. Suppose you want to set WINDOWS XP SP2 as the target operating system. You will need a bootable Windows XP SP2 iso for that. You can easily download it from Microsoft website or torrent. You can refer to this quick tutorial on how to setup a virtual machine using VBox and WIN XP.


So now you have a virtual machine where you can test all your applications and hacks.
What is the next step that you can do with this virtual machine ?  Let us install a WAMP server and run DVWA over it. For those who are not aware of DVWA can check this link - Installing and working with DVWA.

How to install applications on a virtual machine? Well the process is simple. When your Windows XP Virtual machine is running, then click on the DEVICE tab, move to USB and select your pendrive from the list.

Now you can install anything from a USB drive inside your virtual machine. There is also a facility to create shared folder with your host operating system but I would prefer that you use USB. Shared folder has some issues when your host operating system is Windows 7. You can install different servers, applications, RAT clients etc and play with it.

Now what is the advantage of this virtual machine . Let us analyse:


  • You can test all the viruses and RATs without any fear as your base operating system will not be affected. 
  • You can test different servers and applications easily without affecting your base operating system. 
  • In case the Virtual machine gets corrupt then you can re-install it. 


There are also some key factors that you should remember which will help you during your pentesting:

Create a clone of the virtual machine
This step is very helpful in case your VM gets corrupt. Creating a clone of it will prevent you from re-installing it again and again.
You can create a clone by Right clicking on the Virtul machine instance in VBox and click on "clone.."
You will notice that a cloned virtual WinXP will be created for you.

Disable the windows Firewall

The next important thing you can do is disable the windows firewall and then perform your pentesting as the firewall may block some of the suspicious activities. Using the default Windows firewall of XP virtual machine you can also test weather your activity is traceable or not. This will give you a clear understanding why RATs are not considered as a suitable hack these days because they are easily detectable. You can disable the firewall by going to control pannel, clicking on Firewall and then disable it.
In this way you can set up a suitable environment for your home experiments.

WHAT NEXT ?

Well a good question to ask if you have understood the above concepts. So far we discussed how to test different tools and techniques on a virtual operating system. The next step will be how to hack one virtual machine using the other. The scenario will be similar to hacking any system on internet so this technique will give you a real time exposure. Intresting... Lets proceed then. This time we will set up another virtual machine using BACKTRACK operating system which is one of the most widely used penetration testing operting system by security professionals. The reason which makes backtrack so popular is:

  • It has all the relevant tools pre-installed
  • it is linux based.
You can download the Backtrack 5 iso from its official website. Its a must have operating system for all. 
You can follow this simple video to install BT on virtualbox. 



Once you are done with the installation part, the next step is to make the two virtual machines (BT and WinXP) connect with each other. There is a simple setting that you will have to make in both the virtual machines. Let's check it out. 
Select the Backtrack virtual machine, then click on settings tab, then move to "network" settings. You will find that "Adapter 1" is set to NAT adapter. Switch to the "Adapter 2" tab. 


In the Adapter2 tab, set the adapter as "Host-Only Adapter". Set the name of adapter as "VirtualBox Host Only Ethernet Adapter" . See the figure.




Make similar setting changes in your windows XP virtual machine as well. Now your two virtual machines are ready to connect with each other. You can check the IP address of Windows machine by using the ipconfig command in the command prompt and similarly you can check the IP address of the BT machine using the ifconfig command. Also you can ping the two machines to check if both are detecting each other (don't forget to disable the windows firewall else it will filter the ping data packets).
The following image shows my two virtual machines. One is WinXP and other is BT5 with there corresponding ip addresses. Both are running ovr my host operating system Win7. So in all there are 3 operating systems running simultaneously.


Now you can use various options available in Backtrack OS to perform tests on the WinXP box. Let us quickly perform a nmap scan to check the open ports on WinXP machine.


As you can see that the target is up and has some open ports as well. Similarly you can perform several attacks and use the tools available in Backtrack to penetrate the target windows XP machine without harming your own operating system.
You can use this technique to perform several tests like :

  • You can try to hack different operating systems by installing them as a virtual machine. 
  • This will have a real time simulation of original scenario.
  • You can increase the level of difficulty of your hacks by installing firewalls, IDS/IPS etc. 
  • This is a self customization scenario where you can do what ever you want. 

This is just a quick example for you all to get started with using VM's for pentesting and hacking. You can further take this tutorial to next level by experimenting with various flavors of operating systems and try your hands on them . This can be like a practice Battlefield for you before you dive deep into the real fight.

There are several small problems which you may encounter while performing these steps. So keep adding your queries so that I can help you resolve them. This is one of the most uniquest tutorial you will find on the internet. So keep adding your comments and queries so that you can enjoy this technique. Once you have successfully performed it, you will love playing with this scenario.


DARKLORD!!

12 comments:

  1. Good Work Abhinav,Guys, I will tell you a fact, to post this article it will take more than a day and its not a easy job to take out that time from your regular task.
    Appreciate you work.

    Hari

    ReplyDelete
  2. Thanks for the info Bro
    just wanted to make a point

    You can actually play with VM networking settings Like its better to only use Host only adapter for pen testing (without NAT ) WHICH WILL act as a firewall however u will not Have Internet connection ,U can also play with other setting like bridge mode for arp spoofing , Its really confusing for any body who is new to VM so it would be great if u can write An article on Various Networking settings in VM (especially for Hacking and pen testing ) Purposes >>>>>
    :)

    ReplyDelete
  3. @john : Thanks a ton for making those valid points.. Using VM network settings is confusing especially for new users. I will create a post on different VM Network settings..It will be an intresting post...Thanks for the advice :)

    ReplyDelete
  4. Its a great ....
    But wanna ask you one question that how to bypass hardware firewall???

    ReplyDelete
  5. Key work http://officekey.blogspot.com/

    ReplyDelete
  6. can you post the tutorial for vmware and all the tutorials in a single video? please!!!!

    ReplyDelete
  7. @salawurahman : bro I dont work on vmware. VBox is free and relatively easy to use.. Even if you are working with Vmware then there will be a slight change in adapter settings. Rest all remains the same...Let me knw if you face problem with Vmware..I will try to resolve it.

    ReplyDelete
  8. @abhinav
    thanx for the nice info
    its informative...!! :)

    @john(bro its me)
    It really helped me in sniffing.. I had problems with network settings. Now i am highly comfortable with it after your comment.. thank you. :)

    ReplyDelete
  9. Instead of endorsing piracy I think it'd be best to link to the FDCC link to download a free version of Windows XP: http://nvd.nist.gov/fdcc/download_fdcc.cfm

    ReplyDelete
  10. Nice article but check here for more..
    www.indiancyberalerts.com

    ReplyDelete
  11. Really Good Article ..Great Job...

    ReplyDelete