CloudWiki
Rules
Get a free AWS Well-Architected Assessment ->
Critical

IAM user can execute a Privilege Escalation by using AttachRolePolicy

Security & Compliance
No items found.
Description

When an IAM user has permissions to attach an arbitrary policy to an existing IAM role, they can escalate their privileges by granting themselves access to actions they are not authorized to perform directly. This could result in unauthorized access to resources and data, allowing the attacker to modify, delete, or exfiltrate sensitive data. An IAM user with the ability to attach any policy to an IAM role can leverage the PassRole permission to assign the IAM role to a resource they control, such as an EC2 instance or Lambda function, and assume the role to perform actions beyond their assigned permissions.‍

Remediation

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

  1. Identify the user or users who have the permission to use the AttachRolePolicy API action.
  2. Review the permissions granted to the user(s) and determine whether they are necessary for their job functions.
  3. If the permissions are not necessary, remove the AttachRolePolicy permission from the user(s).
  4. If the permissions are necessary, limit the scope of the permissions to only the specific resources and actions required for their job functions.
  5. Monitor the IAM user's activity using AWS CloudTrail and Amazon CloudWatch to detect any suspicious activity that may indicate privilege escalation attempts.
  6. Implement the principle of least privilege by granting only the minimum permissions required to perform the necessary tasks.

It is important to regularly review IAM permissions to ensure that they are up to date and aligned with business needs.

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.
Deploy cloud infrastructure changes with confidence. Troubleshoot faster with the complete context of your cloud environment.
GET STARTED