
Best practices for configuring a penetration test with AWS Security Agent (now part of AWS Continuum)
This tutorial shows you how to configure an AWS Security Agent penetration test so your first run produces deep, validated findings.
AWS Security Agent is a frontier agent that proactively secures your applications throughout the development lifecycle across all your environments. It performs on-demand penetration testing customized to your application, discovering and reporting verified security risks. After a test is complete, each finding can generate remediation code to help you secure your applications quickly.
Prerequisites
Before you begin, make sure that you have the following:
- An Agent Space for the application you want to test.
- A validated domain for the application you want to test.
Selecting your first application
When thinking about your first application to test, consider the following:
- A non-production environment
- Access to the source code
- One or more user credentials for the application
- (Optional) A public facing application
Configure your penetration test
The following steps will focus on the penetration test settings. You can follow the Quickstart: Run a Continuum penetration test steps in the AWS Security Agent (part of AWS Continuum) user guide to get started.
Penetration test details
The Target URLs are the URLs for your application that you want to test. If you have a related API that is on a different domain, you should enter it here as well.

By default, Security Agent can only access the Target URL. Everything else is blocked by a firewall. If you have other URLs that need to be reachable, you should add them as accessible URLS.
You can use the Security Agent recorder browser extension to automatically capture unique domains your application communicates with.

For example if your application authenticates through Amazon Cognito, Auth0, Okta, or another hosted login page, you should enter that URL as an accessible URL.
You should also enter any Content Delivery Networks (CDNs), or third-party domains. You only need to add the base URL. You don't need to include the full path.

Out-of-scope URLs let you exclude paths that would otherwise be included because they are added as a target URL or accessible URL.
For example if your application has a part of the code that is known to cause issues, you should enter that as an out-of-scope URL.
You should also enter any password reset or account mutation paths to prevent Security Agent from changing your test user credentials.

Custom HTTP headers let you deterministically set headers on all outbound network requests. This is most commonly used when creating a rule for your web application firewall or similar security technology. You can create a custom header, then add a matching rule to allow all the traffic.
For example you can override the default user-agent header with a custom value.

VPC Resources
You can choose to configure a VPC resource in your penetration test configuration. When you select a VPC resource, Security Agent adds an Elastic network interface (ENI) with a private address in the subnet you configure with the security group you select. All penetration test traffic uses this ENI. The traffic will follow the routing rules in your subnet out to the internet (typically a NAT GW). All traffic from Security Agent will come from the Elastic IP of the NAT GW.
- If your application is publicly accessible, you can skip this step.
- If your application is only reachable from a private subnet, you must configure this step.
For example if your application is in a private subnet, or on premise configure the VPC to choose a subnet that can resolve and reach your target URL.
If your application restricts access based on IP allow-list rules, configure the VPC and allow-list the Elastic IP of the NAT GW.

Authentication Resources
You can provide one or more credentials to Security Agent. This allows Security Agent to explore your application more deeply. Most applications have several roles. One set of credentials may log into the application as a user, while another set of credentials may log in as an administrator.

If you provide multiple credentials, Security Agent can reason with them and is more likely to identify privilege escalation and insecure direct object reference (IDOR) findings.

You can leave the Agent Space login prompt - optional as the default. This default prompt works for most applications.
Additional configuration
Security Agent can use the context of your code base to improve the quality of the penetration test. You should configure the penetration test to use the code base whenever possible. If you are not able to connect an integration , you can zip your source code and reference it from S3.
You can optionally enable automatic code remediation. This will create pull requests for each finding. You can leave this off and optionally select an individual finding to create code remediation in the penetration test findings view.

Create a rule in web application firewall (WAF) to allow Security Agent traffic
During a penetration test you want to test the security of your application, not how effective your WAF is.
Create a rule in WAF that matches the custom HTTP header. For example if you set your user-agent to jkrspkc1example, create a rule that matches that traffic. Move the rule to the top of the order so it has priority over any blocks.
- Navigate to the WAF console.
- Choose Rules
- Choose Add rule
- Choose Custom rule
- Choose Custom rule again
- Enter the following:
- For Action choose Allow
- For Rule name enter allow_security_agent_traffic
- For Inspect choose Single header
- For Header field name enter user-agent
- For String to match enter jkrspkc1example
- Choose Add rule
- Choose Edit rule order
- Move allow_security_agent_traffic to the top.
- Choose Save rule order

If you selected a VPC during the penetration test configuration, you can add an IP based rule that matches the IP your traffic egress on. This is usually the Elastic IP of your NAT GW. Follow the steps previously describe and choose an IP-based rule instead of a custom rule.
Conclusion
In this tutorial, you learned how to configure a penetration test for AWS Security Agent following best practices. By configuring your penetration test to include all the accessible URLs, credentials, and source code as a learning resource you will get better, higher quality findings.
New AWS Security Agent customers receive a free trial. For more information, visit the AWS Security Agent pricing page.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article