You are previewing Advanced Penetration Testing for Highly-Secured Environments - Second Edition.
O'Reilly logo
Advanced Penetration Testing for Highly-Secured Environments - Second Edition

Book Description

Employ the most advanced pentesting techniques and tools to build highly-secured systems and environments

About This Book

  • Learn how to build your own pentesting lab environment to practice advanced techniques

  • Customize your own scripts, and learn methods to exploit 32-bit and 64-bit programs

  • Explore a vast variety of stealth techniques to bypass a number of protections when penetration testing

  • Who This Book Is For

    This book is for anyone who wants to improve their skills in penetration testing. As it follows a step-by-step approach, anyone from a novice to an experienced security tester can learn effective techniques to deal with highly secured environments.

    Whether you are brand new or a seasoned expert, this book will provide you with the skills you need to successfully create, customize, and plan an advanced penetration test.

    What You Will Learn

  • A step-by-step methodology to identify and penetrate secured environments

  • Get to know the process to test network services across enterprise architecture when defences are in place

  • Grasp different web application testing methods and how to identify web application protections that are deployed

  • Understand a variety of concepts to exploit software

  • Gain proven post-exploitation techniques to exfiltrate data from the target

  • Get to grips with various stealth techniques to remain undetected and defeat the latest defences

  • Be the first to find out the latest methods to bypass firewalls

  • Follow proven approaches to record and save the data from tests for analysis

  • In Detail

    The defences continue to improve and become more and more common, but this book will provide you with a number or proven techniques to defeat the latest defences on the networks. The methods and techniques contained will provide you with a powerful arsenal of best practices to increase your penetration testing successes.

    The processes and methodology will provide you techniques that will enable you to be successful, and the step by step instructions of information gathering and intelligence will allow you to gather the required information on the targets you are testing. The exploitation and post-exploitation sections will supply you with the tools you would need to go as far as the scope of work will allow you. The challenges at the end of each chapter are designed to challenge you and provide real-world situations that will hone and perfect your penetration testing skills. You will start with a review of several well respected penetration testing methodologies, and following this you will learn a step-by-step methodology of professional security testing, including stealth, methods of evasion, and obfuscation to perform your tests and not be detected!

    The final challenge will allow you to create your own complex layered architecture with defences and protections in place, and provide the ultimate testing range for you to practice the methods shown throughout the book. The challenge is as close to an actual penetration test assignment as you can get!

    Style and approach

    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 foot printing

    Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

    Table of Contents

    1. Advanced Penetration Testing for Highly-Secured Environments Second Edition
      1. Table of Contents
      2. Advanced Penetration Testing for Highly-Secured Environments Second Edition
      3. Credits
      4. About the Authors
      5. About the Reviewer
      6. www.PacktPub.com
        1. eBooks, discount offers, and more
          1. Why subscribe?
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the color images of this book
          2. Errata
          3. Piracy
          4. Questions
      8. 1. Penetration Testing Essentials
        1. Methodology defined
        2. Example methodologies
          1. Penetration testing framework
          2. Penetration Testing Execution Standard
          3. Pre-engagement interactions
          4. Intelligence gathering
          5. Threat modeling
          6. Vulnerability analysis
          7. Exploitation
          8. Post-exploitation
          9. Reporting
        3. Abstract methodology
          1. Final thoughts
        4. Summary
      9. 2. Preparing a Test Environment
        1. Introducing VMware Workstation
          1. Why VMware Workstation?
        2. Installing VMware Workstation
        3. Network design
          1. VMnet0
          2. VMnet1
          3. VMnet8
          4. Folders
        4. Understanding the default architecture
          1. Installing Kali Linux
        5. Creating the switches
        6. Putting it all together
          1. Installing Ubuntu LTS
          2. Installing Kioptrix
          3. Creating pfSense VM
        7. Summary
      10. 3. Assessment Planning
        1. Introducing advanced penetration testing
          1. Vulnerability assessments
          2. Penetration testing
          3. Advanced penetration testing
        2. Before testing begins
          1. Determining scope
          2. Setting limits – nothing lasts forever
            1. Rules of Engagement documentation
        3. Planning for action
          1. Configuring Kali
            1. Updating the applications and operating system
        4. Installing LibreOffice
        5. Effectively managing your test results
          1. Introduction to MagicTree
            1. Starting MagicTree
            2. Adding nodes
            3. Data collection
            4. Report generation
        6. Introduction to the Dradis framework
          1. Exporting a project template
          2. Importing a project template
          3. Preparing sample data for import
            1. Importing your Nmap data
          4. Exporting data into HTML
          5. Dradis Category field
            1. Changing the default HTML template
        7. Summary
      11. 4. Intelligence Gathering
        1. Introducing reconnaissance
          1. Reconnaissance workflow
        2. DNS recon
          1. nslookup – it's there when you need it
            1. Default output
            2. Changing nameservers
            3. Creating an automation script
            4. What did we learn?
          2. Domain information groper
            1. Default output
            2. Zone transfers using Dig
            3. Advanced features of Dig
              1. Shortening the output
              2. Listing the bind version
              3. Reverse DNS lookup using Dig
              4. Multiple commands
              5. Tracing the path
              6. Batching with dig
          3. DNS brute-forcing with fierce
            1. Default command usage
            2. Creating a custom word list
        3. Gathering and validating domain and IP information
          1. Gathering information with Whois
            1. Specifying which registrar to use
            2. Where in the world is this IP?
            3. Defensive measures
        4. Using search engines to do your job for you
          1. Shodan
            1. Filters
            2. Understanding banners
              1. HTTP banners
            3. Finding specific assets
          2. Finding people (and their documents) on the web
            1. Google hacking database
              1. Google filters
          3. Searching the Internet for clues
        5. Creating network baselines with scanPBNJ
          1. Metadata collection
            1. Extracting metadata from photos using exiftool
        6. Summary
      12. 5. Network Service Attacks
        1. Configuring and testing our lab clients
          1. Kali – manual ifconfig
          2. Ubuntu – manual ifconfig
          3. Verifying connectivity
          4. Maintaining IP settings after reboot
        2. Angry IP Scanner
        3. Nmap – getting to know you
          1. Commonly seen Nmap scan types and options
          2. Basic scans – warming up
          3. Other Nmap techniques
            1. Remaining stealthy
              1. Taking your time
              2. Trying different scan types
                1. SYN scan
                2. Null scan
                3. ACK scan
                4. Conclusion
            2. Shifting blame – the zombies did it!
            3. IDS rules and how to avoid them
            4. Using decoys
          4. Adding custom Nmap scripts to your arsenal
            1. Deciding if a script is right for you
            2. Adding a new script to the database
            3. Zenmap – for those who want the GUI
        4. SNMP – a goldmine of information just waiting to be discovered
          1. When the SNMP community string is NOT "public"
        5. Network baselines with scanPBNJ
          1. Setting up MySQL for PBNJ
          2. Preparing the PBNJ database
          3. First scan
          4. Reviewing the data
        6. Enumeration avoidance techniques
          1. Naming conventions
          2. Port knocking
          3. Intrusion detection and avoidance systems
          4. Trigger points
          5. SNMP lockdown
        7. Reader challenge
        8. Summary
      13. 6. Exploitation
        1. Exploitation – why bother?
        2. Manual exploitation
          1. Enumerating services
            1. Quick scans with unicornscan
          2. Full scanning with Nmap
          3. Banner grabbing with Netcat and Ncat
            1. Banner grabbing with Netcat
            2. Banner grabbing with Ncat
            3. Banner grabbing with smbclient
          4. Searching Exploit-DB
          5. Exploit-DB at hand
            1. Compiling the code
            2. Compiling proof-of-concept code
            3. Troubleshooting the code
              1. What are all of these ^M characters and why won't they go away?
              2. Broken strings – the reunion
          6. Running the exploit
        3. Getting files to and from victim machines
          1. Starting a TFTP server on Kali
          2. Installing and configuring pure-ftpd
          3. Starting pure-ftpd
        4. Passwords – something you know…
          1. Cracking the hash
          2. Brute-forcing passwords
        5. Metasploit – learn it and love it
          1. Databases and Metasploit
          2. Performing an nmap scan from within Metasploit
            1. Using auxiliary modules
          3. Using Metasploit to exploit Kioptrix
        6. Reader challenge
        7. Summary
      14. 7. Web Application Attacks
        1. Practice makes perfect
          1. Creating a KioptrixVM Level 3 clone
          2. Installing and configuring Mutillidae on the Ubuntu virtual machine
        2. Configuring pfSense
          1. Configuring the pfSense DHCP server
          2. Starting the virtual lab
          3. pfSense DHCP – Permanent reservations
          4. Installing HAProxy for load balancing
          5. Adding Kioptrix3.com to the host file
        3. Detecting load balancers
          1. Quick reality check – Load Balance Detector
            1. So, what are we looking for anyhow?
        4. Detecting web application firewalls (WAF)
        5. Taking on Level 3 – Kioptrix
        6. Web Application Attack and Audit framework (w3af)
          1. Using w3af GUI to save configuration time
          2. Using a second tool for comparisons
          3. Scanning using the w3af console
            1. Using WebScarab as an HTTP proxy
        7. Introduction to browser plugin HackBar
        8. Reader challenge
        9. Summary
      15. 8. Exploitation Concepts
        1. Buffer overflows – a refresher
          1. Memory basics
          2. "C"ing is believing – Create a vulnerable program
          3. Turning ASLR on and off in Kali
          4. Understanding the basics of buffer overflows
        2. 64-bit exploitation
        3. Introducing vulnserver
        4. Fuzzing tools included in Kali
          1. Bruteforce Exploit Detector (BED)
          2. sfuzz – Simple fuzzer
        5. Social Engineering Toolkit
        6. Fast-Track
        7. Reader challenge
        8. Summary
      16. 9. Post-Exploitation
        1. Rules of Engagement
          1. What is permitted?
          2. Can you modify anything and everything?
          3. Are you allowed to add persistence?
          4. How is the data that is collected and stored handled by you and your team?
          5. Employee data and personal information
        2. Data gathering, network analysis, and pillaging
          1. Linux
            1. Important directories and files
            2. Important commands
          2. Putting this information to use
            1. Enumeration
            2. Exploitation
            3. We are connected, now what?
            4. Which tools are available on the remote system?
            5. Finding network information
            6. Determine connections
            7. Checking installed packages
            8. Package repositories
            9. Programs and services that run at startup
            10. Searching for information
            11. History files and logs
            12. Configurations, settings, and other files
            13. Users and credentials
            14. Moving the files
          3. Microsoft Windows™ post-exploitation
            1. Important directories and files
            2. Using Armitage for post-exploitation
            3. Enumeration
            4. Exploitation
            5. We are connected, now what?
            6. Networking details
            7. Finding installed software and tools
        3. Pivoting
        4. Reader challenge
        5. Summary
      17. 10. Stealth Techniques
        1. Lab preparation
          1. Kali guest machine
          2. Ubuntu guest machine
          3. The pfSense guest machine configuration
            1. The pfSense network setup
            2. WAN IP configuration
            3. LAN IP configuration
          4. Firewall configuration
        2. Stealth scanning through the firewall
          1. Finding the ports
            1. Traceroute to find out if there is a firewall
            2. Finding out if the firewall is blocking certain ports
              1. Hping3
              2. Nmap firewalk script
        3. Now you see me, now you don't – avoiding IDS
          1. Canonicalization
          2. Timing is everything
        4. Blending in
        5. PfSense SSH logs
        6. Looking at traffic patterns
        7. Cleaning up compromised hosts
          1. Using a checklist
          2. When to clean up
          3. Local log files
        8. Miscellaneous evasion techniques
          1. Divide and conquer
          2. Hiding out (on controlled units)
          3. File Integrity Monitoring (FIM)
          4. Using common network management tools to do the deed
        9. Reader challenge
        10. Summary
      18. 11. Data Gathering and Reporting
        1. Record now – sort later
        2. Old school – the text editor method
          1. Nano
          2. VIM –the power user's text editor of choice
          3. Gedit – Gnome text editor
        3. Dradis framework for collaboration
          1. Binding to an available interface other than 127.0.0.1
        4. The report
        5. Reader challenge
        6. Summary
      19. 12. Penetration Testing Challenge
        1. Firewall lab setup
          1. Installing additional packages in pfSense
        2. The scenario
        3. The virtual lab setup
          1. AspenMLC Research Labs' virtual network
          2. Additional system modifications
            1. Ubuntu 8.10 server modifications
        4. The challenge
        5. The walkthrough
          1. Defining the scope
          2. Determining the "why"
            1. So what is the "why" of this particular test?
          3. Developing the Rules of Engagement document
          4. Initial plan of attack
          5. Enumeration and exploitation
        6. Reporting
        7. Summary
      20. Index