Book Image

Kali Linux Cookbook - Second Edition

By : Corey P. Schultz, Bob Perciaccante
Book Image

Kali Linux Cookbook - Second Edition

By: Corey P. Schultz, Bob Perciaccante

Overview of this book

Kali Linux is a Linux distribution designed for penetration testing and security auditing. It is the successor to BackTrack, the world’s most popular penetration testing distribution. Kali Linux is the most widely used platform and toolkit for penetration testing. Security is currently the hottest field in technology with a projected need for millions of security professionals. This book focuses on enhancing your knowledge in Kali Linux for security by expanding your skills with toolkits and frameworks that can increase your value as a security professional. Kali Linux Cookbook, Second Edition starts by helping you install Kali Linux on different options available. You will also be able to understand the lab architecture and install a Windows host for use in the lab. Next, you will understand the concept of vulnerability analysis and look at the different types of exploits. The book will introduce you to the concept and psychology of Social Engineering and password cracking. You will then be able to use these skills to expand the scope of any breaches you create. Finally, the book will guide you in exploiting specific technologies and gaining access to other systems in the environment. By the end of this book, you will have gained the core knowledge and concepts of the penetration testing process.
Table of Contents (11 chapters)

Installing VirtualBox

To set the foundation for our lab, we will be using VirtualBox as a virtual hardware platform to host our images. This recipe will outline the steps necessary to do so. In the event that you wish to use an alternate virtualization platform, the same general principles will apply.

When it comes to learning a new set of skills or sharpening the ones you already have, the importance of a testing environment cannot be overstated. It is imperative that you have the means to test against systems in a known state so that you can validate the results of your tests.

One method of saving resources, both physical hardware and computing resources, is to utilize a virtual environment where your testing devices reside. One very popular example of a virtualization platform is Oracle's VirtualBox—a purpose build virtualization environment designed for use with x86 platforms that can host many virtual machines on one physical computer. This allows for the sharing of resources such as disk, RAM, CPU, and so on. Additionally, because VirtualBox supports importing and exporting virtual appliances, resources can be easily moved, shared, and so on.

Getting ready

To prepare for the use of VirtualBox for the remainder of this book, we will need to ensure that we have enough resources on our server to be able to run several of the virtual guests at the same time. The following chart highlights the amount of resources that each of our intended guest systems will require:

Name

Disk required

Memory required

CPU required

Chapters used

Kali Linux

80 GB

8 GB

2

1-10

Metasploitable

65 GB

4 GB

1

1,2,4-7,10

Ubuntu 16.4 LTS

15 GB

2 Gb

1

1,6,10

Windows XP SP3

10 GB

1 GB

1

1,2,4-7,10

Windows 7 - host 1

10 GB (thin)

2 GB

1

1-7

Windows 7 - host 2

10 GB (thin)

2 GB

1

1-7

Windows 2008 Server

25 GB (thin)

2 GB

1

1-7

OWASP-BWA

10 GB

1 GB

1

1,9

VulnOS

32 GB

1 GB

1

1,7

How to do it...

In this section, we will build out an environment that will allow you to perform security testing without the need for physical hardware:

  1. Ensure that you have the following resources free on your host machine to support the system combinations mentioned in preceding list. In totality, you will need the following in addition to the resources needed by VirtualBox itself:
    • 5 CPU
    • 1500+ GB free disk space
    • 16 GB free memory
  2. Download the appropriate version of VirtualBox for your lab environment from www.virtualbox.org.
It would also be good to familiarize yourself with the detailed options available from the VirtualBox manual, which can be found at https://www.virtualbox.org/manual/ch01.html.
  1. Once you have downloaded the installer, locate it, and start the installation. As the application begins the installation, you will see the following dialog boxes. As of the time of writing this book, the version available was 5.1.8. When you are greeted with the dialog box seen in the following figure, select Next:
Initial installation screen
  1. When given the option at the first Custom Setup screen, as seen in the following figure, leave the default options in place, and select Next:
First custom setup screen
  1. At the second Custom Setup screen, as seen in the following figure, review the options and determine which are appropriate to your preferences, and select Next:
Second custom setup screen
If you leave Register file associations, this will configure your system to use VirtualBox, to open virtual disk images automatically.
  1. After the basic configuration options have been decided, the setup will now begin to make changes to the host computer. One such step is the installation of the dedicated virtual network adapters that allow VirtualBox to provide different options in regard to how your systems use networking. During the installation of these drivers, you may experience a brief loss of connectivity; so when prompted, acknowledge this fact by selecting Yes.
  2. Once ready to kick off the installation, select Install from the next dialog box, and wait until the installation process is complete.
During the installation process, you will be prompted to allow the installation of device drivers. These drivers are predominantly used for the virtual network devices. You may choose to trust device drivers signed by Oracle in the future, or leave that option unchecked.
  1. Once the installation is complete, you will be given the option to finish, or finish and then start VirtualBox.
Depending on what other uses for this lab you may have in the future, this would be a good time to install the VirtualBox expansion set that includes support for the USB 2.0 and 3.0 USB controllers, host web camera, RDP services, and other features. It is recommended that you install these at this time before starting VirtualBox.
  1. Once you start VirtualBox, you will need to confirm the settings for network connectivity. You are going to want to find the Preferences item under the VirtualBox menu heading; now, select it. Then, select the network option along the top, and you will be presented with the following window:
VirtualBox preferences dialog - network
  1. By default, NatNetwork should already be created for you. However, if one is not displayed, click on the + button on the top right to add one.
In the next section, we will be creating networks that exist only on your PC. Although these networks will only be seen on your PC, we strongly recommend that you use subnets that do not coincide with any of the existing networks that you may have access to.
  1. Once added, review the setup of the network by clicking on the wrench icon, on the lower-right part, and you will be presented with the following dialog box. You can modify the IP subnet as needed. Ensure that Enable Network is selected, and click on OK to continue:
NatNetwork configuration dialog
  1. Create our test network. Select Host-only Networks. By default, no network is created, so click on the + icon in the upper right-hand corner to create the vboxnet0 network:
Host-only networks dialog box
  1. Ensure that the vboxnet0 interface is highlighted, and click on the wrench icon in the lower-right part of the screen. An IPv4 address will already be populated for you. If you are putting this into an existing lab network, or if this range is used in other places in your existing environment, feel free to designate a different network if necessary, as this will be your dirty network for testing purposes:
Host-only network adapter dialog
  1. Let's review and modify the DHCP Server section by selecting it. The defaults should be fine, but you can adjust them as you feel appropriate.
Do not use the whole range for DHCP, as you may want to statically assign IP Addresses to servers on your dirty network.
  1. Once these steps have been completed, your VirtualBox environment is ready for the next section.

How it works...

In this section, we will download and install the virtual compute environment, VirtualBox, to build the base of our test lab. We configured the basic network configurations and set up DHCP to help with dynamic host networking.