Reader small image

You're reading from  Building and Automating Penetration Testing Labs in the Cloud

Product typeBook
Published inOct 2023
PublisherPackt
ISBN-139781837632398
Edition1st Edition
Right arrow
Author (1)
Joshua Arvin Lat
Joshua Arvin Lat
author image
Joshua Arvin Lat

Joshua Arvin Lat is the Chief Technology Officer (CTO) of NuWorks Interactive Labs, Inc. He previously served as the CTO for three Australian-owned companies and as director of software development and engineering for multiple e-commerce start-ups in the past. Years ago, he and his team won first place in a global cybersecurity competition with their published research paper. He is also an AWS Machine Learning Hero and has shared his knowledge at several international conferences, discussing practical strategies on machine learning, engineering, security, and management.
Read more about Joshua Arvin Lat

Right arrow

Preface

As more organizations around the world migrate their data and their workloads to the cloud, engineering teams as well as security professionals face the complex task of securing production environments against an increasing number of cloud-related threats and risks. This has led to a surge in demand for security professionals capable of attacking and defending cloud applications and systems. Security professionals seeking career growth and looking to excel in their careers should learn how to set up various types of vulnerable-by-design lab environments in the cloud to sharpen their skills even further.

I have written this book to help you and other professionals design, build, and automate penetration testing lab environments running on Amazon Web Services (AWS), Microsoft Azure, and Google Cloud Platform (GCP). You will learn how to automate the preparation and configuration of cloud resources using Infrastructure-as-Code (IaC) solutions and strategies. You will have the opportunity to harness the potential of generative AI tools to significantly accelerate the process of building and automating vulnerable-by-design lab environments. In addition to these, you will learn how to use various offensive security tools and techniques to validate and test the vulnerabilities and misconfigurations in our cloud-based labs.

By the end of this book, you should be able to build and automate various types of penetration testing labs in multiple cloud platforms where you can practice and experiment with different types of attacks and techniques.

Who this book is for

This book is intended for security engineers, cloud engineers, and aspiring security professionals who want to learn more about penetration testing, cloud security, and infrastructure automation. It highlights the use of Infrastructure-as-Code solutions, along with Generative AI tools, to accelerate the preparation of vulnerable-by-design lab environments on AWS, Azure, and GCP. If you are planning to advance your career in cloud security and you want to learn how to manage the complexity, costs, and risks associated with building and managing hacking lab environments in the cloud, then this book is for you.

What this book covers

Chapter 1, Getting Started with Penetration Testing Labs in the Cloud, introduces the key concepts to help you get started with building penetration testing labs in the cloud. In this chapter, we will also examine the considerations and risks involved when building these vulnerable-by-design labs in the cloud.

Chapter 2, Preparing Our First Vulnerable Cloud Lab Environment, allows you to get your feet wet by setting up and configuring your first vulnerable lab environment in the cloud.

Chapter 3, Succeeding with Infrastructure-as-Code Tools and Strategies, details how you can use IaC solutions to build your penetration testing lab environments automatically.

Chapter 4, Setting Up Isolated Penetration Testing Lab Environments on GCP, shows you how to isolate and protect vulnerable lab resources from unauthorized external attacks using a properly configured network environment. Inside this secure network environment, we will set up a target VM instance that hosts an intentionally vulnerable web application called the OWASP Juice Shop. In addition to this, we will launch an attacker VM instance and configure it with browser-based access to its desktop environment.

Chapter 5, Setting Up Isolated Penetration Testing Lab Environments on Azure, presents how to set up and automate an isolated penetration testing lab environment on Azure. In this chapter, we will build a lab where we can practice container breakout techniques to gain unauthorized access to the host system. In addition to this, we will look at how managed identities in Azure can be abused to gain unauthorized access to other cloud resources.

Chapter 6, Setting Up Isolated Penetration Testing Lab Environments on AWS, focuses on how to build and automate the preparation of an isolated penetration testing lab environment on AWS. In this chapter, we will prepare a lab setup where we can practice pivoting techniques that can be used to access internal systems and networks using the initially compromised machine.

Chapter 7, Designing and Building an IAM Privilege Escalation Lab, demonstrates how to set up a vulnerable lab environment for IAM privilege escalation on AWS. In this chapter, we also have our first look into how we can use generative AI solutions to generate code for use in penetration testing simulations.

