Book Image

Advanced Penetration Testing for Highly-Secured Environments: The Ultimate Security Guide

By : Lee Allen
Book Image

Advanced Penetration Testing for Highly-Secured Environments: The Ultimate Security Guide

By: Lee Allen

Overview of this book

The internet security field has grown by leaps and bounds over the last decade. Everyday more people around the globe gain access to the internet and not all of them with good intentions. The need for penetration testers has grown now that the security industryhas had time to mature. Simply running a vulnerability scanner is a thing of the past and is no longer an effective method of determining a business's true security posture. Learn effective penetration testing skills so that you can effectively meet and manage the rapidly changing security needs of your company. Advanced Penetration Testing for Highly-Secured Environments will teach you how to efficiently and effectively ensure the security posture of environments that have been secured using IDS/IPS, firewalls, network segmentation, hardened system configurations and more. The stages of a penetration test are clearly defined and addressed using step-by-step instructions that you can follow on your own virtual lab.The book follows the standard penetration testing stages from start to finish with step-by-step examples. The book thoroughly covers penetration test expectations, proper scoping and planning, as well as enumeration and footprinting. You'll learn how to clean up and compile proof of concept, exploit code from the web, advanced web application testing techniques, client side attacks, post exploitation strategies, detection avoidance methods, generation of well defined reports and metrics, and setting up a penetration testing virtual lab that mimics a secured environment. The book closes by issuing a challenge to your skills and ability to perform a full penetration test against a fictional corporation; followed by a detailed walk through of the solution.Advanced Penetration Testing for Highly-Secured Environments is packed with detailed examples that reinforce enumeration, exploitation, post-exploitation, reporting skills and more.
Table of Contents (18 chapters)
Advanced Penetration Testing for Highly-Secured Environments: The Ultimate Security Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Planning for action


Once the time has come to start your testing, you will want to be prepared. This entails having an action plan available, all of your equipment and scripts up and running, and of course having some mechanism for recording all steps and actions taken. This will provide you with a reference for yourself and other team members. You may remember the steps you took to bypass that firewall now, but what about four months from now when you are facing the same challenge? Taking good notes is critical to a successful penetration test.

For the purpose of this book, we will review the installation of the BackTrack suite using VirtualBox, which is made available by Oracle under the GNU General Public License (GPL). This open source virtualization tool can be used to build your virtual testing environment on platforms such as Linux, OSX, and Windows.

Tip

I highly recommend the use of the BackTrack OS for your testing needs. If you are unfamiliar with BackTrack, PacktPub has recently released an excellent book on the subject titled BackTrack 4: Assuring Security by Penetration Testing. This book will go into detail on various installation methods of the BackTrack suite, and gives a full review of all of the tools you can find within. If you are still new to penetration testing, you will more than likely benefit from reviewing this book. As the focus of Advanced Penetration Testing of Highly Secured Environments is on advanced attack methods we will not cover all tools within the BackTrack suite.

You can also find more information about BackTrack at the BackTrack forum site located at: http://www.backtrack-linux.org/forums/backtrack-5-forums/. The developers of BackTrack are very professional and offer a great deal of time and effort to the security community.

Installing VirtualBox

At this point in time the Windows operating system is still the most common desktop operating system, thus I will be detailing the installation of VirtualBox using Windows 7. However, the installation is straightforward for all OS's, so you should not shy away from installing it on your favorite platform.

Note

Almost every tool we use throughout the book is Linux or FreeBSD based. Because many people use Windows as their primary desktop we will provide instructions on installing VirtualBox on Windows 7. Once you have it up and running, you will be able to follow along regardless of which operating system is used as the host machine for your virtual test environment.

  1. Go to http://www.virtualbox.org/.

  2. Click on the Downloads link on the left side of the page.

  3. Download the latest version of VirtualBox for Windows hosts x86/amd64.

  4. Begin the installation (you may need to begin the installation as administrator depending on your system configuration).

  5. Click on Next> at the initial setup window.

  6. Ensure that the installation location is where you would like the program to be installed and that all options to be installed are selected and click on Next>.

  7. Select the options you prefer in regards to desktop shortcuts and click on Next >.

  8. Click on Yes if you would like to proceed with the installation using the settings you selected on the previous screens.

  9. Click on Install to proceed with installation. This step may take some time depending on your system performance. You may be asked to install device software as well, at which point you will have to click on Install in the pop-up window.

    Tip

    This may occur more than once; in my case it popped up four times followed by a notification from my firewall asking for permission to add the additional network to my firewall settings.

  10. Click on Finish to be presented with the Oracle VirtualBox Manager.

You will now have VirtualBox up and running and can begin the first step of creating the virtual testing environment to be used for hands-on practice throughout the book!

Installing your BackTrack virtual machine

Note

We will be referring to the system and virtual network names used in these installation instructions when discussing attack and defense strategies.

There are two primary methods of installing BackTrack as a virtual machine. One is to use the LiveCD ISO to install BackTrack just as you would on a physical machine; the other is to download a pre-prepared virtual machine. This is the VMWare image option seen on the BackTrack-Linux.org download site.

We will be using the LiveCD for our BackTrack installation, as that allows us the flexibility to determine hard drive size and other settings. Another benefit of using the ISO is that you will know how to install BackTrack to physical machines in the future. If using whole disk installation, the install process will be very similar to the virtual machine installation.

