How To Setup Your Own Pentest Lab

Are you an aspiring penetration tester, or a wannabe hacker? You started from the basics, querying google with a few simple words: hacking, hacker, how to be a hacker…then you found a lot of stupid tutorials that taught you how to hack your neighbour’s wpa with a network adapter called alfa awus036h (but didn’t work, did it ?) and finally you ended up in some damn forum where people talk your head off about about malwares, botnets, exploits and bitcoins. You asked trivial questions, and the answers were not kind but after some time you really started to understand how the bigger picture looks. You didn’t give up, you found books, courses, a cool site called DeepDotWeb and at the end of the run, you were proud to say that you know how to be a hacker. But are you a hacker? No…not yet. You know things, you generally understand the framework but you need training. The most intensive kind of training and the only thing that you can do to improve your skills is hacking. Really. Do you want to end up in jail? No, of course, so it is far better to build your own pentest lab, so that you can hack without doing anything illegal (there’s so much time for that after…).

Your Options

You can install Metasploitable, of course. Metasploitable is a purposely vulnerable operating system looking as a terminal in your virtualbox (it does not have a graphical interface), created by the developers of the Metasploit framework. Nevertheless, this is not a tutorial about Metasploitable, so I will show you another way. We will download several operating system images, install them in our Virtual Box and connect them through a software called pfSense.

pfSense

pfSense is an open source firewall for enterprises, created to replace many commercial firewalls. From the pfSense’s site:

“The pfSense project is a free network firewall distribution, based on the FreeBSD operating system with a custom kernel and including third party free software packages for additional functionality. pfSense software, with the help of the package system, is able to provide the same functionality or more of common commercial firewalls, without any of the artificial limitations. It has successfully replaced every big name commercial firewall you can imagine in numerous installations around the world, including Check Point, Cisco PIX, Cisco ASA, Juniper, Sonicwall, Netgear, Watchguard, Astaro, and more.

pfSense software includes a web interface for the configuration of all included components. There is no need for any UNIX knowledge, no need to use the command line for anything, and no need to ever manually edit any rule sets. Users familiar with commercial firewalls catch on to the web interface quickly, though there can be a learning curve for users not familiar with commercial-grade firewalls.”

And here we have the most important feature: you have to enable two different network adapters, one bridged and one for internal networks in order to make your firewall work properly.

Now click on “ok” and then you can finally start your virtual machine with pfSense:

Click on “Accept these settings”:

And then press “Quick easy install”:

After pressing “Ok” on the easy install confirmation, the installation process will start. This will take a few time, depending on your hardware.

Select “standard kernel”:

Now pay attention, suddenly after having pressed “reboot”, click on the “device” menu on your virtual-box and eject the installation drive or the process of installation will restart from the beginning:

After this process, you will see the main menu of psSense. You will see that the names of the main two network interfaces you created are shown with the respective IPs at their side. You will notice that em0 is your wan interface, while em1 is usually the LAN one. If you want to change the IPs range of these two interfaces you can select the option number 2 and you’ll be asked to assign the IPs through DHCP or manually. You’ll also be asked to change from https to http but clearly it would be an execrable idea. Once you’re done with this procedure, you can access the web Configurator from your browser following the IP of your LAN interface. From this point you’ll be able to change every aspect of your firewall using an easy and intuitive graphical interface.

Installing the Operating Systems

Now that you have the software that allows you to connect your machines, you can start to download and install every kind of operating system. I strongly recommend setting up different OSs, with different features (e.g. open ports, services ecc) enabled so that you can recreate a more realistic network environment. The following is a list of many interesting download links you can follow to get a few useful OSs…Happy hacking !!!