|
| 1 | +[[prebuilt-rule-8-19-9-aws-iam-administratoraccess-policy-attached-to-group]] |
| 2 | +=== AWS IAM AdministratorAccess Policy Attached to Group |
| 3 | + |
| 4 | +An adversary with access to a set of compromised credentials may attempt to persist or escalate privileges by attaching additional permissions to user groups the compromised user account belongs to. This rule looks for use of the IAM AttachGroupPolicy API operation to attach the highly permissive AdministratorAccess AWS managed policy to an existing IAM user group. |
| 5 | + |
| 6 | +*Rule type*: eql |
| 7 | + |
| 8 | +*Rule indices*: |
| 9 | + |
| 10 | +* filebeat-* |
| 11 | +* logs-aws.cloudtrail-* |
| 12 | + |
| 13 | +*Severity*: medium |
| 14 | + |
| 15 | +*Risk score*: 47 |
| 16 | + |
| 17 | +*Runs every*: 5m |
| 18 | + |
| 19 | +*Searches indices from*: now-6m ({ref}/common-options.html#date-math[Date Math format], see also <<rule-schedule, `Additional look-back time`>>) |
| 20 | + |
| 21 | +*Maximum alerts per execution*: 100 |
| 22 | + |
| 23 | +*References*: |
| 24 | + |
| 25 | +* https://docs.aws.amazon.com/IAM/latest/APIReference/API_AttachGroupPolicy.html |
| 26 | +* https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AdministratorAccess.html |
| 27 | +* https://hackingthe.cloud/aws/exploitation/iam_privilege_escalation/ |
| 28 | + |
| 29 | +*Tags*: |
| 30 | + |
| 31 | +* Domain: Cloud |
| 32 | +* Data Source: AWS |
| 33 | +* Data Source: Amazon Web Services |
| 34 | +* Data Source: AWS IAM |
| 35 | +* Use Case: Identity and Access Audit |
| 36 | +* Tactic: Privilege Escalation |
| 37 | +* Tactic: Persistence |
| 38 | +* Resources: Investigation Guide |
| 39 | + |
| 40 | +*Version*: 7 |
| 41 | + |
| 42 | +*Rule authors*: |
| 43 | + |
| 44 | +* Elastic |
| 45 | + |
| 46 | +*Rule license*: Elastic License v2 |
| 47 | + |
| 48 | + |
| 49 | +==== Investigation guide |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | +*Triage and analysis* |
| 54 | + |
| 55 | + |
| 56 | +> **Disclaimer**: |
| 57 | +> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs. |
| 58 | + |
| 59 | + |
| 60 | +*Investigating AWS IAM AdministratorAccess Policy Attached to Group* |
| 61 | + |
| 62 | + |
| 63 | +The AWS-managed `AdministratorAccess` policy grants full administrative privileges across all AWS services. |
| 64 | +When attached to a group, all group members inherit this access, often unintentionally broadening the blast radius of a compromise. |
| 65 | +Adversaries can exploit `iam:AttachGroupPolicy` permissions to escalate privileges or establish persistence by attaching this policy to an existing user group. |
| 66 | + |
| 67 | + |
| 68 | +*Possible investigation steps* |
| 69 | + |
| 70 | + |
| 71 | +- **Identify the affected group and calling principal.** |
| 72 | + Review `aws.cloudtrail.user_identity.arn` (caller) and `aws.cloudtrail.request_parameters.groupName` (target group). |
| 73 | + Validate whether this aligns with legitimate change management or automation workflows. |
| 74 | + |
| 75 | +- **Review group membership.** |
| 76 | + Enumerate current members using `aws iam get-group`. |
| 77 | + Determine whether unauthorized users could have gained administrative access as a result. |
| 78 | + |
| 79 | +- **Inspect CloudTrail details.** |
| 80 | + Check `source.ip`, `user_agent.original`, and `source.geo` fields for anomalies. |
| 81 | + Compare with historical operations by the same principal. |
| 82 | + |
| 83 | +- **Correlate related IAM activity.** |
| 84 | + Search for adjacent events such as `AddUserToGroup`, `CreateUser`, or `AttachUserPolicy`. |
| 85 | + These may indicate chained privilege escalation. |
| 86 | + |
| 87 | +- **Assess propagation of privileges.** |
| 88 | + If the group has many members or is linked to cross-account roles, the impact may extend beyond a single user. |
| 89 | + Document all affected identities for containment. |
| 90 | + |
| 91 | + |
| 92 | +*False positive analysis* |
| 93 | + |
| 94 | + |
| 95 | +- **Intentional access updates.** |
| 96 | + Policy attachment may occur during legitimate administrative provisioning. Confirm via ticketing systems. |
| 97 | +- **Automation or compliance tasks.** |
| 98 | + Some environments use centralized scripts to attach AdministratorAccess temporarily. Validate through automation logs. |
| 99 | + |
| 100 | + |
| 101 | +*Response and remediation* |
| 102 | + |
| 103 | + |
| 104 | +**1. Immediate containment** |
| 105 | +- Detach the policy from the affected group (`aws iam detach-group-policy`). |
| 106 | +- Review and limit group membership. Temporarily remove non-essential users or disable access for impacted accounts. |
| 107 | +- Rotate credentials for users who inherited admin privileges from the attachment. |
| 108 | +- Enable MFA on all impacted accounts. |
| 109 | + |
| 110 | +**2. Evidence preservation** |
| 111 | +- Export the triggering `AttachGroupPolicy` event and related CloudTrail entries ±30 minutes from the alert. |
| 112 | +- Preserve AWS Config and GuardDuty records to support forensic analysis. |
| 113 | + |
| 114 | +**3. Scoping and investigation** |
| 115 | +- Review additional IAM operations from the same caller (`CreateAccessKey`, `AttachRolePolicy`, `UpdateAssumeRolePolicy`). |
| 116 | +- Identify whether new groups or roles were created shortly before or after the event. |
| 117 | +- Check for subsequent API activity by newly privileged users (for example, S3, EC2, or IAM modifications). |
| 118 | + |
| 119 | +**4. Recovery and hardening** |
| 120 | +- Reinforce least privilege, avoid assigning `AdministratorAccess` to groups. |
| 121 | +- Use role-based access control with scoped permissions. |
| 122 | +- Enable CloudTrail, GuardDuty, and Security Hub across all regions. |
| 123 | +- Implement SCPs at the organization level to restrict direct `AdministratorAccess` attachments. |
| 124 | + |
| 125 | + |
| 126 | +*Additional information* |
| 127 | + |
| 128 | +- **https://github.com/aws-samples/aws-incident-response-playbooks/blob/c151b0dc091755fffd4d662a8f29e2f6794da52c/playbooks/[AWS IR Playbooks]: response steps related to IAM policy modification and unauthorized privilege escalation.. |
| 129 | +- **https://github.com/aws-samples/aws-customer-playbook-framework/[AWS Customer Playbook Framework]: for containment, analysis, and recovery guidance. |
| 130 | +- **AWS Documentation:** https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_job-functions.html#jf_administrator[AdministratorAccess Policy]. |
| 131 | + |
| 132 | + |
| 133 | +==== Rule query |
| 134 | + |
| 135 | + |
| 136 | +[source, js] |
| 137 | +---------------------------------- |
| 138 | +iam where event.dataset == "aws.cloudtrail" |
| 139 | + and event.provider == "iam.amazonaws.com" |
| 140 | + and event.action == "AttachGroupPolicy" |
| 141 | + and event.outcome == "success" |
| 142 | + and stringContains(aws.cloudtrail.request_parameters, "policyArn=arn:aws:iam::aws:policy/AdministratorAccess") |
| 143 | +
|
| 144 | +---------------------------------- |
| 145 | + |
| 146 | +*Framework*: MITRE ATT&CK^TM^ |
| 147 | + |
| 148 | +* Tactic: |
| 149 | +** Name: Privilege Escalation |
| 150 | +** ID: TA0004 |
| 151 | +** Reference URL: https://attack.mitre.org/tactics/TA0004/ |
| 152 | +* Technique: |
| 153 | +** Name: Account Manipulation |
| 154 | +** ID: T1098 |
| 155 | +** Reference URL: https://attack.mitre.org/techniques/T1098/ |
| 156 | +* Sub-technique: |
| 157 | +** Name: Additional Cloud Roles |
| 158 | +** ID: T1098.003 |
| 159 | +** Reference URL: https://attack.mitre.org/techniques/T1098/003/ |
| 160 | +* Tactic: |
| 161 | +** Name: Persistence |
| 162 | +** ID: TA0003 |
| 163 | +** Reference URL: https://attack.mitre.org/tactics/TA0003/ |
| 164 | +* Technique: |
| 165 | +** Name: Account Manipulation |
| 166 | +** ID: T1098 |
| 167 | +** Reference URL: https://attack.mitre.org/techniques/T1098/ |
| 168 | +* Sub-technique: |
| 169 | +** Name: Additional Cloud Roles |
| 170 | +** ID: T1098.003 |
| 171 | +** Reference URL: https://attack.mitre.org/techniques/T1098/003/ |
0 commit comments