AWS IAM role should not have permissive trust with the Cognito Identity service


Each AWS IAM role must have a trust policy which defines the principals who are trusted to assume that role. IAM roles can be misconfigured when creating a trust relationship with the Cognito identity service. This allows anyone in the world to assume the role, not just those specified by the identity pool.


If an IAM role is misconfigured in this way, the role can be used to gain initial access to the AWS account. Additionally, an adversary would have access to any resources the role is authorized to access by using its identity policies.


Ensure the identified role uses an effective Condition element to restrict access to the role through the parameter.

From the console

  1. In the AWS Console, navigate to the IAM role you would like to change.
  2. On the IAM role page, click the Trust relationships tab.
  3. Click Edit trust policy.
  4. Make changes to the trust policy to remediate the risk.
  5. Click Update policy.

From the command line

Use the update-assume-role-policy action to update the role trust policy to remediate the risk.

    aws iam update-assume-role-policy
       --role-name Test-Role
       --policy-document file://<NEW_ROLE_POLICY>.json