

# Getting started with penetration testing

**Note**  
This guide covers Continuum for penetration testing, which you use in the AWS Continuum console. If you run penetration tests in the AWS Security Agent console or web application, see the [AWS Security Agent User Guide](https://docs.aws.amazon.com/securityagent/latest/userguide/what-is.html) instead. For the differences, see [Comparing Continuum for penetration testing and AWS Security Agent](pt-security-agent-comparison.md).

To start using AWS Continuum for penetration testing, you create an environment. An environment groups the target domains, AWS resources, and access settings that you use to test one application.

## Prerequisites
<a name="pt-getting-started-prerequisites"></a>

Before you begin, make sure that you have the following:
+ Permissions to create AWS Identity and Access Management (IAM) roles in your AWS account
+ A domain that you own, where you can add a DNS record or host a file
+ (White box tests) Source code or documents for your application. For code in GitHub or GitLab, create an integration for the source provider. You manage integrations in the navigation pane under **Shared resources**, **Integrations**. To create one, see [GitHub](integrations.md#integrations-github) or [GitLab](integrations.md#integrations-gitlab). For source archives, build artifacts, or application documents, use an Amazon S3 bucket.
+ (Optional) The virtual private cloud (VPC), subnets, and security groups that host your application, if the application isn't reachable from the internet

## Creating an environment
<a name="pt-getting-started-environment"></a>

Create an environment for each application that you want to test. When you finish, you have an environment with its own service role, ready for target domains and penetration tests. You can skip the optional pages and add those settings later.

If you already have an integration, you can also start from its details page. To do so, choose **Create environment for penetration testing**.

**To start creating an environment**

1. Open the AWS Continuum console at [https://console.aws.amazon.com/continuum/](https://console.aws.amazon.com/continuum/).

1. In the navigation pane, under **Penetration testing**, choose **Overview**.

1. Choose **Create Environment**.

The console guides you through the setup in steps. The test scope that you choose in the first step decides which of the other steps appear.

**To create and set up the environment**

1. On the **Test scope** page, choose what you want the agent to test. Then choose **Next**.
   + **Live endpoint, source code, and documentation** – A white-box test. AWS Continuum tests your live application with source code or internal documents. This option combines external and context-informed testing. It requires a verified target domain and source code or documents. The console marks this option **Recommended**.
   + **Live endpoint** – A black-box test. AWS Continuum tests your live application from the outside, without source code or internal documents. This option is closest to what an external attacker can reach. It requires a verified target domain.

   The console shows only the setup steps that apply to your choice. If you choose **Live endpoint**, the console omits the **Source code and documentation** step.

1. On the **Create Environment** page, for **Environment name**, enter a unique name of up to 255 characters. Then choose **Next**.

   When you choose **Next**, AWS Continuum creates the environment. The remaining pages appear under **Complete setup**.

   AWS Continuum encrypts the data of the environment with a key that AWS owns and manages for you. To change the service role, expand **Advanced**. The **Service role** is the IAM role that AWS Continuum uses to access resources in your account. Choose one of the following options:
   + **Create default role** – AWS Continuum creates the role and adds the necessary permissions policy. For **Service role name**, the console suggests a name that starts with `aws-continuum-pentest-`, followed by a timestamp. You can change the name. The name can have up to 64 alphanumeric characters and the characters `+=,.@-_`. It can't contain spaces, and it must be unique across all roles in the account.
   + **Use an existing service role** – Choose your own role. The role must already have the permissions listed after this procedure.

1. On the **Target domains** page, add and verify the domains that you want to test, or skip this step and add a domain later. Penetration tests run only against verified domains that you own. Then choose **Save and next**.

   To add a domain, choose **Add domain**. To manage the domains in the table, select a domain, and then choose **One-click verification**, **Verify**, **Update Domain**, **Remove Domain**, or **Manage tags**.

   If the domain is hosted in Amazon Route 53 in the same account, select the domain and choose **One-click verification**. The console creates and verifies the DNS record, and the **Status** column can show **Auto verified**. For a custom domain, copy the record name and verification token from the table, add them to your DNS provider, and then choose **Verify**. For details, see [Verifying target domains](pt-target-domains.md).

1. (White box only) On the **Source code and documentation** page, add the source code or documents that the agent can use while testing. Then continue to the next step.

   For details, see [Source code and documentation settings](#pt-getting-started-source).

1. (Optional) On the **Additional configuration** page, add the AWS resources that tests in this environment can use, for broader test coverage. Then choose **Save and next**.

   For details, see [Additional configuration settings](#pt-getting-started-resources).

1. On the **Review** page, review the saved environment configuration. **Test types** shows the type of test that the environment supports, such as **White box** with the status **Available**, and the table lists your target domains. Then choose **Complete setup**.

If you chose **Use an existing service role**, the role must already have the following:
+ A trust policy that the `pentesting.continuum.amazonaws.com` service principal uses to assume the role, limited by the `aws:SourceAccount` and `aws:SourceArn` conditions. The environment doesn't exist yet, so use `environments/*` in `aws:SourceArn`.
+ The base permissions policy. For the policy, see [Permissions policies](pt-security-iam.md#pt-security-iam-service-role-permissions).

When you choose resources on the **Source code and documentation** and **Additional configuration** pages, the console adds or updates the policies for those resources on the role. For more information about what the role must already have, see [Trust policy](pt-security-iam.md#pt-security-iam-service-role-trust) and [Permissions policies](pt-security-iam.md#pt-security-iam-service-role-permissions).

The environment appears on the **Overview** page.

## Source code and documentation settings
<a name="pt-getting-started-source"></a>

The **Source code and documentation** page appears only for white-box tests. It lets you add the source code and documents that the agent can use while testing. White-box tests need source code or documents. The page has the following parts:
+ **Connected integrations** – The GitHub and GitLab integrations that this environment has access to. Use **Settings** and **Add** to manage them. To create an integration, see [Integrations](integrations.md).
+ A section for each connected integration – The repositories of the integration that the environment uses.
+ **S3 buckets** – Buckets that hold source archives, build artifacts, or application documents.

### Repositories
<a name="pt-getting-started-source-repos"></a>

Each integration section lists its repositories in a table. The table has a **Repository** column and a **Code remediation** column. Use the buttons above the table, such as **Add** and **Remove selected resources**, to change the repositories. To search the table, use **Find resources**.

**To add repositories**

1. Under **Connected integrations**, check that the integration for your source provider is listed. If it isn't, choose **Add** to add it. To create an integration, see [GitHub](integrations.md#integrations-github) or [GitLab](integrations.md#integrations-gitlab).

1. In the section for the integration, choose **Add**, and then select the repositories that contain the application's code.

For more information about code remediation, see [Remediating a penetration test finding](pt-remediating-findings.md).

### Amazon S3 buckets
<a name="pt-getting-started-source-s3"></a>

Choose Amazon S3 buckets if you plan to provide source archives, build artifacts, or application documents as input to AWS Continuum.

**To add S3 buckets**
+ On the **Source code and documentation** page, under **S3 buckets**, add your Amazon S3 bucket.

Make sure that the service role has permissions to read the bucket. For the policy, see [Permissions policies](pt-security-iam.md#pt-security-iam-service-role-permissions).

**Note**  
You can also add GitHub or GitLab repositories, or upload files when you create a penetration test. The information that you provide helps AWS Continuum ensure thorough coverage, reduce false positives, and deliver actionable results. Amazon S3 integrations aren't used for penetration testing; add the bucket here instead.

## Additional configuration settings
<a name="pt-getting-started-resources"></a>

The **Additional configuration** page lets you add optional AWS resources for broader test coverage. All settings on this page are optional. The page groups the resources as follows. Choose a resource type to expand it.
+ **Reach the target** – The VPC, subnets, and security groups for an application endpoint that runs in a private network
+ **Store test logs** – Amazon CloudWatch Logs log groups where the agent stores logs from penetration tests
+ **Provide test credentials** – AWS Secrets Manager secrets and Lambda functions that hold sign-in credentials

Penetration tests in the environment can use only the resources that you choose here. The service role of the environment must have permissions for each resource. When you choose resource types on this page, the console adds or updates the policies for those resources on the role. For the policies, see [Permissions policies](pt-security-iam.md#pt-security-iam-service-role-permissions).

### Reach the target
<a name="pt-getting-started-resources-target"></a>

If your application endpoint runs in a private network, such as test domains hosted within a VPC, select the VPC, subnets, and security groups that the agent uses to reach it.

**To configure VPC settings**

1. Under **Reach the target**, expand **VPCs**, and choose the VPC that hosts your private target domains.

1. Choose the VPC subnets that AWS Continuum should use.
**Tip**  
For high availability, choose multiple subnets from multiple Availability Zones. Make sure that your subnets include a NAT gateway for outbound connectivity.

1. Choose the VPC security groups that AWS Continuum should use.
**Important**  
Make sure that your security groups allow outbound connections for AWS Continuum to perform penetration testing.

For each penetration test, you then choose the VPC, subnet, and security group to use. For more information, see [VPC resources](pt-creating-test.md#pt-creating-test-vpc).

### Store test logs
<a name="pt-getting-started-resources-logs"></a>

Choose where the agent stores logs from your penetration test runs. The agent writes to Amazon CloudWatch Logs log groups.

**To configure CloudWatch logging**
+ Under **Store test logs**, expand **CloudWatch logs**, and then choose an existing Amazon CloudWatch Logs log group.

If you don't choose a log group, AWS Continuum creates one when the test runs. The log group is named `aws-continuum/pentest/{{environment-id}}/{{pentest-id}}`.

**Note**  
Make sure that the service role has permissions to write to the log groups that you choose. For the policy, see [Permissions policies](pt-security-iam.md#pt-security-iam-service-role-permissions).

### Provide test credentials
<a name="pt-getting-started-resources-credentials"></a>

If your application requires authentication credentials for testing, AWS Continuum can securely retrieve them from AWS Secrets Manager secrets or Lambda functions. You can skip this group during setup. When you're ready, you can enter the credentials, and the console helps you store them securely in AWS Secrets Manager.

**To configure resources for test credentials**

1. Under **Provide test credentials**, expand **Secrets**, and then choose the AWS Secrets Manager secrets that contain credentials for your application.

1. Expand **Lambda functions**, and then choose the functions that can provide authentication credentials for your application. AWS Continuum invokes these functions during penetration tests to obtain credentials dynamically.

When you create a penetration test, you can reference these secrets and functions for authenticated testing. For details, including the format that a function returns, see [Providing test credentials for penetration testing](pt-test-credentials.md).

**Important**  
Make sure that the service role has permissions to read the secrets and invoke the functions. For the policies, see [Permissions policies](pt-security-iam.md#pt-security-iam-service-role-permissions).

## Checking that the environment is ready
<a name="pt-getting-started-readiness"></a>

Before you create a penetration test, confirm that the environment has what the test needs.

**To check the environment setup**

1. On the environment page, choose the **Overview** tab.

1. In **Penetration testing setup**, expand **View setup details**.

1. For each row that isn't configured, choose the link in the **Actions** column.

The setup table has the following rows:
+ **Service role** – Every test needs a service role.
+ **Target domains** – Every test needs at least one verified domain.
+ **Source repositories** – White-box tests need source code or documents.
+ **Network access (VPC)** – Only tests of private targets need VPC access.

When you configure the required rows, the setup shows that the environment is ready for black-box or white-box testing. The **Review** page of the setup also shows the test types that the environment supports.

## Cleaning up
<a name="pt-getting-started-clean-up"></a>

If you no longer need an environment, delete it. Target domains are shared, so deleting an environment doesn't delete them.

**Important**  
Deleting an environment also deletes its penetration tests, their runs, and their findings. You can't undo this action.

**To delete an environment**

1. In the navigation pane, under **Penetration testing**, choose **Overview**, and then choose the environment name.

1. Choose **Delete Environment**, and then confirm.

To delete a target domain, on the **Target Domains** page, select the domain and choose **Delete**.

## Next steps
<a name="pt-getting-started-next-steps"></a>
+ Verify your target domains. See [Verifying target domains](pt-target-domains.md).
+ Create and run your first penetration test. See [Creating a penetration test](pt-creating-test.md).
+ Review the findings of the run. A penetration test can take several hours to complete, depending on the size and complexity of your application. The run begins with a preflight phase that checks that your target endpoints are reachable before testing starts. If a preflight check fails, the run stops before testing begins. Open the **Preflight** tab to see which check failed, resolve it, and start a new run. See [Viewing penetration test findings](pt-viewing-findings.md) and [Troubleshooting penetration tests](pt-troubleshooting.md).