Potential AWS Bedrock AgentCore Execution Role Credential Replay

Last updated 7 days ago on 2026-11-25
Created 7 days ago on 2026-11-25

About

Identifies a successful Amazon Bedrock AgentCore operation that can execute attacker-controlled content inside a microVM, followed by AWS API activity from the same source address under a different temporary access key and AssumedRole identity. This can indicate that the caller retrieved an AgentCore execution role's credentials and replayed them outside AgentCore. The correlation does not depend on execution-role naming and can provide coverage when command, code, or Browser automation content is obfuscated or unavailable.
Tags
Domain: CloudData Source: AWSData Source: AWS CloudTrailData Source: Amazon Web ServicesPlatform: AWSData Source: AWS BedrockData Source: Amazon BedrockService: AWS BedrockService: AWS IAMUse Case: Threat DetectionTactic: Privilege EscalationTactic: Credential AccessThreat: IMDS Credential TheftThreat: Unauthorized AI UsageRule Type: ES|QLDomain: GenAIMitre Atlas: AML.T0098Language: esql
Severity
high
Risk Score
73
MITRE ATT&CK™

Privilege Escalation (TA0004)(external, opens in a new tab or window)

Credential Access (TA0006)(external, opens in a new tab or window)

False Positive Examples
A shared NAT, proxy, or automation host may legitimately invoke AgentCore and use another IAM role during the same lookback window. Confirm whether the second role is attached to the target AgentCore resource and whether its AWS activity matches the intended workload. Narrow exclusions to approved source and role combinations.
License
Elastic License v2(external, opens in a new tab or window)

Definition

Integration Pack
Prebuilt Security Detection Rules
Related Integrations

aws(external, opens in a new tab or window)

Query
text code block:
from logs-aws.cloudtrail-* metadata _id, _version, _index | where data_stream.dataset == "aws.cloudtrail" and event.outcome == "success" and source.ip is not null and aws.cloudtrail.user_identity.access_key_id is not null and aws.cloudtrail.user_identity.arn is not null and ( ( event.provider == "bedrock-agentcore.amazonaws.com" and event.action in ( "InvokeAgentRuntimeCommand", "InvokeCodeInterpreter", "InvokeAgentRuntimeCommandShell", "ConnectBrowserAutomationStream", "InvokeBrowser" ) ) or ( aws.cloudtrail.user_identity.type == "AssumedRole" and event.provider not in ( "bedrock-agentcore.amazonaws.com", "bedrock-agentcore-control.amazonaws.com", "bedrock.amazonaws.com", "bedrock-runtime.amazonaws.com", "logs.amazonaws.com", "monitoring.amazonaws.com", "xray.amazonaws.com", "ecr.amazonaws.com", "ecr-public.amazonaws.com" ) ) ) | eval Esql.is_agentcore_invocation = event.provider == "bedrock-agentcore.amazonaws.com" and event.action in ( "InvokeAgentRuntimeCommand", "InvokeCodeInterpreter", "ConnectBrowserAutomationStream", "InvokeBrowser" ) | eval Esql.is_assumed_role_follow_on = not Esql.is_agentcore_invocation | eval Esql.invocation_sort_key = case( Esql.is_agentcore_invocation, concat( to_string(@timestamp), "|", aws.cloudtrail.user_identity.access_key_id, "|", aws.cloudtrail.user_identity.arn ), null ) | eval Esql.follow_on_sort_key = case( Esql.is_assumed_role_follow_on, concat( to_string(@timestamp), "|", aws.cloudtrail.user_identity.access_key_id, "|", aws.cloudtrail.user_identity.arn ), null ) | stats Esql.agentcore_event_count = sum(case(Esql.is_agentcore_invocation, 1, 0)), Esql.follow_on_event_count = sum(case(Esql.is_assumed_role_follow_on, 1, 0)), Esql.first_agentcore_sort_key = min(Esql.invocation_sort_key), Esql.last_follow_on_sort_key = max(Esql.follow_on_sort_key), Esql.agentcore_actions = values(case(Esql.is_agentcore_invocation, event.action, null)), Esql.follow_on_actions = values(case(Esql.is_assumed_role_follow_on, event.action, null)), Esql.follow_on_providers = values(case(Esql.is_assumed_role_follow_on, event.provider, null)), Esql_priv.agentcore_identity_arn_values = values(case(Esql.is_agentcore_invocation, aws.cloudtrail.user_identity.arn, null)), Esql_priv.follow_on_identity_arn_values = values(case(Esql.is_assumed_role_follow_on, aws.cloudtrail.user_identity.arn, null)), Esql_priv.agentcore_access_key_id_values = values(case(Esql.is_agentcore_invocation, aws.cloudtrail.user_identity.access_key_id, null)), Esql_priv.follow_on_access_key_id_values = values(case(Esql.is_assumed_role_follow_on, aws.cloudtrail.user_identity.access_key_id, null)), Esql.cloud_region_values = values(cloud.region), Esql.user_agent_original_values = values(user_agent.original), Esql.cloudtrail_request_id_values = values(aws.cloudtrail.request_id), Esql.cloudtrail_resource_arn_values = values(aws.cloudtrail.resources.arn) by cloud.account.id, source.ip | where Esql.agentcore_event_count >= 1 and Esql.follow_on_event_count >= 1 | eval Esql.first_agentcore_parts = split(Esql.first_agentcore_sort_key, "|") | eval Esql.follow_on_parts = split(Esql.last_follow_on_sort_key, "|") | eval Esql.first_agentcore_event = to_datetime(mv_slice(Esql.first_agentcore_parts, 0, 0)) | eval Esql_priv.first_agentcore_access_key = mv_slice(Esql.first_agentcore_parts, 1, 1) | eval Esql_priv.first_agentcore_identity_arn = mv_slice(Esql.first_agentcore_parts, 2, 2) | eval Esql.last_follow_on_event = to_datetime(mv_slice(Esql.follow_on_parts, 0, 0)) | eval Esql_priv.last_follow_on_access_key = mv_slice(Esql.follow_on_parts, 1, 1) | eval Esql_priv.last_follow_on_identity_arn = mv_slice(Esql.follow_on_parts, 2, 2) | where Esql.last_follow_on_event > Esql.first_agentcore_event and Esql_priv.last_follow_on_access_key != Esql_priv.first_agentcore_access_key and Esql_priv.last_follow_on_identity_arn != Esql_priv.first_agentcore_identity_arn | sort Esql.last_follow_on_event desc | drop Esql.first_agentcore_sort_key, Esql.last_follow_on_sort_key, Esql.first_agentcore_parts, Esql.follow_on_parts | keep Esql.*, Esql_priv.*, cloud.account.id, source.ip

Install detection rules in Elastic Security

Detect Potential AWS Bedrock AgentCore Execution Role Credential Replay in the Elastic Security detection engine by installing this rule into your Elastic Stack.

To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(external, opens in a new tab or window).