IAM principals should not have IAM inline policies that allow decryption actions on all KMS keys
Checks that no inline policy embedded in an IAM user, group or role allows kms:Decrypt or kms:ReEncryptFrom, by name or by wildcard, on every KMS key. Such a grant lets the principal read data under keys it does not need; AWS recommends allowing it only on specific keys. Conditions and managed policies are not read.
- service
- KMS
- severity
- Medium
- scope
- evaluated once per account
How to fix it
- Can break clients: The edit applies at once, and the principal can no longer decrypt with any key left out, so take the keys it uses from CloudTrail's Decrypt events first.
In the console
IAM → Users, User groups or Roles → the principal → Permissions → the inline policy
- Resource
- The ARN of each key needed, never "*", in every Allow of kms:Decrypt or kms:ReEncryptFrom
- Action
- kms:Decrypt and kms:ReEncryptFrom only where needed; a wildcard such as kms:* or kms:De* grants them too
With the AWS CLI
- Overwrites existing settings: put-role-policy replaces the named inline policy's whole document (put-user-policy or put-group-policy for a user or group), so include every statement it keeps.
aws iam put-role-policy --role-name <role-name> --policy-name <policy-name> --policy-document file://policy.jsonWith Terraform
resource "aws_iam_role_policy" "this" {
name = var.policy_name
role = var.role_name
policy = jsonencode({
Version = "2012-10-17"
Statement = [{
Effect = "Allow"
Action = ["kms:Decrypt"]
Resource = var.kms_key_arns
}]
})
}
See which of your accounts this check is failing on.
Book a live scan