Code Velocity
AI Security

AI Agent Domain Control: Securing Web Access with AWS Network Firewall

·7 min read·AWS·Original source
Share
Diagram showing AWS Network Firewall controlling AI agent web access with domain filtering in an Amazon VPC environment.

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:

ComponentFunctionSecurity Benefit
Private SubnetHosts AgentCore Browser instances, no direct public IP addresses.Isolates agents from public internet, reducing exposure.
Public SubnetContains NAT Gateway for outbound connectivity.Enables outbound access without exposing agent instances directly.
Firewall SubnetDedicated subnet for the Network Firewall endpoint.Centralizes traffic inspection, enforces security policies.
AWS Network FirewallInspects TLS SNI headers, applies filtering rules, logs traffic.Domain-based egress control, botnet/malware protection, audit trails.
Route TablesDirects traffic flow through the firewall.Ensures all outbound and return traffic traverses the firewall.

The Traffic Flow Explained:

  1. An AI agent running in Amazon Bedrock AgentCore invokes the AgentCore Browser tool.
  2. The AgentCore Browser initiates an HTTPS request from its private subnet.
  3. The private subnet's route table directs this traffic towards a NAT Gateway in the public subnet.
  4. The NAT Gateway translates the private IP and forwards the request to the Network Firewall endpoint.
  5. AWS Network Firewall intercepts the traffic and inspects the TLS SNI header to determine the intended destination domain.
  6. If the domain matches an 'allowlist' rule configured in the firewall, the traffic is forwarded to the Internet Gateway.
  7. The Internet Gateway then routes the approved traffic to the external web destination.
  8. 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.

Frequently Asked Questions

Why is domain-level control essential for AI agents browsing the internet?
AI agents with internet access offer powerful capabilities but also introduce significant security risks. Unrestricted web access can lead to unintended data exfiltration to unauthorized domains, exposure to malicious content, or exploitation through prompt injection attacks that trick agents into navigating to harmful sites. Domain-level control, specifically allowlisting, ensures that agents can only access pre-approved websites, drastically reducing the attack surface. This is critical for maintaining data privacy, adhering to regulatory compliance standards, and safeguarding sensitive enterprise information, especially in regulated industries where strict network egress policies are mandatory.
How does AWS Network Firewall enhance the security posture of AI agents using Amazon Bedrock AgentCore?
AWS Network Firewall acts as a crucial layer of defense for AI agents deployed via Amazon Bedrock AgentCore. By routing all outbound traffic from AgentCore Browser through the firewall, organizations can implement granular domain-based filtering rules. The firewall inspects TLS Server Name Indication (SNI) headers to identify destination domains and applies allowlist or denylist policies. This ensures that agents only connect to approved external resources, logs all connection attempts for auditing, and can block access to known malicious domains or undesirable categories, thereby bolstering the overall security and compliance of AI agent operations.
What are the primary challenges addressed by implementing domain-based egress filtering for AI agents?
Domain-based egress filtering addresses several critical challenges for AI agent deployments. Firstly, it mitigates the risk of data exfiltration and unauthorized access by ensuring agents only interact with trusted domains. Secondly, it helps prevent prompt injection attacks, where malicious prompts could instruct an agent to visit harmful or unintended sites, by enforcing an allowlist of approved URLs. Thirdly, it meets stringent enterprise security and compliance requirements, particularly in regulated sectors, by providing transparent control and auditability of agent network interactions. Finally, for multi-tenant SaaS providers, it allows for customized, per-customer network policies, enabling specific domain restrictions based on individual client needs.
Can SNI-based domain filtering completely prevent all unauthorized connections by AI agents, and if not, what are the limitations?
While SNI-based domain filtering is highly effective for controlling web access at the TLS layer, it does have a limitation: it relies on the Server Name Indication field during the TLS handshake. An advanced attacker or a sophisticated agent could potentially resolve a blocked domain's IP address through an uninspected DNS query and attempt to connect directly via IP, bypassing SNI inspection. To address this, a defense-in-depth strategy is recommended. This involves pairing SNI filtering with DNS-level controls, such as Amazon Route 53 Resolver DNS Firewall, which can block DNS queries for unauthorized domains and prevent DNS tunneling, ensuring comprehensive egress control.
What is the typical traffic flow for an AI agent's web request when using AWS Network Firewall for domain control?
When an AI agent within Amazon Bedrock AgentCore initiates a web request, the traffic flow is meticulously controlled. First, the AgentCore Browser, residing in a private subnet, attempts to establish an HTTPS connection. This request is routed to a NAT Gateway in a public subnet, which then forwards it to the Network Firewall endpoint. The AWS Network Firewall inspects the TLS SNI header to identify the target domain. If the domain is on the allowlist, the firewall permits the traffic to pass to an Internet Gateway, which then routes it to the external destination. All return traffic follows a symmetric path back through the firewall, ensuring continuous inspection and adherence to security policies.

Stay Updated

Get the latest AI news delivered to your inbox.

Share