IAM user can execute a Privilege Escalation by using inline AttachRolePolicy

Security & Compliance
No items found.

When an IAM user is granted the iam:AttachRolePolicy permission, they can attach an inline policy to an IAM role that grants them more permissions than they currently have. This can lead to privilege escalation, allowing the user to perform actions they should not be authorized to do. For example, if an IAM user is granted permission to attach an AdministratorAccess policy to a role, they would gain admin-level access to AWS resources that they were not originally authorized to access.‍


If an IAM user can execute a privilege escalation by using inline AttachRolePolicy, the following remediation steps can be taken:

  1. Identify the IAM user who has the permission to attach inline policies to roles.
  2. Review the permissions and policies attached to the user to identify any misconfigurations.
  3. Restrict the user's permission to attach inline policies by removing the iam:AttachRolePolicy permission from their permissions.
  4. Create a new policy that allows the user to only attach specific policies to roles they need to access.
  5. Enable AWS CloudTrail to monitor and audit the actions of the IAM user.
  6. Use AWS Config Rules to check for compliance of IAM policies and permissions.
  7. Monitor the IAM user's actions to detect any suspicious activity and to verify that they are adhering to security policies.
  8. Consider using IAM Roles for Service Account (IRSA) or Kubernetes Service Account (KSA) for services running on AWS Elastic Kubernetes Service (EKS) clusters to eliminate the need for inline policies.
  9. Conduct periodic reviews of IAM policies and permissions to ensure that they comply with security best practices and to identify and remediate any misconfigurations.
Enforced Resources
Note: Remediation steps provided by Lightlytics are meant to be suggestions and guidelines only. It is crucial to thoroughly verify and test any remediation steps before applying them to production environments. Each organization's infrastructure and security needs may differ, and blindly applying suggested remediation steps without proper testing could potentially cause unforeseen issues or vulnerabilities. Therefore, it is strongly recommended that you validate and customize any remediation steps to meet your organization's specific requirements and ensure that they align with your security policies and best practices.