IaC Security - Lab Guide
IaC Security - Lab Guide
SECURITY
BOOTCAMP
Lab Introduction
Thank you for joining today’s Infrastructure as Code (IaC) camp. The lab will focus on the ways
that Prisma Cloud can help you secure IaC from the code to runtime.
Before we begin the lab let's start with a brief overview of the scenario to help frame the
context.
Scenario
The Exampli Corp, a mock corporation, product group is rushing to finish a banking app for
their customer Bank of Anthos in time for the holiday season when spending patterns spike.
Up against unrealistic deadlines the development and infrastructure teams are working
around the clock to get their app built, tested, and released to hit their deadlines.
Fortunately, Exampli Corp recently integrated Prisma Cloud into their development lifecycle
adopting shift left security from code to cloud. Once in production Exampli Corps operations
and security teams continue to leverage Prisma Cloud to monitor and protect runtime
resources, reduce the attack surface, and enforce least privilege.
Will The Exampli Corp team take the time to build a secure app? Or will the stress of
completing the Bank of Anthos app in time for the holiday season lead to mistakes?
Resources
Vulnerable IaC :
In this lab we leverage some intentionally vulnerable IaC. To learn more about the project and
its contributors visit the link below :
● https://github.com/bridgecrewio/terragoat
In this lab there is a mock banking application that is used as the application the Exampli Corp
development team is building. To learn more about the project and its contributors visit the link
below :
● https://github.com/GoogleCloudPlatform/bank-of-anthos
Fortunately, Prisma Cloud can be integrated into the development pipeline and tools
developers use to secure IaC. With Bridgecrew from Prisma Cloud you can begin leveraging
the open source tool Checkov for free.
In this exercise, we will take a look at some IaC templates within Exampli Corp’s repository.
3. Use the navigation pane on the left hand and click the blue arrow on the lower left
side of the UI to open up the navigation pane and move between the different
modules within Prisma Cloud.
6. Once you have selected the correct repository, filter by “High” severity and let's take a
look at some troubling misconfiguration found in /terraform/gcp
9. Reviewing the guidelines we can see the description of this misconfiguration, its
potential risk, and how to remediate at build time and runtime.
11. This misconfiguration makes the application vulnerable to attacks that could reveal
sensitive data such as user credentials and financial information. This error could lead
to big problems for the Bank of Anthos. By using Prisma Cloud code security, the
Exampli Corp security team can avoid costly mistakes and protect the integrity of the
application.
There are many other examples to explore in the Exampli repo, feel free to use the
filters and search bar to explore additional resources and findings.
1. Depending on the nature of a misconfiguration, Prisma Cloud can provide single click
remediation. This capability creates a pull request that is sent to the version control
system where the IaC template is stored.
2. This resource is a fully managed relational database service for MySQL, PostgreSQL
and SQL Server. It is recommended to enable SSL but we can see it is not configured
in this resource.
The Suppress and Fix capability requires increased RBAC capabilities and is not
available to read-only users
3. Pull requests have been created previously for various findings. To access the VCS
associated with this IaC resource click the git link. We can also see the developer who
committed the last change associated with this IaC resource.
5. To view the fix generated by Prisma Cloud let’s take a look at the pull requests tab at
the top of the github UI.
1. Clear out all of your filters and select “Secrets” under category. Now you can view any
exposed secrets in your repository. Let's take a look at /terraform/aws
2. Once you click on /terraform/aws you will see that there are several misconfigurations
that expose secrets. Take a closer look at the providers.tf template. Note that you may
have to search for the file if the filters don’t work due to concurrent users within the
lab. Here we can see a variety of issues with this terraform template. The first being
hard coded plain text secrets.
We recommend you protect access keys and keep them private. Specifically, do
not store hard coded keys and secrets in infrastructure such as code, or other
version-controlled configuration settings.
According to the 2022 Verizon Data Breach Report, stolen access credentials are
used in 80% of successful data breaches.
Fortunately, Prisma Cloud makes it easy for anyone to quickly determine how the
exposed secret can harm your organization and what steps must be taken. These
exposed AWS access credentials could let an attacker unauthorized access the
Exampli Corp AWS account.
1. Use the navigation pane on the left hand and click the blue arrow on the lower left
side of the UI to open up the navigation pane and move between the different
modules within Prisma Cloud.
2. Next, use the navigation pane to select the Code Security module and select Supply
Chain.
4. Next, take a deeper look at the gke.tf template. This gke.tf template defines the
Kubernetes deployment that Exampli is looking to push to production.
Feel free to test the filters on the left side of the UI and search bar at the top to quickly
locate templates.
Thankfully, Prisma Cloud allows the Exampli Co. security team to scan all their IaC and
remediate findings with single click Pull Requests to mitigate any vulnerabilities
found.
8. You can easily view the original scan by tabbing over and seeing where errors were
identified.
10. We have submitted a pull request in advance that can be viewed at the following link.
12. Feel free to explore other templates and PR’s that have been submitted.
In this section, you will explore some use cases for securing GKE resources and services.
1. Let’s start with taking a look at the Asset Inventory page to get an idea of the scale of
resources that are being monitored by this particular Prisma Cloud tenant.
2. Begin by using the navigation panel on the left hand side of the UI.
3. Ensure to use the filter and select GCP as the Cloud Type.
4. The Asset Inventory can be a helpful place to get a high level view on cloud assets
and their compliance with defined policies. Without constant visibility of what is being
deployed in your cloud footprint, you cannot begin to secure it.
6. We know the Exampli Corp team is using Kubernetes. Let’s investigate further by clicking
on the Google Kubernetes Engine.
8. Use the column on the left to quickly view Config and Alert information for this GKE
cluster.
10. Here we can see the raw configuration for this GKE cluster. Do you see anything that
might present risks?
14. Your screen should look similar to the screen capture below.
15. Here we see the bank-of-anthos resource is exposing east-west network traffic. If we
click on the Recommendation tab we can see the recommended steps to resolve this
issue.
17. In addition to the asset inventory and leading cloud management database Prisma
Cloud makes compliance incredibly easy. Let’s move on to the next exercise on
compliance..
With multiple upcoming compliance audits bearing down on Exampli’s CISO’s calendar it's
time to begin reporting on what is in a failed state and what needs to be done to get the
organization’s cloud footprint compliant.
1. Start by using the navigation bar and locate the Compliance module. Select
Overview.
3. This page provides a high level view of all the unique assets and their associated
adherence to various compliance frameworks and policies.
6. We can now see Exampli’s associated assets and their compliance posture. Looking at
the trend graph it is easy to see how Exampli Corp compliance has changed over time.
At the bottom of the UI you can see various fields within the table:
To view the associated policies with CIS click the value under the policies tab. Your
screen should look similar to the screen capture below :
9. To learn more about a particular policy in Prisma Cloud you can leverage the table at
the bottom of the UI and read the description to gain more context.
On this page administrators of Prisma Cloud can generate compliance reports that
provide a summary of the information that is presented in the Prisma Cloud UI. This
can be very helpful for sharing with auditors and leaders.
In this lab we covered various topics around IaC security and CSPM but there are
many additional features and capabilities within Prisma Cloud. Feel free to explore the
UI and investigate different asset types.
Live Workshops
DevSecTalks Podcast
Cloud DevSecOps
Learn More