AWS Bedrock AgentCore with Public Network Browser or Code Interpreter Sandbox

Detects the successful creation of an Amazon Bedrock AgentCore Browser or Code Interpreter with an execution IAM role and public network access. These sandboxes run agent-generated code or automated browsing on the caller's behalf, and the attached role lets the sandbox call other AWS services. Public network mode removes the sandbox's network containment, so a sandbox steered by prompt injection, malicious tool output, or code-execution abuse can reach the internet and pivot into other AWS resources with the role's permissions. Review the role scope and whether public egress is required.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2026/10/07"
  3integration = ["aws"]
  4maturity = "production"
  5updated_date = "2026/10/07"
  6
  7[rule]
  8author = ["Elastic"]
  9description = """
 10Detects the successful creation of an Amazon Bedrock AgentCore Browser or Code Interpreter with an execution IAM role
 11and public network access. These sandboxes run agent-generated code or automated browsing on the caller's behalf, and
 12the attached role lets the sandbox call other AWS services. Public network mode removes the sandbox's network
 13containment, so a sandbox steered by prompt injection, malicious tool output, or code-execution abuse can reach the
 14internet and pivot into other AWS resources with the role's permissions. Review the role scope and whether public
 15egress is required.
 16"""
 17false_positives = [
 18    """
 19    Approved AgentCore Browsers or Code Interpreters that require public egress, such as a code interpreter installing
 20    packages or a browser tool reaching external sites, created by a known platform or CI/CD principal. Validate the
 21    caller, the attached execution role, and whether VPC or sandbox network mode was required by policy.
 22    """,
 23]
 24from = "now-9m"
 25index = ["logs-aws.cloudtrail-*"]
 26language = "kuery"
 27license = "Elastic License v2"
 28name = "AWS Bedrock AgentCore with Public Network Browser or Code Interpreter Sandbox"
 29note = """## Triage and analysis
 30
 31### Investigating AWS Bedrock AgentCore with Public Network Browser or Code Interpreter Sandbox
 32
 33Amazon Bedrock AgentCore Code Interpreter and Browser sandboxes act for the caller. The Code Interpreter executes agent-generated code, and the Browser drives automated web sessions. Either can be created with an IAM execution role (`executionRoleArn`) that the sandbox assumes when it calls other AWS services. Setting `networkMode=PUBLIC` removes network-level containment. A sandbox then compromised through prompt injection, malicious tool output, or code-execution abuse can reach the public internet and pivot into other AWS resources using that role. Researchers have also shown paths for stealing the role's temporary credentials from a Code Interpreter and reusing them outside the sandbox.
 34
 35`CreateBrowser` and `CreateCodeInterpreter` are management-plane events logged to CloudTrail by default. Later `StartBrowserSession` and `StartCodeInterpreterSession` calls are data-plane events and are not in a default management-events trail.
 36
 37### Possible investigation steps
 38
 39- Check the caller identity (`aws.cloudtrail.user_identity.arn`) and `source.ip` against expected provisioning principals. Unexpected users, roles, or source addresses creating a public AgentCore Browser or Code Interpreter should be investigated.
 40- Examine `aws.cloudtrail.request_parameters` for `executionRoleArn` and `networkMode=PUBLIC`. Treat the role as the permissions a compromised sandbox would inherit: list the AWS services it can call, and decide whether public egress is required or whether VPC or sandbox network mode would keep the workload contained.
 41- Review the IAM PassRole permission of the calling identity and whether it is constrained by `iam:PassedToService` conditions.
 42- Check for a subsequent `StartBrowserSession` or `StartCodeInterpreterSession` from the same caller against the new resource. Those events require data-plane logging.
 43- Pivot on the execution role for later AWS API calls from outside AgentCore, which can indicate the role's credentials were used beyond the workload.
 44
 45### False positive analysis
 46
 47- Platform engineering or infrastructure-as-code pipelines that intentionally create a public Browser or Code Interpreter with a scoped execution role. Confirm the principal, role, and network mode match the approved design.
 48- Workloads that must reach the public internet. Prefer VPC network mode with explicit egress where isolation is required.
 49
 50### Response and remediation
 51
 52- If the configuration is not approved, delete the Browser or Code Interpreter to stop new sessions and revoke active sessions of the execution role. Assume a public sandbox may already have been steered by untrusted prompts, tool output, or executed code.
 53- Replace public network mode with a VPC whose routing and egress controls explicitly block outbound internet access, or use sandbox mode where supported, and reduce the execution role to the minimum AWS API permissions the workload needs.
 54- Constrain `iam:PassRole` for AgentCore creators with `iam:PassedToService` and a permissions boundary on roles that can be passed.
 55- Enable data-plane logging for `bedrock-agentcore` so later session starts are visible.
 56"""
 57references = [
 58    "https://www.beyondtrust.com/blog/entry/aws-agentcore-privilege-escalation",
 59    "https://unit42.paloaltonetworks.com/bypass-of-aws-sandbox-network-isolation-mode/",
 60    "https://sonraisecurity.com/blog/sandboxed-to-compromised-new-research-exposes-credential-exfiltration-paths-in-aws-code-interpreters/",
 61]
 62risk_score = 73
 63rule_id = "86be0b1b-3984-4b26-bde6-46d33fe7bab1"
 64severity = "high"
 65tags = [
 66    "Domain: Cloud",
 67    "Data Source: AWS",
 68    "Data Source: Amazon Web Services",
 69    "Platform: AWS",
 70    "Data Source: AWS CloudTrail",
 71    "Service: AWS Bedrock",
 72    "Service: AWS IAM",
 73    "Use Case: Threat Detection",
 74    "Tactic: Privilege Escalation",
 75    "Tactic: Persistence",
 76    "Rule Type: Custom Query (KQL)",
 77    "Resources: Investigation Guide",
 78    "Domain: GenAI",
 79    "Mitre Atlas: AML.T0012",
 80    "Mitre Atlas: AML.T0103",
 81]
 82timestamp_override = "event.ingested"
 83type = "query"
 84
 85query = '''
 86event.dataset: "aws.cloudtrail" and
 87  event.provider: "bedrock-agentcore.amazonaws.com" and
 88  event.action: (
 89    "CreateCodeInterpreter" or
 90    "CreateBrowser"
 91  ) and
 92  event.outcome: "success" and
 93  aws.cloudtrail.flattened.request_parameters.networkConfiguration.networkMode: "PUBLIC" and
 94  aws.cloudtrail.flattened.request_parameters.executionRoleArn: *
 95'''
 96
 97
 98[[rule.threat]]
 99framework = "MITRE ATT&CK"
