Improving your Penetration Testing Skills

Book description

Evade antiviruses and bypass firewalls with the most widely used penetration testing frameworks

Key Features

  • Gain insights into the latest antivirus evasion techniques
  • Set up a complete pentesting environment using Metasploit and virtual machines
  • Discover a variety of tools and techniques that can be used with Kali Linux

Book Description

Penetration testing or ethical hacking is a legal and foolproof way to identify vulnerabilities in your system. With thorough penetration testing, you can secure your system against the majority of threats.

This Learning Path starts with an in-depth explanation of what hacking and penetration testing is. You’ll gain a deep understanding of classical SQL and command injection flaws, and discover ways to exploit these flaws to secure your system. You'll also learn how to create and customize payloads to evade antivirus software and bypass an organization's defenses. Whether it's exploiting server vulnerabilities and attacking client systems, or compromising mobile phones and installing backdoors, this Learning Path will guide you through all this and more to improve your defense against online attacks.

By the end of this Learning Path, you'll have the knowledge and skills you need to invade a system and identify all its vulnerabilities.

This Learning Path includes content from the following Packt products:

  • Web Penetration Testing with Kali Linux - Third Edition by Juned Ahmed Ansari and Gilberto Najera-Gutierrez
  • Metasploit Penetration Testing Cookbook - Third Edition by Abhinav Singh , Monika Agarwal, et al

What you will learn

  • Build and analyze Metasploit modules in Ruby
  • Integrate Metasploit with other penetration testing tools
  • Use server-side attacks to detect vulnerabilities in web servers and their applications
  • Explore automated attacks such as fuzzing web applications
  • Identify the difference between hacking a web application and network hacking
  • Deploy Metasploit with the Penetration Testing Execution Standard (PTES)
  • Use MSFvenom to generate payloads and backdoor files, and create shellcode

Who this book is for

This Learning Path is designed for security professionals, web programmers, and pentesters who want to learn vulnerability exploitation and make the most of the Metasploit framework. Some understanding of penetration testing and Metasploit is required, but basic system administration skills and the ability to read code are a must.

Downloading the example code for this ebook: You can download the example code files for this ebook on GitHub at the following link: https://github.com/PacktPublishing/Improving-your-Penetration-Testing-Skills . If you require support please email: customercare@packt.com

