Bedrock service role trust policies should restrict the source account and source ARN

Description

IAM roles that Amazon Bedrock (bedrock.amazonaws.com) or Amazon Bedrock AgentCore (bedrock-agentcore.amazonaws.com) can assume should restrict each trust statement that grants the service sts:AssumeRole with aws:SourceAccount and aws:SourceArn conditions, which prevents the confused deputy problem. A statement passes when it has both conditions, every aws:SourceAccount value is the account that owns the role and every aws:SourceArn value is an ARN in that account with a concrete resource type, such as agent/* or knowledge-base/<id> for Bedrock and runtime/<id> for AgentCore. For Bedrock, the resource type must be one that CIS lists: agent, flow, knowledge-base, model-customization-job, model-import-job, model-invocation-job, or evaluation-job. An account-wide ARN such as arn:aws:bedrock:*:<account-id>:* fails, which is stricter than the AWS confused deputy guidance, and so do an empty condition value list and a trust policy that is not valid JSON. The one exception is the model invocation logging delivery role, which the Amazon Bedrock User Guide pins to arn:aws:bedrock:<region>:<account-id>:* because logging is configured per account and Region. That role passes with a literal Region, the owning account, and a matching aws:SourceAccount only when every attached policy is a collected customer managed policy and its policies, including inline policies, grant nothing beyond logs:CreateLogStream and logs:PutLogEvents. Service-linked roles (under /aws-service-role/) and roles that do not trust a Bedrock principal are skipped.

Remediation

Edit the role’s trust policy so that each statement allowing a Bedrock service principal includes a condition block similar to the following, with the source ARN scoped to the resource type or resource that uses the role:

"Condition": {
  "StringEquals": { "aws:SourceAccount": "<ACCOUNT_ID>" },
  "ArnLike": { "aws:SourceArn": "arn:aws:bedrock:<REGION>:<ACCOUNT_ID>:agent/*" }
}

For more information, see Cross-service confused deputy prevention in the Amazon Bedrock User Guide.

References