100[[rule.threat.technique]]
101id = "T1078"
102name = "Valid Accounts"
103reference = "https://attack.mitre.org/techniques/T1078/"
104[[rule.threat.technique.subtechnique]]
105id = "T1078.004"
106name = "Cloud Accounts"
107reference = "https://attack.mitre.org/techniques/T1078/004/"
108
109
110
111[rule.threat.tactic]
112id = "TA0004"
113name = "Privilege Escalation"
114reference = "https://attack.mitre.org/tactics/TA0004/"
115[[rule.threat]]
116framework = "MITRE ATT&CK"
117[[rule.threat.technique]]
118id = "T1098"
119name = "Account Manipulation"
120reference = "https://attack.mitre.org/techniques/T1098/"
121
122
123[rule.threat.tactic]
124id = "TA0003"
125name = "Persistence"
126reference = "https://attack.mitre.org/tactics/TA0003/"
127[[rule.threat_mappings]]
128framework = "MITRE ATLAS"
129version = "2026.08"
130[[rule.threat_mappings.threat]]
131framework = "MITRE ATLAS"
132[[rule.threat_mappings.threat.technique]]
133id = "AML.T0103"
134name = "Deploy AI Agent"
135reference = "https://atlas.mitre.org/techniques/AML.T0103/"
136
137
138[rule.threat_mappings.threat.tactic]
139id = "AML.TA0005"
140name = "Execution"
141reference = "https://atlas.mitre.org/tactics/AML.TA0005/"
142[[rule.threat_mappings.threat]]
143framework = "MITRE ATLAS"
144[[rule.threat_mappings.threat.technique]]
145id = "AML.T0012"
146name = "Valid Accounts"
147reference = "https://atlas.mitre.org/techniques/AML.T0012/"
148
149
150[rule.threat_mappings.threat.tactic]
151id = "AML.TA0012"
152name = "Privilege Escalation"
153reference = "https://atlas.mitre.org/tactics/AML.TA0012/"
154
155[rule.investigation_fields]
156field_names = [
157    "@timestamp",
158    "user.name",
159    "user_agent.original",
160    "source.ip",
161    "aws.cloudtrail.user_identity.arn",
162    "aws.cloudtrail.user_identity.type",
163    "aws.cloudtrail.user_identity.access_key_id",
164    "event.action",
165    "event.provider",
166    "event.outcome",
167    "cloud.account.id",
168    "cloud.region",
169    "aws.cloudtrail.request_parameters",
170    "aws.cloudtrail.flattened.request_parameters.executionRoleArn",
171    "aws.cloudtrail.flattened.request_parameters.networkConfiguration.networkMode",
172    "aws.cloudtrail.response_elements",
173]