BackTrack can be downloaded at http://www.backtrack-linux.org/. Be sure to choose the appropriate ISO version in regards to 32 or 64 bit architecture. If you do not have a 64-bit operating system running on what will be the host machine, you will not be able to run a 64-bit operating system on the guest instances either. If running a 64-bit operating system on the host, you may choose either 32 bit or 64 bit for your guest machine operating systems.

Note

The host machine is the primary operating system that you installed VirtualBox on. Virtualized operating system images installed with VirtualBox will be referred to as guest machines.

Preparing the virtual guest machine for BackTrack

  1. Once the BackTrack ISO is obtained it is time to begin.

  2. Start the Oracle VM VirtualBox Manager by selecting it from your Start menu.

  3. Click on the New icon in the top-left corner.

  4. At the Welcome to the New Virtual Machine Wizard screen click on the Next button.

  5. You will be prompted to enter the name of the guest machine. Enter BT5_R1_Tester1, select Linux as the Operating System, and Linux 2.6 (32 bit or 64 bit) as the Version, and then click on Next.

  6. On the Memory screen you will need to choose a Base Memory Size using the slider. If your system has more than 2 GB of RAM you should use at least 512 MB for this system. You can still follow the examples with a less RAM but you may experience some system lag. After choosing your RAM size click on Next.

  7. Virtual Hard Disk: Ensure that the Start-Up Disk checkbox is selected and the Create new hard disk radial button is also selected and click on Next.

  8. A new pop up will open in which VDI (VirtualBox Disk Image) should be selected. Click on Next.

  9. When asked to select the Virtual disk storage details choose Dynamically allocated and continue the installation by clicking on Next.

  10. Now it is time to select the Location where the virtual guest machines files will be stored. Select the folder icon to the right of the Location text entry field.

  11. Create and select a new folder named APT_VirtualLab in which we will be storing all guest machines dedicated to this lab. Ensure that the drive you have chosen has sufficient space to store several virtual machines.

  12. Size the virtual disk to be at least 10 GB. We will be using this machine extensively throughout the book and although technically possible, it is better to avoid having to resize the VDI. Click on Next to continue.

  13. Validate that the data on the Summary page is accurate and click on Create.

  14. If everything has been successful you are once again prompted with the VirtualBox Manager application window with your new guest machine.

  15. We will want to have two network adapters available to this machine. Select BT5_R1_Tester1 and then click on Settings followed by the Network option on the left menu bar.

  16. Click on the Adapter 2 and select the Enable Network Adapter checkbox.

  17. The Attached to: drop-down box will need to be set to Internal Network.

  18. Change the Name: textbox to Vlab_1 and click on OK.

Now you have completed the preparation required for installing an operating system on your virtual disk. This process does not vary considerably when preparing for other operating systems, and VirtualBox makes many of the configuration changes trivial. Sometimes you may want to tweak the settings on your guest machines to increase their performance. Playing around with some of the settings will give you an idea of the power of this tool.

Note

You can change the settings of the virtual machines at any time. However, sometimes you will be required to shut down the guest machine prior to making changes.

Installing BackTrack on the virtual disk image

Now the virtual machine is installed and we are ready to install BackTrack. Thanks to the hard work of the Backtrack-Linux.org team, this process is simple and uncomplicated.

  1. Open the VM VirtualBox Manager and select your BT5_R1_Tester1 guest machine on the left of the screen. Click on the large Start icon on the top bar of the application to start the virtual machine instance.

  2. Your machine will now boot up. As we have not yet selected an image to be used to boot the system with, we will need to select this using the menu options that will appear prior to the initial system initialization.

  3. You may be prompted with an informative window explaining that the Auto Capture Keyboard option is turned on. Click on the OK button to continue the system initialization.

  4. The First Run Wizard will only appear the first time the virtual machine is started. It allows you to easily choose the ISO you wish to boot up from.

  5. It is also possible to add the installation media in the Virtual Machine Settings in the Storage category.

  6. Click on Next to continue.

  7. On the Select Installation Media screen you will need to click on the folder icon to the right of the Media Source bar. You will then need to browse to the folder where you have downloaded the BackTrack ISO, and select it so that it appears as displayed in the following screenshot. Click on Next when ready.

  8. Verify your summary information and click on Start to initiate the machine. If the machine hangs at the boot: command, press Enter and the system will continue to boot. Allow it to fully load up the LiveCD (Default bootup option). You may be prompted with Keyboard Host Capture messages. Simply click on OK to these as needed.

  9. Type startx at the root @root:~# prompt.

  10. Now that we have the BackTrack ISO up and running on our virtual machine, we need to add persistence so that changes we make remain. Click on the Install BackTrack icon to begin the short installation process:

  11. Select your preferred language and click on Forward.

  12. Let the install know where you are in the world. This will affect your time settings and will also help with choosing servers that are closer to you for updates. Click on Forward to continue.

  13. Select your preferred keyboard layout and click on Forward.

  14. For the sake of simplicity we will be using the entire available disk space without manual partitioning. Choose the Erase and use the entire disk radial button and click on Forward.

  15. Click on Install to initialize the changes. This stage may take a few minutes to complete.

  16. When the install has finished you will be required to reboot the system. Click on the Restart Now button and then unload the ISO. You will need to choose Devices | CD/DVD Devices | {Your BackTrack ISO image name}. This will eject the ISO image before the system reboots. Press Enter to reboot.