Chapter 8, Designing and Building a Vulnerable Active Directory Lab, focuses on how to set up a vulnerable Active Directory lab on Azure. Here, we’ll also learn how to use various tools such as Kerbrute, Impacket, and John the Ripper to validate and assess whether the penetration testing lab environment has been set up and (mis)configured correctly.

Chapter 9, Recommended Strategies and Best Practices, presents the best practices and techniques for improving and enhancing the lab environments discussed in the previous chapters. In this chapter, we’ll also dive a bit deeper into how we can use generative AI tools for IaC template code creation, infrastructure cost estimation, and automation script development.

To get the most out of this book

You will need an AWS account, a Microsoft Azure account, a GCP account, and a ChatGPT (i.e., OpenAI) account, along with a stable internet connection to complete the hands-on solutions in this book.

Software/hardware covered in the book

Operating system requirements

Chrome/Firefox/Safari/Edge/Opera (or another alternative)

Windows/macOS/Linux

If you are using the digital version of this book, we advise you to type the code yourself or access the code from the book’s GitHub repository (a link is available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.

Download the example code files

You can download the example code files for this book from GitHub at https://github.com/PacktPublishing/Building-and-Automating-Penetration-Testing-Labs-in-the-Cloud. If there’s an update to the code, it will be updated in the GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Conventions used

There are a number of text conventions used throughout this book.

Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “Make sure to replace <ATTACKER VM PUBLIC IP ADDRESS> with the attacker_vm_public_ip output value after running the terraform apply command in an earlier step.”

A block of code is set as follows:

module "attacker_vm" {
  source = "./attacker_vm"
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

module "attacker_vm" {
  source = "./attacker_vm"
  
  my_public_ssh_key = var.my_public_ssh_key
  source_image_id = var.kali_image_id
  rg_location = module.secure_network.rg_02_location
  rg_name = module.secure_network.rg_02_name
  subnet = module.secure_network.subnet_02
  asg = module.secure_network.asg_02
  nsg = module.secure_network.nsg_02
}

Bold: Indicates a new term, an important word, or words that you see onscreen. For instance, words in menus or dialog boxes appear in bold. Here is an example: “In the last tab (EC2 serial console), click the Connect button to access the instance via the EC2 serial console.”

Tips or important notes

Appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, email us at customercare@packtpub.com and mention the book title in the subject of your message.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata and fill in the form.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at copyright@packtpub.com with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Share Your Thoughts

Once you’ve read Building and Automating Penetration Testing Labs in the Cloud, we’d love to hear your thoughts! Please click here to go straight to the Amazon review page for this book and share your feedback.

Your review is important to us and the tech community and will help us make sure we’re delivering excellent quality content.

Download a free PDF copy of this book

Thanks for purchasing this book!

Do you like to read on the go but are unable to carry your print books everywhere?

Is your eBook purchase not compatible with the device of your choice?

Don’t worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.

Read anywhere, any place, on any device. Search, copy, and paste code from your favorite technical books directly into your application.

The perks don’t stop there, you can get exclusive access to discounts, newsletters, and great free content in your inbox daily

Follow these simple steps to get the benefits:

  1. Scan the QR code or visit the link below

https://packt.link/free-ebook/9781837632398

  1. Submit your proof of purchase
  2. That’s it! We’ll send your free PDF and other benefits to your email directly
lock icon
The rest of the chapter is locked
You have been reading a chapter from
Building and Automating Penetration Testing Labs in the Cloud
Published in: Oct 2023Publisher: PacktISBN-13: 9781837632398
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Author (1)

author image
Joshua Arvin Lat

Joshua Arvin Lat is the Chief Technology Officer (CTO) of NuWorks Interactive Labs, Inc. He previously served as the CTO for three Australian-owned companies and as director of software development and engineering for multiple e-commerce start-ups in the past. Years ago, he and his team won first place in a global cybersecurity competition with their published research paper. He is also an AWS Machine Learning Hero and has shared his knowledge at several international conferences, discussing practical strategies on machine learning, engineering, security, and management.
Read more about Joshua Arvin Lat