Triage and analysis

Investigating AWS Bedrock AgentCore with Public Network Browser or Code Interpreter Sandbox

Amazon Bedrock AgentCore Code Interpreter and Browser sandboxes act for the caller. The Code Interpreter executes agent-generated code, and the Browser drives automated web sessions. Either can be created with an IAM execution role (executionRoleArn) that the sandbox assumes when it calls other AWS services. Setting networkMode=PUBLIC removes network-level containment. A sandbox then compromised through prompt injection, malicious tool output, or code-execution abuse can reach the public internet and pivot into other AWS resources using that role. Researchers have also shown paths for stealing the role's temporary credentials from a Code Interpreter and reusing them outside the sandbox.

CreateBrowser and CreateCodeInterpreter are management-plane events logged to CloudTrail by default. Later StartBrowserSession and StartCodeInterpreterSession calls are data-plane events and are not in a default management-events trail.

Possible investigation steps

  • Check the caller identity (aws.cloudtrail.user_identity.arn) and source.ip against expected provisioning principals. Unexpected users, roles, or source addresses creating a public AgentCore Browser or Code Interpreter should be investigated.
  • Examine aws.cloudtrail.request_parameters for executionRoleArn and networkMode=PUBLIC. Treat the role as the permissions a compromised sandbox would inherit: list the AWS services it can call, and decide whether public egress is required or whether VPC or sandbox network mode would keep the workload contained.
  • Review the IAM PassRole permission of the calling identity and whether it is constrained by iam:PassedToService conditions.
  • Check for a subsequent StartBrowserSession or StartCodeInterpreterSession from the same caller against the new resource. Those events require data-plane logging.
  • Pivot on the execution role for later AWS API calls from outside AgentCore, which can indicate the role's credentials were used beyond the workload.

False positive analysis

  • Platform engineering or infrastructure-as-code pipelines that intentionally create a public Browser or Code Interpreter with a scoped execution role. Confirm the principal, role, and network mode match the approved design.
  • Workloads that must reach the public internet. Prefer VPC network mode with explicit egress where isolation is required.

Response and remediation

  • If the configuration is not approved, delete the Browser or Code Interpreter to stop new sessions and revoke active sessions of the execution role. Assume a public sandbox may already have been steered by untrusted prompts, tool output, or executed code.
  • Replace public network mode with a VPC whose routing and egress controls explicitly block outbound internet access, or use sandbox mode where supported, and reduce the execution role to the minimum AWS API permissions the workload needs.
  • Constrain iam:PassRole for AgentCore creators with iam:PassedToService and a permissions boundary on roles that can be passed.
  • Enable data-plane logging for bedrock-agentcore so later session starts are visible.

References

Related rules

to-top