Review account-wide trust in an IAM role

Check that account delegation in the role trust policy matches the intended scope.

Description

An account ARN ending in :root lets that account's administrators grant users or roles permission to assume your role.

Potential impact

More identities can gain access as administrators in the trusted account change their permissions.

Remediation

Specify only the required role or service principals and conditions. If account-wide delegation is intentional, review who has sts:AssumeRole permission in that account.

Examples

The second template trusts TrustedApplicationRole and changes the logical ID from RootRole to ApplicationRole. To update the trust policy of an existing role, keep its logical ID and use the actual calling role ARN.

Before

yaml
AWSTemplateFormatVersion: "2010-09-09"
Resources:
  RootRole:
    Type: "AWS::IAM::Role"
    Properties:
      AssumeRolePolicyDocument: >
        {
            "Version": "2012-10-17",
            "Statement": [
                {
                    "Action": "sts:AssumeRole",
                    "Principal": {
                        "AWS": "arn:aws:iam::111122223333:root"
                    },
                    "Effect": "Allow",
                    "Sid": ""
                }
            ]
        }

After

yaml
AWSTemplateFormatVersion: "2010-09-09"
Resources:
  ApplicationRole:
    Type: "AWS::IAM::Role"
    Properties:
      AssumeRolePolicyDocument:
        Version: "2012-10-17"
        Statement:
          - Action: "sts:AssumeRole"
            Effect: "Allow"
            Principal:
              AWS: "arn:aws:iam::111122223333:role/TrustedApplicationRole"

References