

# Troubleshooting penetration tests

Find solutions to commonly seen errors when you use AWS Continuum for penetration testing. For errors with permissions, see [Permissions for penetration testing](pt-security-iam.md). For client certificate errors, see [Troubleshooting client certificate errors](pt-creating-test.md#pt-creating-test-network-client-certs-errors).

## AWS Continuum cannot connect to the endpoint during a penetration test
<a name="pt-troubleshooting-connect"></a>

If AWS Continuum is unable to make calls to the configured target URL, or fails to navigate the target endpoint, check the following:
+ If your endpoint makes calls to domains outside the configured target URL, verify that you added the additional domains as additional allowed URLs in your penetration test configuration. For more information, see [Allowed and blocked URLs](pt-creating-test.md#pt-creating-test-network-scope).
+ If your application serves traffic on a non-standard port, include the port in the target URL, for example `https://example.com:8443`.
+ If you have a web application firewall (WAF) configured, check that your WAF isn't blocking penetration test traffic. You can allowlist penetration test traffic by the `User-Agent` header, which AWS Continuum sets to `securityagent` by default. For more information, see [Custom HTTP headers](pt-creating-test.md#pt-creating-test-network-headers).

## Endpoint validation failed during a penetration test
<a name="pt-troubleshooting-validation"></a>

A penetration test that fails during endpoint validation indicates that your endpoint isn't accessible from the penetration testing environment. The steps for debugging this issue depend on whether you configured a VPC for your penetration test:
+ For a penetration test without a VPC:
  + Ensure that the target endpoint has a public DNS record that resolves to a publicly accessible IP address.
  + Verify that your target endpoint can be reached without special networking requirements. Common blockers are a specific VPN that is required to reach the endpoint, or a WAF that blocks public internet traffic.
  + Attempt to reach the target endpoint by using `curl` or a browser, and verify that you receive a valid response.
+ For a penetration test with a VPC:
  + Ensure that the selected VPC and subnet have proper routing to the target endpoint (for example, through a VPN tunnel or VPC peering), that DNS resolution is correctly configured for the private domain (for example, with Route 53 Resolver or custom DNS), and that security group rules allow outbound traffic to the target.
  + To debug further, launch an Amazon EC2 instance in your account with the same VPC, subnet, and security group as your penetration test. Connect to the instance, and verify that networking requests to your target endpoint succeed.

Endpoint validation can also fail for the following reasons. The failure message names the reason:
+ The target blocked the request as automated traffic. Allowlist the penetration test user agent or source at your bot protection or WAF, and then try again.
+ The target rate limited the request (HTTP 429). Relax rate limiting for the penetration test source, and then try again.
+ The target returned a 5xx server error. Confirm that the target is healthy and reachable from the penetration test source. A WAF, CDN, or proxy in front of the target might have rejected the request.
+ A certificate couldn't be loaded. Check that a trusted CA certificate is a PEM-encoded X.509 certificate, and that a client certificate and its key are valid. For more information, see [Trusted CA certificates](pt-creating-test.md#pt-creating-test-network-ca).

## A penetration test failed because of an IP allowlist
<a name="pt-troubleshooting-allowlist"></a>

If the endpoint that a penetration test targets has an IP allowlist enabled, you can add a private VPC configuration with an associated NAT gateway to your penetration test. You can then use the NAT gateway IP address to allowlist outbound traffic from the penetration test. For more information, see [VPC resources](pt-creating-test.md#pt-creating-test-vpc).

## Penetration test sign-in blocked by an identity provider
<a name="pt-troubleshooting-idp"></a>

A penetration test might report a sign-in failure for an application that delegates sign-in to a third-party identity provider. The provider might have blocked the browser of AWS Continuum instead of rejecting the credentials. Providers that apply anti-automation controls can refuse an automated browser before they evaluate the credentials. They usually report that the browser or app isn't secure.

To resolve this, provide a credential that AWS Continuum can replay, rather than one that it has to earn by completing the sign-in flow of the provider. For longer tests, prefer a Lambda function, because it can return a fresh session for each run.

1. Sign in yourself and capture the resulting session cookie or bearer token.

1. Store it in AWS Secrets Manager, or return it from a Lambda function. For more information, see [Selecting a static credential from AWS Secrets Manager](pt-test-credentials.md#pt-test-credentials-secrets-manager).

1. Select it as the credential for the penetration test.

1. Use the usage instructions of the credential to state how to apply it, for example which header to set on each request.

1. Keep the session valid for the duration of the test.

If the application offers one, you can also point AWS Continuum at a sign-in path that isn't delegated to the provider, such as a local test account or an API key.

## Getting additional help
<a name="pt-troubleshooting-help"></a>

If you continue to experience issues after you try these troubleshooting steps, contact AWS Support for assistance with complex configuration issues.