Safeguarding AI Agents: Why Domain Control is Paramount
The advent of AI agents capable of browsing the web has ushered in a new era of possibilities, from automating research to real-time data gathering. These powerful tools promise to transform enterprise operations, but their ability to access the open internet also introduces significant security and compliance challenges. Unrestricted internet access for an AI agent is akin to giving an employee a company credit card with no spending limits – the potential for misuse, accidental data exposure, or malicious exploitation is immense. Questions inevitably arise: What if the agent accesses unauthorized websites? Could sensitive data be exfiltrated to external domains?
Code Velocity is at the forefront of exploring these critical issues, and today we delve into a robust solution offered by AWS to address these concerns head-on. By leveraging Amazon Bedrock AgentCore alongside AWS Network Firewall, organizations can implement stringent domain-based filtering, ensuring AI agents interact only with approved web resources. This approach is not merely a best practice; it's a fundamental requirement for deploying AI agents responsibly in any enterprise setting.
Addressing Enterprise Security Requirements with AI Agent Egress Control
For organizations, particularly those in regulated industries, the deployment of AI agents comes with a rigorous set of security demands. Network isolation and egress control are consistently highlighted during security reviews, requiring detailed explanations of how agent traffic is managed and audited. The need for assurances that agent runtime endpoints remain private and that robust security controls like web application firewalls are in place is non-negotiable.
Key Enterprise Requirements Addressed:
- Regulated Industries: Customers in finance, healthcare, and government demand proof that AI agent operations comply with stringent data governance and privacy regulations. Unauthorized domain access can lead to severe compliance breaches.
- Multi-tenant SaaS Providers: For SaaS companies building AI agent capabilities, per-customer network policies are essential. Customer A might require access to specific domains that Customer B explicitly blocks. This necessitates granular control, including execution-specific blocking, regional restrictions, and category-based rules (e.g., disabling gambling or social media sites).
- Security Vulnerability Mitigation: A growing concern is the susceptibility of AI agents to prompt injection attacks. Malicious prompts can trick agents into navigating to unintended or harmful sites. Custom URL allowlists drastically reduce this attack surface, ensuring agents remain within approved boundaries, regardless of manipulated instructions. This directly relates to the broader discussion on designing-agents-to-resist-prompt-injection.
- Compliance Audit Requirements: Security teams need visibility and audit trails for all agent network interactions. Domain-based egress filtering provides comprehensive logging and access control visibility, crucial for security monitoring and audit processes.
Architecture Deep Dive: Securing AgentCore with AWS Network Firewall
The solution involves deploying AgentCore Browser within a private subnet, isolated from direct internet access. All outbound traffic from the AI agent is then meticulously routed through an AWS Network Firewall. This firewall acts as the central inspection point, scrutinizing TLS Server Name Indication (SNI) headers to identify the destination domain and enforce predefined filtering rules. The integration also allows for monitoring Network Firewall actions via Amazon CloudWatch metrics, providing valuable insights into traffic patterns and blocked attempts.
Solution Components:
| Component | Function | Security Benefit |
|---|---|---|
| Private Subnet | Hosts AgentCore Browser instances, no direct public IP addresses. | Isolates agents from public internet, reducing exposure. |
| Public Subnet | Contains NAT Gateway for outbound connectivity. | Enables outbound access without exposing agent instances directly. |
| Firewall Subnet | Dedicated subnet for the Network Firewall endpoint. | Centralizes traffic inspection, enforces security policies. |
| AWS Network Firewall | Inspects TLS SNI headers, applies filtering rules, logs traffic. | Domain-based egress control, botnet/malware protection, audit trails. |
| Route Tables | Directs traffic flow through the firewall. | Ensures all outbound and return traffic traverses the firewall. |
The Traffic Flow Explained:
- An AI agent running in Amazon Bedrock AgentCore invokes the AgentCore Browser tool.
- The AgentCore Browser initiates an HTTPS request from its private subnet.
- The private subnet's route table directs this traffic towards a NAT Gateway in the public subnet.
- The NAT Gateway translates the private IP and forwards the request to the Network Firewall endpoint.
- AWS Network Firewall intercepts the traffic and inspects the TLS SNI header to determine the intended destination domain.
- If the domain matches an 'allowlist' rule configured in the firewall, the traffic is forwarded to the Internet Gateway.
- The Internet Gateway then routes the approved traffic to the external web destination.
- Return traffic follows the symmetric path back through the firewall, ensuring continuous inspection and policy enforcement.
It's crucial to note that while SNI-based filtering is powerful for controlling which domains agents connect to at the TLS layer, it's part of a broader defense-in-depth strategy. For comprehensive DNS-level filtering and protection against DNS tunneling or exfiltration, this architecture can be complemented with Amazon Route 53 Resolver DNS Firewall.
Implementing Secure Domain Filtering for Your AI Agents
Setting up this robust security posture for your AI agents involves a few key steps, leveraging AWS's comprehensive infrastructure services.
Prerequisites for Implementation:
Before diving in, ensure you have:
- An active AWS account with permissions to create VPC resources, Network Firewall, and IAM roles.
- AWS Command Line Interface (AWS CLI) version 2.x configured with appropriate credentials.
- Access to Amazon Bedrock AgentCore within your AWS account.
- A foundational understanding of Amazon VPC networking concepts.
Step 1: Deploying Resources via CloudFormation
AWS provides a convenient CloudFormation template to streamline the deployment of the necessary VPC and Network Firewall components. This template sets up the private and public subnets, NAT Gateway, firewall subnet, and the core routing infrastructure. By utilizing this, you can quickly establish the foundational network environment required for secure agent operations.
Step 2: Reviewing the IAM Execution Role
For AgentCore Browser to function correctly and securely, it requires an IAM role with a specific trust policy. This policy permits the bedrock-agentcore.amazonaws.com service to assume the role, ensuring that the agent has the necessary permissions without over-privileging it.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "bedrock-agentcore.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
Step 3: Configuring the AWS Network Firewall Allowlist
The core of your domain control strategy lies in configuring a stateful rule group within AWS Network Firewall. This rule group defines your allowlist – the specific domains your AI agents are permitted to access. It's essential to include a leading dot (.) in your domain entries to match subdomains, ensuring comprehensive coverage.
For example, to allow access to Wikipedia and Stack Overflow, your rule configuration would look something like this:
{
"RulesSource": {
"RulesSourceList": {
"Targets": [
".wikipedia.org",
".stackoverflow.com"
],
"TargetType": "TLS_SNI",
"GeneratedRulesType": "ALLOWLIST"
}
}
}
This configuration ensures that only traffic destined for these explicitly allowed domains, including their subdomains, is permitted through the firewall. All other traffic can be implicitly denied by a default-deny policy.
Beyond SNI: A Defense-in-Depth Approach
While SNI-based filtering is powerful, a true zero-trust architecture for AI agents requires multiple layers of security. As mentioned, pairing AWS Network Firewall with Amazon Route 53 Resolver DNS Firewall adds another critical control point. This prevents agents from resolving blocked domains via DNS, effectively closing a potential bypass vector where an agent might attempt to connect directly to an IP address if the domain resolution isn't also controlled.
Furthermore, integrating other security services, such as AWS Web Application Firewall (WAF) for HTTP/S traffic inspection (if the traffic is eventually unencrypted for inspection at another layer) and identity-based access controls for agent invocation, solidifies your security posture. This multi-layered approach aligns with best practices for building a zero-trust architecture for confidential AI factories.
Conclusion: Empowering Secure AI Agent Deployment
The ability to control which domains your AI agents can access is not just a feature; it's a foundational security requirement for enterprise AI adoption. By implementing AWS Network Firewall with Amazon Bedrock AgentCore, organizations gain granular control over agent egress traffic, mitigate significant security risks like data exfiltration and prompt injection, and meet stringent compliance obligations.
As AI agents become more sophisticated and integrated into critical business processes, a robust security framework becomes indispensable. This solution provides a clear pathway for businesses to harness the power of AI agents while maintaining control, visibility, and an uncompromised security posture. Embracing such architectural patterns is key to operationalizing agentic AI part 1: a stakeholders guide and fostering a secure, innovative future.
Original source
https://aws.amazon.com/blogs/machine-learning/control-which-domains-your-ai-agents-can-access/Frequently Asked Questions
Why is domain-level control essential for AI agents browsing the internet?
How does AWS Network Firewall enhance the security posture of AI agents using Amazon Bedrock AgentCore?
What are the primary challenges addressed by implementing domain-based egress filtering for AI agents?
Can SNI-based domain filtering completely prevent all unauthorized connections by AI agents, and if not, what are the limitations?
What is the typical traffic flow for an AI agent's web request when using AWS Network Firewall for domain control?
Stay Updated
Get the latest AI news delivered to your inbox.
