Skip to main content

More Info:

Bedrock Agent Service Roles should prevent cross service confused deputy

Risk Level

High

Address

Monitoring, Security

Compliance Standards

  • APRA CPS 234 (Australia)
  • BSI C5 (Germany)
  • Brazil LGPD
  • CCPA / CPRA (California)
  • CIS Critical Security Controls v8
  • CMMC 2.0
  • DPDPA
  • Digital Operational Resilience Act (EU)
  • ISO/IEC 27018
  • ISO/IEC 27701
  • MAS Technology Risk Management (Singapore)
  • MITRE ATT&CK (Cloud)
  • NIST SP 800-171
  • NYDFS 23 NYCRR 500
  • SOC2
  • SWIFT Customer Security Controls Framework
  • Sarbanes-Oxley IT General Controls
  • StateRAMP
  • UK NCSC Cyber Assessment Framework

Triage and Remediation

Remediation

Using Console

To prevent a cross‑service confused deputy for Amazon Bedrock Agents, you need to lock down the trust policy on the IAM service role used by your agents.Below are step‑by‑step instructions using the AWS Management Console.

1. Identify the Bedrock Agent service role(s)

  1. Sign in to the AWS Management Console.
  2. Open Amazon Bedrock.
  3. In the left navigation, choose Agents.
  4. For each agent:
    • Click the agent name.
    • Go to the Agent configuration or Permissions section.
    • Note the IAM role shown as the service role used by the agent.
      Example: AmazonBedrockAgentExecutionRole or similar.
You’ll need to update the trust policy for each such role.

2. Open the role in IAM

  1. Open the IAM console.
  2. In the left navigation, choose Roles.
  3. Search for the role name you noted (e.g., AmazonBedrockAgentExecutionRole).
  4. Click the role name.

3. Restrict the trusted principal to Bedrock only

  1. In the role details, go to the Trust relationships tab.
  2. Click Edit trust policy.
  3. Make sure the Principal is only Amazon Bedrock, not a broader service list.
    It should look like this:
Replace 123456789012 with your AWS account ID.If your agent is in a single Region and you want to be stricter, you can use:
Make sure:
  • There is no other service listed in Principal.Service.
  • There is no wildcard * principal.

4. Save the trust policy

  1. After editing, click Update policy (or Save changes).
  2. Repeat steps 2–4 for every Bedrock Agent service role you use.

5. (Optional) Re‑associate or test agents

  1. Return to the Amazon Bedrock console.
  2. Open an agent that uses this role.
  3. Run a test invocation (e.g., “Test agent” or “Invoke”) to verify the agent still functions.
  4. Watch CloudWatch Logs for any access‑denied issues if you changed other permissions.

This remediation (adding aws:SourceAccount and aws:SourceArn conditions and limiting Principal.Service to bedrock.amazonaws.com) is what prevents a confused deputy scenario for Bedrock Agent service roles.
To prevent confused‑deputy issues for Amazon Bedrock Agents, you must restrict the IAM role trust policy that Bedrock assumes, using aws:SourceAccount and aws:SourceArn conditions.Below are step‑by‑step AWS CLI instructions.

1. Identify the Bedrock Agent service role

If you already know the role name, skip to step 2.Common patterns:
  • AmazonBedrockExecutionRoleForAgents_*
  • A custom role specified when you created the agent.
List roles and filter:
Assume the role name is:

2. Get the current trust policy

You’ll edit a new file instead of overwriting this backup.

3. Construct a secure trust policy

You must:
  • Keep the correct service principal:
    bedrock.amazonaws.com
  • Add both:
    • aws:SourceAccount – your AWS account ID
    • aws:SourceArn (or ArnLike/ArnEquals) – specific Bedrock Agent ARN(s)
First, get your account ID:
Get the Agent ARN(s). For example (Agents API):
Pick the relevant ARN or use a prefix pattern. Example agent ARN:
Create a new file bedrock-agent-trust-policy.json with content like:
Adjust:
  • Region: us-east-1 → your region
  • Account: 123456789012$ACCOUNT_ID
  • agent/* → specific agent ID if you want to restrict to one:
If this role is also used by other Bedrock features (e.g., knowledge bases), add separate statements for each service/ARN pattern instead of broadening the existing one.

4. Apply the updated trust policy


5. (Optional) Verify the applied trust policy

Confirm:
  • Principal.Service is bedrock.amazonaws.com
  • Condition includes:
    • aws:SourceAccount = your account ID
    • aws:SourceArn restricted to your Agent ARN(s)

If you share the exact current trust policy JSON, I can give you a precise before/after version tailored to your account, region, and agent IDs.
To prevent cross-service confused deputy issues for AWS Bedrock Agents, you must tighten the trust policy of the Agent’s service role so that only your account and your Bedrock agents can assume it. Below is how to do that with Python (boto3).

1. Decide the correct trust policy

Replace 123456789012 with your AWS account ID and set the Region(s) as needed (* is fine if you use multiple Regions):
This ensures:
  • Only Bedrock in your account can assume the role.
  • Only ARNs that match your Bedrock agents can use it (prevents confused deputy).

2. Python script to update an existing Bedrock Agent service role

Install dependencies:
Python script (e.g., fix_bedrock_agent_trust.py):
Run:

3. Verify the change

  1. In the AWS console, go to IAM → Roles → your Bedrock Agent role.
  2. Check the Trust relationships tab.
  3. Confirm:
    • Principal: Service: bedrock.amazonaws.com
    • Conditions include aws:SourceAccount and aws:SourceArn as shown above.

If you share the exact role name(s) or how you create Bedrock Agents (CDK, CloudFormation, console, etc.), I can adapt the Python example to generate/create the role as well, not just update it.