Book Image

Kali Linux Web Penetration Testing Cookbook

By : Gilberto Najera-Gutierrez
Book Image

Kali Linux Web Penetration Testing Cookbook

By: Gilberto Najera-Gutierrez

Overview of this book

Web applications are a huge point of attack for malicious hackers and a critical area for security professionals and penetration testers to lock down and secure. Kali Linux is a Linux-based penetration testing platform and operating system that provides a huge array of testing tools, many of which can be used specifically to execute web penetration testing. This book will teach you, in the form step-by-step recipes, how to detect a wide array of vulnerabilities, exploit them to analyze their consequences, and ultimately buffer attackable surfaces so applications are more secure, for you and your users. Starting from the setup of a testing laboratory, this book will give you the skills you need to cover every stage of a penetration test: from gathering information about the system and the application to identifying vulnerabilities through manual testing and the use of vulnerability scanners to both basic and advanced exploitation techniques that may lead to a full system compromise. Finally, we will put this into the context of OWASP and the top 10 web application vulnerabilities you are most likely to encounter, equipping you with the ability to combat them effectively. By the end of the book, you will have the required skills to identify, exploit, and prevent web application vulnerabilities.
Table of Contents (17 chapters)
Kali Linux Web Penetration Testing Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Configuring virtual machines for correct communication


To be able to communicate with our virtual server and client, we need to be in the same network segment; however, having virtual machines with known vulnerabilities in our local network may pose an important security risk. To avoid this risk, we will perform a special configuration in VirtualBox to allow us to communicate with both server and client virtual machines from our Kali Linux host without exposing them to the network.

Getting ready

Before we proceed, open VirtualBox and make sure that the vulnerable server and client virtual machines are turned off.

How to do it...

  1. In VirtualBox navigate to File | Preferences… | Network.

  2. Select the Host-only Networks tab.

  3. Click on the () button to add a new network.
  4. The new network (vboxnet0) will be created and its "details window" will pop up. If it doesn't, select the network and click on the () button to edit its properties.
  5. In this dialog box, you can specify the network configuration, if it doesn't interfere with your local network configuration, leave it as it is. You may change it and use some other address in the segments reserved for local networks (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16).

  6. After proper configuration is done, click OK.

  7. The next step is to configure the vulnerable virtual machine (vulnerable_vm). Select it and go to its settings.

  8. Click Network and, in the Attached to: drop-down menu, select Host-only Adapter.

  9. In Name, select vboxnet0.

  10. Click OK.

  11. Follow steps 7 to 10 in the client virtual machine (IE8 - Win7).

  12. After having both virtual machines configured, let's test if they can actually communicate. Start both the machines.

  13. Let's see the network configuration of our host system: open a terminal and type:

    ifconfig
    
  14. We can see that we have a network adapter called vboxnet0 and it has the IP address 192.168.56.1. Depending on the configuration you used, this may vary.

  15. Log into vulnerable_vm and check its IP address for adapter eth0:

    ifconfig
    
  16. Now, let's go to our client machine IE8 - Win7; open a command prompt and type:

    ipconfig
    
  17. Now, we have the IP addresses of our three machines:

    • 192.168.56.1 for the host

    • 192.168.56.102 for vulnerable_vm

    • 192.168.56.103 for IE8 - Win7

  18. To test the communication, we are going to ping both virtual machines from our host:

    ping -c 4 192.168.56.102
    ping -c 4 192.168.56.103
    

    Ping sends an ICMP request to the destination and waits for the reply; this is useful to test whether communication is possible between two nodes in the network.

  19. We do the same from both the virtual machines thus checking communication to the server and the other virtual machine.

  20. The IE8 - Win7 machine may not respond to pings; that's normal because Windows 7 is configured by default to not respond to ping requests. To check connectivity in this case, we can use arping from the Kali host:

    arping –c 4 192.168.56.103
    

How it works...

A host-only network is a virtual network that acts as a LAN but its reach is limited to the host that is running the virtual machines without exposing them to external systems. This kind of network also provides a virtual adapter for the host to communicate with the virtual machines as if they were in the same network segment.

With the configuration we just made, we will be able to communicate between a client and server and both of them can communicate with the Kali Linux host, which will act as the attacking machine.