π‘οΈ AWS IAM User has inline or directly attached policiesπ’
- Contextual name: π‘οΈ User has inline or directly attached policiesπ’
- ID:
/ce/ca/aws/iam/delete-user-inline-or-directly-attached-policies - Tags:
- π’ Policy with categories
- π’ Policy with type
- π’ Production policy
- Policy Type:
COMPLIANCE_POLICY - Policy Categories:
SECURITY
Logicβ
- π§ prod.logic.yamlπ π’
- π AWS IAM User
- π§ͺ test-data.json
Similar Policiesβ
- AWS Security Hub: [IAM.2] IAM users should not have IAM policies attached
- Cloud Conformity: Receive Permissions via IAM Groups Only
- Internal:
dec-x-4157c58a
Similar Internal Rulesβ
| Rule | Policies | Flags |
|---|---|---|
| βοΈ dec-x-4157c58a | 1 |
Descriptionβ
Descriptionβ
IAM users are granted access to services, functions, and data through IAM policies. There are four ways to define policies for a user:
- Edit the user policy directly, aka an inline, or user, policy.
- Attach a policy directly to a user.
- Add the user to an IAM group that has an attached policy.
- Add the user to an IAM group that has an inline policy.
Only the third implementation is recommended.
Rationaleβ
Assigning IAM policy only through groups unifies permissions management to a single, flexible layer consistent with organizational functional roles. By unifying permissions management, the likelihood of excessive permissions is reduced.
Auditβ
Perform the following to determine if an inline policy is set or a policy is directly attached to users:
- Run the following to get a list of IAM users:
aws iam list-users --query 'Users[*].UserName' --output text
- For each user returned, run the following command to determine if any policies are attached to them:
aws iam list-attached-user-policies --user-name <iam_user>
... [see more](description.md)
Remediationβ
Remediationβ
Perform the following to create an IAM group and assign a policy to it:
- Sign in to the AWS Management Console and open the IAM console at https://console.aws.amazon.com/iam/.
- In the navigation pane, click
Groupsand then clickCreate New Group.- In the
Group Namebox, type the name of the group and then clickNext Step.- In the list of policies, select the check box for each policy that you want to apply to all members of the group. Then click
Next Step.- Click
Create Group.Perform the following to add a user to a given group:
- Sign in to the AWS Management Console and open the IAM console at https://console.aws.amazon.com/iam/.
- In the navigation pane, click
Groups.- Select the group to add a user to.
- Click
Add Users To Group.- Select the users to be added to the group.
- Click
Add Users.Perform the following to remove a direct association between a user and policy:
- Sign in to the AWS Management Console and open the IAM console at https://console.aws.amazon.com/iam/.
... see more