Web Penetration Testing with Kali Linux - Third Edition

Book description

Build your defense against web attacks with Kali Linux, including command injection flaws, crypto implementation layers, and web application security holes

About This Book

  • Know how to set up your lab with Kali Linux
  • Discover the core concepts of web penetration testing
  • Get the tools and techniques you need with Kali Linux

Who This Book Is For

Since this book sets out to cover a large number of tools and security fields, it can work as an introduction to practical security skills for beginners in security. In addition, web programmers and also system administrators would benefit from this rigorous introduction to web penetration testing. Basic system administration skills are necessary, and the ability to read code is a must.

What You Will Learn

  • Learn how to set up your lab with Kali Linux
  • Understand the core concepts of web penetration testing
  • Get to know the tools and techniques you need to use with Kali Linux
  • Identify the difference between hacking a web application and network hacking
  • Expose vulnerabilities present in web servers and their applications using server-side attacks
  • Understand the different techniques used to identify the flavor of web applications
  • See standard attacks such as exploiting cross-site request forgery and cross-site scripting flaws
  • Get an overview of the art of client-side attacks
  • Explore automated attacks such as fuzzing web applications

In Detail

Web Penetration Testing with Kali Linux - Third Edition shows you how to set up a lab, helps you understand the nature and mechanics of attacking websites, and explains classical attacks in great depth. This edition is heavily updated for the latest Kali Linux changes and the most recent attacks. Kali Linux shines when it comes to client-side attacks and fuzzing in particular.

From the start of the book, you'll be given a thorough grounding in the concepts of hacking and penetration testing, and you'll see the tools used in Kali Linux that relate to web application hacking. You'll gain a deep understanding of classicalSQL, command-injection flaws, and the many ways to exploit these flaws. Web penetration testing also needs a general overview of client-side attacks, which is rounded out by a long discussion of scripting and input validation flaws.

There is also an important chapter on cryptographic implementation flaws, where we discuss the most recent problems with cryptographic layers in the networking stack.

The importance of these attacks cannot be overstated, and defending against them is relevant to most internet users and, of course, penetration testers.

At the end of the book, you'll use an automated technique called fuzzing to identify flaws in a web application. Finally, you'll gain an understanding of web application vulnerabilities and the ways they can be exploited using the tools in Kali Linux.

Style and approach

This step-by-step guide covers each topic with detailed practical examples. Every concept is explained with the help of illustrations using the tools available in Kali Linux.

Publisher resources

Download Example Code

Table of contents

  1. Title Page
  2. Copyright and Credits
    1. Web Penetration Testing with Kali Linux Third Edition
  3. Dedication
  4. Packt Upsell
    1. Why subscribe?
    2. PacktPub.com
  5. Contributors
    1. About the authors
    2. About the reviewer
    3. Packt is searching for authors like you
  6. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  7. 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
    5. Summary
  8. 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
    4. Summary
  9. 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
    4. Summary
  10. 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
    6. Summary
  11. 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
    6. Summary
  12. 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
    5. Summary
  13. 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
    4. Summary
  14. 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
    7. Summary
  15. AJAX, HTML5, and Client-Side Attacks
    1. Crawling AJAX applications
      1. AJAX Crawling Tool
      2. Sprajax
      3. The AJAX Spider – OWASP ZAP
    2. Analyzing the client-side code and storage
      1. Browser developer tools
        1. The Inspector panel
        2. The Debugger panel
        3. The Console panel
        4. The Network panel
        5. The Storage panel
        6. The DOM panel
    3. HTML5 for penetration testers
      1. New XSS vectors
        1. New elements
        2. New properties
      2. Local storage and client databases
        1. Web Storage
        2. IndexedDB
      3. Web Messaging
      4. WebSockets
        1. Intercepting and modifying WebSockets
      5. Other relevant features of HTML5
        1. Cross-Origin Resource Sharing (CORS)
        2. Geolocation
        3. Web Workers
    4. Bypassing client-side controls
    5. Mitigating AJAX, HTML5, and client-side vulnerabilities
    6. Summary
  16. Other Common Security Flaws in Web Applications
    1. Insecure direct object references
      1. Direct object references in web services
      2. Path traversal
    2. File inclusion vulnerabilities
      1. Local File Inclusion
      2. Remote File Inclusion
    3. HTTP parameter pollution
    4. Information disclosure
    5. Mitigation
      1. Insecure direct object references
      2. File inclusion attacks
      3. HTTP parameter pollution
      4. Information disclosure
    6. Summary
  17. 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
    6. Summary
  18. Other Books You May Enjoy
    1. Leave a review – let other readers know what you think

Product information

  • Title: Web Penetration Testing with Kali Linux - Third Edition
  • Author(s): Gilberto Najera-Gutierrez, Juned Ahmed Ansari
  • Release date: February 2018
  • Publisher(s): Packt Publishing
  • ISBN: 9781788623377