Information
IAM policies are the means by which privileges are granted to users, groups, or roles. It is recommended and considered standard security advice to grant least privilege, granting only the permissions required to perform a task. Determine what users need to do, and then craft policies for them that allow the users to perform only those tasks, instead of granting full administrative privileges.
It is more secure to start with a minimal set of permissions and grant additional permissions as necessary, rather than starting with overly permissive access and attempting to restrict it later.
Providing full administrative privileges instead of restricting access to the minimum required exposes resources to potentially unintended or malicious actions.
IAM policies that contain a statement with "Effect": "Allow" and "Action": "*" over "Resource": "*" should be removed.
Solution
From Console:
- Sign in to the AWS Management Console and open the IAM console
- In the navigation pane, click Policies
- Search for the policy identified in the audit step
- Select the policy
- Choose Detach
- Detach the policy from all Users, Groups, and Roles
- Delete the policy if it is no longer required
From Command Line:
- List all entities attached to the policy:
aws iam list-entities-for-policy --policy-arn <policy_arn>
- Detach from users:
aws iam detach-user-policy --user-name <iam_user> --policy-arn <policy_arn>
- Detach from groups:
aws iam detach-group-policy --group-name <iam_group> --policy-arn <policy_arn>
- Detach from roles:
aws iam detach-role-policy --role-name <iam_role> --policy-arn <policy_arn>
Impact:
Policies granting full administrative privileges significantly increase the risk of unauthorized or unintended actions, potentially resulting in complete account compromise.