Table of contents

  1. Title Page
  2. Copyright
    1. Improving your Penetration Testing Skills
  3. About Packt
    1. Why subscribe?
    2. Packt.com
  4. Contributors
    1. About the authors
    2. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  6. Introduction to Penetration Testing and Web Applications
    1. Proactive security testing
      1. Different testing methodologies
        1. Ethical hacking
        2. Penetration testing
        3. Vulnerability assessment
        4. Security audits
    2. Considerations when performing penetration testing
      1. Rules of Engagement
        1. The type and scope of testing
        2. Client contact details
        3. Client IT team notifications
        4. Sensitive data handling
        5. Status meeting and reports
      2. The limitations of penetration testing
      3. The need for testing web applications
      4. Reasons to guard against attacks on web applications
    3. Kali Linux
    4. A web application overview for penetration testers
      1. HTTP protocol
      2. Knowing an HTTP request and response
        1. The request header
        2. The response header
        3. HTTP methods
          1. The GET method
          2. The POST method
          3. The HEAD method
          4. The TRACE method
          5. The PUT and DELETE methods
          6. The OPTIONS method
      3. Keeping sessions in HTTP
        1. Cookies
        2. Cookie flow between server and client
        3. Persistent and nonpersistent cookies
        4. Cookie parameters
      4. HTML data in HTTP response
        1. The server-side code
      5. Multilayer web application
        1. Three-layer web application design
        2. Web services
        3. Introducing SOAP and REST web services
        4. HTTP methods in web services
        5. XML and JSON
        6. AJAX
          1. Building blocks of AJAX
          2. The AJAX workflow
        7. HTML5
        8. WebSockets
  7. Setting Up Your Lab with Kali Linux
    1. Kali Linux
      1. Latest improvements in Kali Linux
      2. Installing Kali Linux
        1. Virtualizing Kali Linux versus installing it on physical hardware
        2. Installing on VirtualBox
          1. Creating the virtual machine
          2. Installing the system
    2. Important tools in Kali Linux
      1. CMS & Framework Identification
        1. WPScan
        2. JoomScan
        3. CMSmap
      2. Web Application Proxies
        1. Burp Proxy
          1. Customizing client interception
          2. Modifying requests on the fly
          3. Burp Proxy with HTTPS websites
        2. Zed Attack Proxy
        3. ProxyStrike
      3. Web Crawlers and Directory Bruteforce
        1. DIRB
        2. DirBuster
        3. Uniscan
      4. Web Vulnerability Scanners
        1. Nikto
        2. w3af
        3. Skipfish
      5. Other tools
        1. OpenVAS
        2. Database exploitation
        3. Web application fuzzers
        4. Using Tor for penetration testing
    3. Vulnerable applications and servers to practice on
      1. OWASP Broken Web Applications
      2. Hackazon
      3. Web Security Dojo
      4. Other resources
  8. Reconnaissance and Profiling the Web Server
    1. Reconnaissance
      1. Passive reconnaissance versus active reconnaissance
    2. Information gathering
      1. Domain registration details
        1. Whois – extracting domain information
      2. Identifying related hosts using DNS
        1. Zone transfer using dig
        2. DNS enumeration
          1. DNSEnum
          2. Fierce
          3. DNSRecon
          4. Brute force DNS records using Nmap
      3. Using search engines and public sites to gather information
        1. Google dorks
        2. Shodan
        3. theHarvester
        4. Maltego
      4. Recon-ng – a framework for information gathering
        1. Domain enumeration using Recon-ng
          1. Sub-level and top-level domain enumeration
        2. Reporting modules
    3. Scanning – probing the target
      1. Port scanning using Nmap
        1. Different options for port scan
        2. Evading firewalls and IPS using Nmap
        3. Identifying the operating system
      2. Profiling the server
        1. Identifying virtual hosts
          1. Locating virtual hosts using search engines
          2. Identifying load balancers
          3. Cookie-based load balancer
          4. Other ways of identifying load balancers
        2. Application version fingerprinting
          1. The Nmap version scan
          2. The Amap version scan
        3. Fingerprinting the web application framework
          1. The HTTP header
          2. The WhatWeb scanner
      3. Scanning web servers for vulnerabilities and misconfigurations
        1. Identifying HTTP methods using Nmap
        2. Testing web servers using auxiliary modules in Metasploit
        3. Identifying HTTPS configuration and issues
          1. OpenSSL client
          2. Scanning TLS/SSL configuration with SSLScan
          3. Scanning TLS/SSL configuration with SSLyze
          4. Testing TLS/SSL configuration using Nmap
      4. Spidering web applications
        1. Burp Spider
          1. Application login
        2. Directory brute forcing
          1. DIRB
          2. ZAP's forced browse
  9. Authentication and Session Management Flaws
    1. Authentication schemes in web applications
      1. Platform authentication
        1. Basic
        2. Digest
        3. NTLM
        4. Kerberos
        5. HTTP Negotiate
        6. Drawbacks of platform authentication
      2. Form-based authentication
      3. Two-factor Authentication
      4. OAuth
    2. Session management mechanisms
      1. Sessions based on platform authentication
      2. Session identifiers
    3. Common authentication flaws in web applications
      1. Lack of authentication or incorrect authorization verification
      2. Username enumeration
      3. Discovering passwords by brute force and dictionary attacks
        1. Attacking basic authentication with THC Hydra
        2. Attacking form-based authentication
          1. Using Burp Suite Intruder
          2. Using THC Hydra
      4. The password reset functionality
        1. Recovery instead of reset
        2. Common password reset flaws
      5. Vulnerabilities in 2FA implementations
    4. Detecting and exploiting improper session management
      1. Using Burp Sequencer to evaluate the quality of session IDs
      2. Predicting session IDs
      3. Session Fixation
    5. Preventing authentication and session attacks
      1. Authentication guidelines
      2. Session management guidelines
  10. Detecting and Exploiting Injection-Based Flaws
    1. Command injection
      1. Identifying parameters to inject data
        1. Error-based and blind command injection
        2. Metacharacters for command separator
      2. Exploiting shellshock
        1. Getting a reverse shell
        2. Exploitation using Metasploit
    2. SQL injection
      1. An SQL primer
        1. The SELECT statement
      2. Vulnerable code
      3. SQL injection testing methodology
      4. Extracting data with SQL injection
        1. Getting basic environment information
        2. Blind SQL injection
      5. Automating exploitation
        1. sqlninja
        2. BBQSQL
        3. sqlmap
      6. Attack potential of the SQL injection flaw
    3. XML injection
      1. XPath injection
        1. XPath injection with XCat
      2. The XML External Entity injection
      3. The Entity Expansion attack
    4. NoSQL injection
      1. Testing for NoSQL injection
      2. Exploiting NoSQL injection
    5. Mitigation and prevention of injection vulnerabilities
  11. Finding and Exploiting Cross-Site Scripting (XSS) Vulnerabilities
    1. An overview of Cross-Site Scripting
      1. Persistent XSS
      2. Reflected XSS
      3. DOM-based XSS
      4. XSS using the POST method
    2. Exploiting Cross-Site Scripting
      1. Cookie stealing
      2. Website defacing
      3. Key loggers
      4. Taking control of the user's browser with BeEF-XSS
    3. Scanning for XSS flaws
      1. XSSer
      2. XSS-Sniper
    4. Preventing and mitigating Cross-Site Scripting
  12. Cross-Site Request Forgery, Identification, and Exploitation
    1. Testing for CSRF flaws
    2. Exploiting a CSRF flaw
      1. Exploiting CSRF in a POST request
      2. CSRF on web services
      3. Using Cross-Site Scripting to bypass CSRF protections
    3. Preventing CSRF
  13. Attacking Flaws in Cryptographic Implementations
    1. A cryptography primer
      1. Algorithms and modes
        1. Asymmetric encryption versus symmetric encryption
          1. Symmetric encryption algorithm
        2. Stream and block ciphers
        3. Initialization Vectors
        4. Block cipher modes
      2. Hashing functions
        1. Salt values
    2. Secure communication over SSL/TLS
      1. Secure communication in web applications
        1. TLS encryption process
    3. Identifying weak implementations of SSL/TLS
      1. The OpenSSL command-line tool
      2. SSLScan
      3. SSLyze
      4. Testing SSL configuration using Nmap
      5. Exploiting Heartbleed
      6. POODLE
    4. Custom encryption protocols
      1. Identifying encrypted and hashed information
        1. Hashing algorithms
          1. hash-identifier
        2. Frequency analysis
        3. Entropy analysis
        4. Identifying the encryption algorithm
    5. Common flaws in sensitive data storage and transmission
      1. Using offline cracking tools
        1. Using John the Ripper
        2. Using Hashcat
    6. Preventing flaws in cryptographic implementations
  14. Using Automated Scanners on Web Applications
    1. Considerations before using an automated scanner
    2. Web application vulnerability scanners in Kali Linux
      1. Nikto
      2. Skipfish
      3. Wapiti
      4. OWASP-ZAP scanner
    3. Content Management Systems scanners
      1. WPScan
      2. JoomScan
      3. CMSmap
    4. Fuzzing web applications
      1. Using the OWASP-ZAP fuzzer
      2. Burp Intruder
    5. Post-scanning actions
  15. Metasploit Quick Tips for Security Professionals
    1. Introduction
    2. Installing Metasploit on Windows
      1. Getting ready
      2. How to do it...
    3. Installing Linux and macOS
      1. How to do it...
    4. Installing Metasploit on macOS
      1. How to do it...
    5. Using Metasploit in Kali Linux
      1. Getting ready
      2. How to do it...
      3. There's more...
        1. Upgrading Kali Linux
    6. Setting up a penetration-testing lab
      1. Getting ready
      2. How to do it...
      3. How it works...
    7. Setting up SSH connectivity
      1. Getting ready
      2. How to do it...
    8. Connecting to Kali using SSH
      1. How to do it...
    9. Configuring PostgreSQL
      1. Getting ready
      2. How to do it...
      3. There's more...
    10. Creating  workspaces
      1. How to do it...
    11. Using the database
      1. Getting ready
      2. How to do it...
    12. Using the hosts command
      1. How to do it...
    13. Understanding the services command
      1. How to do it...
  16. Information Gathering and Scanning
    1. Introduction
    2. Passive information gathering with Metasploit
      1. Getting ready
      2. How to do it...
        1. DNS Record Scanner and Enumerator
      3. There's more...
        1. CorpWatch Company Name Information Search
        2. Search Engine Subdomains Collector
        3. Censys Search
        4. Shodan Search
        5. Shodan Honeyscore Client
        6. Search Engine Domain Email Address Collector
    3. Active information gathering with Metasploit
      1. How to do it...
        1. TCP Port Scanner
        2. TCP SYN Port Scanner
    4. Port scanning—the Nmap way
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
        1. Operating system and version detection
        2. Increasing anonymity
    5. Port scanning — the db_nmap way
      1. Getting ready
      2. How to do it...
        1. Nmap Scripting Engine
    6. Host discovery with ARP Sweep
      1. Getting ready
      2. How to do it...
    7. UDP Service Sweeper
      1. How to do it...
    8. SMB scanning and enumeration
      1. How to do it...
    9. Detecting SSH versions with the SSH Version Scanner
      1. Getting ready
      2. How to do it...
    10. FTP scanning
      1. Getting ready
      2. How to do it...
    11. SMTP enumeration
      1. Getting ready
      2. How to do it...
    12. SNMP enumeration
      1. Getting ready
      2. How to do it...
    13. HTTP scanning
      1. Getting ready
      2. How to do it...
    14. WinRM scanning and brute forcing
      1. Getting ready
      2. How to do it...
    15. Integrating with Nessus
      1. Getting ready
      2. How to do it...
    16. Integrating with NeXpose
      1. Getting ready
      2. How to do it...
    17. Integrating with OpenVAS
      1. How to do it...
  17. Server-Side Exploitation
    1. Introduction
      1. Getting to know MSFconsole
        1. MSFconsole commands
    2. Exploiting a Linux server
      1. Getting ready
      2. How to do it...
      3. How it works...
        1. What about the payload?
    3. SQL injection
      1. Getting ready
      2. How to do it...
    4. Types of shell
      1. Getting ready
      2. How to do it...
    5. Exploiting a Windows Server machine
      1. Getting ready
      2. How to do it...
    6. Exploiting common services
      1. Getting ready
      2. How to do it
    7. MS17-010 EternalBlue SMB Remote Windows Kernel Pool Corruption
      1. Getting ready
      2. How to do it...
    8. MS17-010 EternalRomance/EternalSynergy/EternalChampion
      1. How to do it...
    9. Installing backdoors
      1. Getting ready
      2. How to do it...
    10. Denial of Service
      1. Getting ready
      2. How to do it...
      3. How to do it...
  18. Meterpreter
    1. Introduction
    2. Understanding the Meterpreter core commands
      1. Getting ready
      2. How to do it...
      3. How it works...
    3. Understanding the Meterpreter filesystem commands
      1. How to do it...
      2. How it works...
    4. Understanding Meterpreter networking commands
      1. Getting ready
      2. How to do it...
      3. How it works...
    5. Understanding the Meterpreter system commands
      1. How to do it...
    6. Setting up multiple communication channels with the target
      1. Getting ready
      2. How to do it...
      3. How it works...
    7. Meterpreter anti-forensics
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    8. The getdesktop and keystroke sniffing
      1. Getting ready
      2. How to do it...
      3. There's more...
    9. Using a scraper Meterpreter script
      1. Getting ready
      2. How to do it...
      3. How it works...
    10. Scraping the system using winenum
      1. How to do it...
    11. Automation with AutoRunScript
      1. How to do it...
    12. Meterpreter resource scripts
      1. How to do it...
    13. Meterpreter timeout control
      1. How to do it...
    14. Meterpreter sleep control
      1. How to do it...
    15. Meterpreter transports
      1. How to do it...
    16. Interacting with the registry
      1. Getting ready
      2. How to do it...
    17. Loading framework plugins
      1. How to do it...
    18. Meterpreter API and mixins
      1. Getting ready
      2. How to do it...
      3. How it works...
    19. Railgun—converting Ruby into a weapon
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    20. Adding DLL and function definitions to Railgun
      1. How to do it...
      2. How it works...
    21. Injecting the VNC server remotely
      1. Getting ready
      2. How to do it...
    22. Enabling Remote Desktop
      1. How to do it...
      2. How it works...
  19. Post-Exploitation
    1. Introduction
    2. Post-exploitation modules
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. How to do it...
      5. How it works...
    3. Bypassing UAC
      1. Getting ready
      2. How to do it...
    4. Dumping the contents of the SAM database
      1. Getting ready
      2. How to do it...
    5. Passing the hash
      1. How to do it...
    6. Incognito attacks with Meterpreter
      1. How to do it...
    7. Using Mimikatz
      1. Getting ready
      2. How to do it...
      3. There's more...
    8. Setting up a persistence with backdoors
      1. Getting ready
      2. How to do it...
    9. Becoming TrustedInstaller
      1. How to do it...
    10. Backdooring Windows binaries
      1. How to do it...
    11. Pivoting with Meterpreter
      1. Getting ready
      2. How to do it...
      3. How it works...
    12. Port forwarding with Meterpreter
      1. Getting ready
      2. How to do it...
    13. Credential harvesting
      1. How to do it...
    14. Enumeration modules
      1. How to do it...
    15. Autoroute and socks proxy server
      1. How to do it...
    16. Analyzing an existing post-exploitation module
      1. Getting ready
      2. How to do it...
      3. How it works...
    17. Writing a post-exploitation module
      1. Getting ready
      2. How to do it...
  20. Using MSFvenom
    1. Introduction
    2. Payloads and payload options
      1. Getting ready
      2. How to do it...
    3. Encoders
      1. How to do it...
      2. There's more...
    4. Output formats
      1. How to do it...
    5. Templates
      1. Getting ready
      2. How to do it...
    6. Meterpreter payloads with trusted certificates
      1. Getting ready
      2. How to do it...
      3. There's more...
  21. Client-Side Exploitation and Antivirus Bypass
    1. Introduction
    2. Exploiting a Windows 10 machine
      1. Getting ready
      2. How to do it...
    3. Bypassing antivirus and IDS/IPS
      1. How to do it...
    4. Metasploit macro exploits
      1. How to do it...
      2. There's more...
    5. Human Interface Device attacks
      1. Getting ready
      2. How to do it...
    6. HTA attack
      1. How to do it...
    7. Backdooring executables using a MITM attack
      1. Getting ready
      2. How to do it...
    8. Creating a Linux trojan
      1. How to do it...
    9. Creating an Android backdoor
      1. Getting ready
      2. How to do it...
      3. There's more...
  22. Social-Engineer Toolkit
    1. Introduction
    2. Getting started with the Social-Engineer Toolkit
      1. Getting ready
      2. How to do it...
      3. How it works...
    3. Working with the spear-phishing attack vector
      1. How to do it...
    4. Website attack vectors
      1. How to do it...
    5. Working with the multi-attack web method
      1. How to do it...
    6. Infectious media generator
      1. How to do it...
      2. How it works...
  23. Working with Modules for Penetration Testing
    1. Introduction
    2. Working with auxiliary modules
      1. Getting ready
      2. How to do it...
    3. DoS attack modules
      1. How to do it...
        1. HTTP
        2. SMB
    4. Post-exploitation modules
      1. Getting ready
      2. How to do it...
    5. Understanding the basics of module building
      1. How to do it...
    6. Analyzing an existing module
      1. Getting ready
      2. How to do it...
    7. Building your own post-exploitation module
      1. Getting ready
      2. How to do it...
    8. Building your own auxiliary module
      1. Getting ready
      2. How to do it...
  24. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Improving your Penetration Testing Skills
  • Author(s): Gilberto Najera-Gutierrez, Juned Ahmed Ansari, Daniel Teixeira, Abhinav Singh
  • Release date: July 2019
  • Publisher(s): Packt Publishing
  • ISBN: 9781838646073