IAM users should get their permissions through groups, not directly
This check looks at whether IAM users have policies attached to them directly. The safe setting is that permissions come only from IAM group membership.
Why it matters
When policies are attached to individual users, it becomes hard to see who can do what, and hard to keep access consistent as people change roles. Permissions granted one user at a time tend to stay after they are needed. Groups tie permissions to a job function, so granting or removing access means changing a group membership, not hunting for user-level policies.
AWS lists the use of groups as an IAM practice because it makes permissions simpler to manage and review.
Source: AWS documentation, IAM user groups and Security best practices in IAM.
How to check it yourself
In the AWS console, open IAM, then Users, open each user and look at the Permissions tab. Policies shown as attached directly, and not inherited from a group, are what the check is about.
These read-only AWS CLI commands list the direct attachments for one user. Try them in a test account first.
aws iam list-users --query 'Users[].UserName' --output text
aws iam list-attached-user-policies --user-name USER_NAME
aws iam list-user-policies --user-name USER_NAMEBoth of the last two commands should return an empty list for each user.
How to fix it
Portal: create a group for the job function in IAM, then User groups. Attach the needed policies to the group, add the user to it, and only then detach the policy from the user.
Script: the commands below do the same with the AWS CLI. You run them with your own admin credentials; ConfigCobra never changes your account, it only reads it and suggests the fix.
aws iam create-group --group-name GROUP_NAME
aws iam attach-group-policy --group-name GROUP_NAME --policy-arn POLICY_ARN
aws iam add-user-to-group --group-name GROUP_NAME --user-name USER_NAME
aws iam detach-user-policy --user-name USER_NAME --policy-arn POLICY_ARNRemove inline user policies in the same way, after you have copied their statements into a group policy.
What changes when you fix it
If you add the user to a group before you detach the direct policy, the user's effective permissions stay the same and nobody notices. If the group grants less than the direct policy did, the user loses the difference, and scripts that use their access keys can start to fail with access-denied errors.
Compare the effective permissions before and after, for example with the IAM policy simulator. Work through the users one at a time, starting with those who have the most direct policies.
Included in
| Benchmark | CIS ID | Profile |
|---|---|---|
| CIS Amazon Web Services Foundations v7.0.0 | 2.13 | Level 1 |
Check this on your AWS
ConfigCobra runs this check with every other control of the CIS Amazon Web Services Benchmarks, read-only.