41,99 €
Over 80 recipes to effectively test your network and boost your career in security
About This Book
Who This Book Is For
If you are looking to expand your career into penetration testing, you will need a good understanding of Kali Linux and the variety of tools it includes. This book will work as a perfect guide for anyone who wants to have a practical approach in leveraging penetration testing mechanisms using Kali Linux
What You Will Learn
In Detail
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.
Style and approach
This book teaches you everything you need to know about Kali Linux from the perspective of a penetration tester. It is filled with powerful recipes and practical examples that will help you gain in-depth knowledge of Kali Linux.
Sie lesen das E-Book in den Legimi-Apps auf:
Seitenzahl: 251
Veröffentlichungsjahr: 2017
BIRMINGHAM - MUMBAI
Copyright © 2017 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: October 2013
Second edition: September 2017
Production reference: 1080917
Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK.
ISBN 978-1-78439-030-3
www.packtpub.com
Authors
Corey P. Schultz
Bob Perciaccante
Copy Editors
Juliana Nair
Yesha Gangani
Reviewers
Bhargav Tandel
Nishant Kumar Das Pattanaik
Project Coordinator
Judie Jose
Commissioning Editor
Vijin Boricha
Proofreader
Safis Editing
Acquisition Editor
Rahul Nair
Indexer
Aishwarya Gangawane
Content Development Editor
Devika Battike
Graphics
Kirk D'Penha
Technical Editor
Prachi Sawant
Production Coordinator
Aparna Bhagat
Corey P. Schultz is a technologist focusing on security research, Internet of Things, and the impact of technology on education and learning. He has over 20 years of experience in the security industry doing security architecture, penetration testing, incident response, and forensic analysis.
Corey is currently a technical solutions architect for Cisco Systems Global Security Sales Organization. He works on a daily basis with large environments on designing and architecting secure enterprise networks.
You can also find Corey active on Twitter @cschultz0000 or at his blog darkderby.com, where you can also see his schedule of speaking engagements and appearances.
Bob Perciaccante is seasoned information security practitioner who has been in the security field for almost 20 years. Currently, he is a consulting systems engineer for Cisco Systems in Pennsylvania where he has worked for the last 10 years focusing on network and data security, network access control, and secure network architectures. His primary day-to-day responsibilities focus on designing secure network solutions for his customers and working to train customers and partners on security solution implementations and daily operations to get the most out of their infrastructure.
When not involved in security activities, Bob enjoys eclectic hobbies such as working on cars, 3D printing, and camping.
Collaborating with his Cisco peer, Corey P. Schultz, this book is his first security publication.
Bhargav Tandel has over 5+ years of experience in information security with companies such as Reliance jio, Vodafone, and Wipro. His core expertise and passions are vulnerability assessment, penetration testing, ethical hacking, information security, and system administration. He is currently pursuing the OSCP certification. He has the ability to solve complex problems involving a wide variety of information systems, work independently on large-scale projects, and thrive under pressure in fast-paced environments while directing multiple projects from concept to implementation.
Nishant Kumar Das Pattanaik is an experienced application security and DevSecOps engineer. He is currently working as an application security engineer at eBay, Bangalore. In the past, he has worked as an application security researcher at InMobi and as a senior paranoid at Yahoo!. He loves to share his work with the InfoSec and developer community through public speaking and open source projects. And, hence, he has been a presenter at Black Hat Europe 2016, Black Hat USA 2016, Black Hat USA 2013, and Nullcon 2012. He loves to code in Python, Node.js, and PHP. He has authored Software Hacking, published by Vikas Publishing, and is also the technical reviewer of the book Kali Linux Intrusion and Exploitation Cookbook, published by Packt Publishing, and iOS Penetration Testing: A Definitive Guide to iOS Security, published by Apress Inc. When he is not working, you can find him either playing a piano or experimenting in the kitchen. You may reach out to him on Twitter at @dpnishant and check out some of his open source projects at github.com/dpnishant.
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www.packtpub.com/mapt
Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Thanks for purchasing this Packt book. At Packt, quality is at the heart of our editorial process. To help us improve, please leave us an honest review.
If you'd like to join our team of regular reviewers, you can e-mail us at [email protected]. We award our regular reviewers with free eBooks and videos in exchange for their valuable feedback. Help us be relentless in improving our products!
Preface
What this book covers
What you need for this book
Who this book is for
Sections
Getting ready
How to do it…
How it works…
There's more…
See also
Conventions
Readers feedback
Customer support
Downloading the color images of this book
Errata
Piracy
Questions
Installing Kali and the Lab Setup
Introduction
Lab architecture and considerations
How to do it...
The hypervisor selection
The hypervisor networking
Vulnerable workstations
Installing VirtualBox
Getting ready
How to do it...
How it works...
Installing Kali on VirtualBox
Getting ready
How to do it...
Using Kali Linux from bootable media
Getting ready
How to do it...
Upgrading Kali Linux
Getting ready
How to do it...
There's more..
apt-listchanges: news section
The configuring macchanger
The service restart
Understanding the advanced customization and optimization of Kali
Getting ready
How to do it...
Upgrading the Linux kernel
Removing unneeded packages
Adjusting or disabling the screen lock
Correcting the Ethernet interface configuration
Connecting and disconnecting Ethernet interfaces
Installing Windows machines
Getting ready
Installing Metasploitable
Getting ready
How to do it...
Installing OWASP-BWA
Getting ready
How to do it...
Understanding hack me and other online resources
There's more...
Reconnaissance and Scanning
Introduction
Using KeepNote to organize our data
Getting ready
How to do it...
There's more...
Getting up and running with Maltego CE
Getting ready
How to do it...
There's more...
Gathering domain information
Getting ready
How to do it...
There's more...
Gathering public IP information
Getting ready
How to do it...
Gathering external routing information
Getting ready
How to do it...
Gathering internal routing information
Getting ready
How to do it...
There's more...
Gathering cloud service information
Getting ready
How to do it...
Identifying network hosts
Getting ready
How to do it...
A simple subnet scan
Scan all the TCP ports of a host
Performing a TCP SYN scan
Performing a UDP port scan
The nmap output formats
Profiling hosts
Getting ready
How to do it...
Operating systems and service detection
Aggressive service detection
There's more...
Identifying whether there is a web application firewall
Getting ready
How to do it...
Using SNMP to gather more information
Getting ready
How to do it...
There's more...
Vulnerability Analysis
Introduction
Installation and configuration of OpenVAS
Getting ready
How to do it...
A basic vulnerability scanning with OpenVAS
Getting ready
How to do it...
Advanced vulnerability scanning with OpenVAS
Getting ready
How to do it...
Installation and Configuration of Nessus
Getting ready
How to do it...
A basic vulnerability scanning with Nessus
Getting ready
How to do it...
Advanced vulnerability scanning with Nessus
Getting ready
How to do it...
The installation and configuration of Nexpose
Getting ready
How to do it...
Basic vulnerability scanning with Nexpose
Getting ready
How to do it...
Advanced vulnerability scanning with Nexpose
Getting ready
How to do it...
Finding Exploits in the Target
Introduction
Searching the local exploit database
Getting ready
How to do it...
Update searchsploit
Run a simple query
Understanding search options in searchsploit
Searching the online exploit database
Getting ready
How to do it...
The Metasploit setup and configuration
Getting ready
How to do it...
Metasploit Framework initialization and startup
Starting the Metasploit console
Stopping the Metasploit console
There's more...
The Armitage setup
Getting ready
Armitage initialization and startup
Stopping Armitage
Basic exploit attacks with Armitage
Getting ready
How to do it...
Import an nmap scan
Perform an nmap scan from the Armitage interface
Find attacks against a host
Exploit the host
Advanced attacks with Armitage
Getting started
How to do it...
Initial exploitation
Dump hashes
Interacting with the Windows machine
Browsing the target's files
There's more...
Using the backdoor factory and Armitage
Getting ready
How to do it...
Social Engineering
Introduction
Phishing attacks
Getting ready
How to do it...
Spear-phishing attacks
Getting ready
How to do it...
Credential harvesting with SET
Getting ready
How to do it...
Web jacking
Getting ready
How to do it...
PowerShell attack vector
Getting ready
How to do it...
QRCode attack vector
Getting ready
How to do it...
There's more...
Infectious media generator
Getting ready
How to do it...
There's more...
Obfuscating and manipulating URLs
Getting ready
How to do it...
URL shortener
URL manipulation
Simple URL link misdirections
There's more...
DNS spoofing and ARP spoofing
Getting ready
How to do it...
DHCP spoofing
Getting ready
How to do it...
There's more...
Password Cracking
Introduction
Resetting local Windows machine password
Getting ready
How to do it...
Cracking remote Windows machine passwords
Getting ready
How to do it...
There's more...
Windows domain password attacks
Getting ready
How to do it...
Cracking local Linux password hashes
Getting ready
How to do it...
There's more...
Cracking password hashes with a wordlist
Getting ready
How to do it...
Brute force password hashes
Getting ready
How to do it...
Cracking FTP passwords
Getting ready
How to do it...
You have a username but not a password
You have a userlist
Cracking Telnet and SSH passwords
Getting ready
How to do it...
Cracking Telnet passwords with a userlist
Cracking SSH password with a known user
Cracking RDP and VNC passwords
Getting ready
How to do it...
Cracking ZIP file passwords
Getting ready
How to do it...
Privilege Escalation
Introduction
Establishing a connection as an elevated user
Getting ready
How to do it...
Remotely bypassing Windows UAC
Getting ready
How to do it...
Local Linux system check for privilege escalation
Getting ready
How to do it...
Local Linux privilege escalation
Getting ready
How to do it...
Remote Linux privilege escalation
Getting ready
How to do it...
DirtyCOW privilege escalation for Linux
Getting ready
How to do it...
Wireless Specific Recipes
Introduction
Scanning for wireless networks
Getting ready
How to do it...
Bypassing MAC-based authentication
Getting ready
How to do it...
Breaking WEP encryption
Getting ready
How to do it...
Obtaining WPA/WPA2 keys
Getting ready
How to do it...
Exploiting guest access
Getting ready
How to do it...
Rogue AP deployment
Getting ready
How to do it...
Using wireless networks to scan internal networks
Getting ready
How to do it...
Web and Database Specific Recipes
Introduction
Creating an offline copy of a web application
Getting ready
How to do it...
There's more...
Scanning for vulnerabilities
Getting ready
How to do it...
There's more...
Launching website attacks
Getting ready
How to do it...
Scanning WordPress
Getting ready
How to do it...
Hacking WordPress
Getting ready
How to do it...
Performing SQL injection attacks
Getting ready
How to do it...
Maintaining Access
Introduction
Pivoting and expanding access to the network
Getting ready
How to do it...
Using persistence to maintain system access
Getting ready
How to do it...
Using cymothoa to create a Linux backdoor
Getting ready
How to do it...
Protocol spoofing using pingtunnel
Getting ready
How to do it...
Protocol spoofing using httptunnel
Getting ready
How to do it...
Hiding communications with cryptcat
Getting ready
How to do it...
There's more...
Kali Linux, the most popular security testing platform available today, provides a means for individuals from all walks of life to become more experienced with penetration testing and information security. Kali is not only the cornerstone of many security penetration testing programs, but also has a tremendous community of users who share code, methods, and experiences to help even the most seasoned security practitioners become more effective. As a platform, Kali Linux is quite versatile. It can be run from bootable media, installed onto hardware platforms, or run in virtual environments. It can be enhanced with any number of tools available outside of the native distribution (and we will demonstrate this in the following chapters). It truly gives you the means to have a single platform to work from, in any format you like, without the need for expensive investments in hardware and software.
With the rise of malicious actors and malware, and the increased focus on system and network security, being able to understand how the attacker operates allows you to become more effective at providing balanced and appropriate controls.
In this book, we will explore how to use Kali Linux as well as additional tools such as Nexpose, Nessus, and OpenVAS to perform various types of penetration testing tasks. We will cover how to set up an effective lab for testing purposes and we will also cover many aspects of penetration testing, along with useful advice on how to go about being successful in using the Kali Linux platform.
Chapter 1, Installing Kali and the Lab Setup, documents best practices for setting up a testing environment, where you can test the skills highlighted in this book.
Chapter 2, Reconnaissance and Scanning, enables you to learn the skills necessary to gather information about your target environment. We will gather domain names, IP subnets, hosts, routing information, as well as other useful information. You will also learn how to keep track of this data, so we can refer to it in the future as we progress through our penetration testing environment.
Chapter 3, Vulnerability Analysis, explains that once access to a network has been gained and the systems within that network have been identified, the next step is to establish a foothold and persistent access.
Chapter 4, Finding Exploits in the Target, takes the host information that we have accumulated to determine the potential exploits to use against target machines and services.
Chapter 5, Social Engineering, speaks about social engineering that can be employed through electronic means and is also used in physical penetration testing and even data gathering. We bend well-known natural tendencies to help us accomplish or obtain what we want.
Chapter 6, Password Cracking, enables you to learn different techniques and tools to gain knowledge of password hashes gained during various attacks, as well as the means to reset these passwords if access is gained.
Chapter 7, Privilege Escalation, helps you to learn how to use a small foothold to expand the scope of your breach, increase the admin level, and use lateral movement to compromise more machines. In most cases, the initial point of a breach is not the desired target, but just a means to get to the more valuable targets.
Chapter 8, Wireless Specific Recipes, explains that due to the ever growing adoption of wireless networking, as well as the extended reach wireless signals can provide, we will focus on how to gain access to these networks through a variety of means.
Chapter 9, Web and Database Specific Recipes, explains that evaluating the security of web applications and databases requires a unique set of tools that can be leveraged against them. In the event that a web application is compromised, it is highly likely that it may then be used as a jumping off point for further network penetration.
Chapter 10, Maintaining Access, explains that once access has been gained to the target environment, it is crucial to make sure that your access is maintained. Learn how to maintain access and pivot into other areas of your target environment.
This book assumes a medium level of expertise on Linux operating systems, strong knowledge of networking technologies, including both wired and wireless, moderate experience with OS platform configuration, and moderate experience with general information security concepts. This book will go through the process of setting up a basic testing lab, the installation of Kali Linux, and the tools needed to perform network reconnaissance, and exploitation. Because you will be running exercises against live hosts, it is important that this environment is isolated from other non-test environments.
Kali Linux can be installed into a virtual environment such as VirtualBox or VMware, or can be installed onto a dedicated hardware. This book requires that you have enough compute resources for the Kali Linux installation as well as the target systems. In addition to the minimum requirements for your hypervisor, minimum hardware or virtual requirements are listed as follows:
CPU: 10 cores
Memory: 24 GB RAM
Disk space: 260 GB
In this book, you will need the following software list:
Kali Linux 2017.x
VirtualBox
Windows XP
Windows 7
Windows 2008
Internet connectivity is required to install the necessary additional packages that must be installed onto Kali Linux, depending on the recipe requirements.
To make best use of the content of this book, knowledge in networking, device management, general information security concepts, and core operating systems is required. Foundational knowledge of Kali Linux is also expected. Since Kali Linux provides a tremendous number of tools for many different purposes, it is impossible to cover all possible combinations of the available tools and their use. For more details on all the tools available within Kali Linux, visit the official Kali Linux Tool page located at https://tools.kali.org/. With that in mind, this book is intended to provide a more in-depth set of recipes to take advantage of these tools to sharpen your knowledge of security penetration testing and exploitation of insecure/undersecured environments.
In this book, you will find several headings that appear frequently (Getting ready, How to do it, How it works, There's more, and See also).
To give clear instructions on how to complete a recipe, we use these sections as follows:
This section tells you what to expect in the recipe, and describes how to set up any software or any preliminary settings required for the recipe.
This section contains the steps required to follow the recipe.
This section usually consists of a detailed explanation of what happened in the previous section.
This section consists of additional information about the recipe in order to make the reader more knowledgeable about the recipe.
This section provides helpful links to other useful information for the recipe.
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "select /root/Documents and type in your customer name".
Any command-line input or output is written as follows:
wafw00f scanme.nmap.org
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "click on Apply."
Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.
To send us general feedback, simply email [email protected], and mention the book's title in the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/KaliLinuxCookbookSecondEdition_ColorImages.pdf.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.
To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.
Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at [email protected] with a link to the suspected pirated material.
We appreciate your help in protecting our authors and our ability to bring you valuable content.
If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.
In this chapter, we will cover the following topics:
Lab architecture and considerations
Installing VirtualBox
Installing Kali on VirtualBox
Using Kali Linux from bootable media
Upgrading Kali Linux
Understanding the advanced customization and optimization of Kali
Installing Windows machines
Installing Metasploitable
Installing OWASP-BWA
Understanding hack me and other online resources
In order to set the stage for the rest of this book and to help you reproduce the recipes and their output, I strongly recommend that you create a test environment where you can run various tools that are included with Kali Linux. In this chapter, we will be focusing on building our testing environment based on free or low-cost applications to minimize cost.
Starting with installing the virtualization platform, VirtualBox, we will walk through a few common installation techniques for Kali Linux; you will also learn how to update and maintain your installation.
In this section, we will discuss our lab design and provide some information that you can use to expand it in the future.
As we begin to set up our lab, we want to take some time to discuss the lab setup and some of the considerations that we will take when using the lab. Some of these considerations are designed to make the lab more effective, while others are used for the protection of the networks our lab is connected to. We also want you to be in a position to easily expand or grow this network with other test machines as you master the Kali recipes that follow.
