AWS IAM AdministratorAccess Policy Attached to Role

An adversary with access to a set of compromised credentials may attempt to persist or escalate privileges by attaching additional permissions to compromised IAM roles. This rule looks for use of the IAM AttachRolePolicy API operation to attach the highly permissive AdministratorAccess AWS managed policy to an existing IAM role.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2024/05/31"
  3integration = ["aws"]
  4maturity = "production"
  5updated_date = "2026/01/16"
  6
  7[rule]
  8author = ["Elastic"]
  9description = """
 10An adversary with access to a set of compromised credentials may attempt to persist or escalate privileges by attaching
 11additional permissions to compromised IAM roles. This rule looks for use of the IAM AttachRolePolicy API operation to
 12attach the highly permissive AdministratorAccess AWS managed policy to an existing IAM role.
 13"""
 14false_positives = [
 15    """
 16    While this can be normal behavior, it should be investigated to ensure validity. Verify whether the user identity
 17    should be using the IAM `AttachRolePolicy` API operation to attach the `AdministratorAccess` policy to the target
 18    role.
 19    """,
 20]
 21from = "now-6m"
 22index = ["logs-aws.cloudtrail-*"]
 23language = "eql"
 24license = "Elastic License v2"
 25name = "AWS IAM AdministratorAccess Policy Attached to Role"
 26note = """## Triage and analysis
 27
 28### Investigating AWS IAM AdministratorAccess Policy Attached to Role
 29
 30The `AdministratorAccess` managed policy grants unrestricted privileges.  
 31When attached to a role, it can enable privilege escalation or persistence, especially if the role is assumable by other accounts or services.  
 32This rule detects `AttachRolePolicy` events where the `policyName` is `AdministratorAccess`.
 33
 34#### Possible investigation steps
 35
 36- **Identify both identities.**  
 37  Determine the calling user or role (`aws.cloudtrail.user_identity.arn`) and the target role (`aws.cloudtrail.request_parameters.roleName`).  
 38  Validate whether this change aligns with intended administrative actions.  
 39
 40- **Review the target role’s trust policy.**  
 41  Examine who can assume the role (`AssumeRolePolicyDocument`).  
 42  If the role is assumable by external accounts, this may indicate a potential persistence or lateral movement path.  
 43
 44- **Review CloudTrail details.**  
 45  Check `source.ip`, `user_agent.original`, and `source.geo` fields for anomalies.  
 46  Compare with historical operations by the same principal.  
 47
 48- **Correlate with adjacent IAM events.**  
 49  Look for `UpdateAssumeRolePolicy`, `CreateAccessKey`, or `PassRole` calls.  
 50  These often accompany privilege escalation activity.  
 51
 52- **Inspect downstream activity.**  
 53  Query CloudTrail for recent `AssumeRole` calls for the target role — determine if the newly elevated permissions were used.  
 54
 55### False positive analysis
 56
 57- **Delegated role management.**  
 58  Cloud administrators may legitimately grant temporary AdministratorAccess for troubleshooting. Confirm through tickets or change logs.  
 59- **Automation or service-linked roles.**  
 60  Some services attach policies automatically for setup; verify whether the target is a service-linked role.  
 61
 62### Response and remediation
 63
 64**Immediate containment**
 65- Detach the policy. Remove the `AdministratorAccess` policy from the target role.  
 66- Restrict access. Temporarily revoke the caller’s IAM privileges until the legitimacy of the action is confirmed.  
 67- Audit trust policies. Review the role’s trust relationships to ensure only approved principals can assume it.  
 68- Rotate credentials for any principals who assumed the affected role during the period of elevated privileges.  
 69
 70**Evidence preservation**
 71- Export the triggering `AttachRolePolicy` event and related CloudTrail entries ±30 minutes from the alert.  
 72- Preserve AWS Config snapshots and GuardDuty findings for traceability.  
 73
 74**Scoping and investigation**
 75- Identify if the elevated role was subsequently assumed.  
 76  Correlate by matching `aws.cloudtrail.eventName:AssumeRole` with the target role ARN.  
 77- Search for other recent IAM policy attachments or modifications by the same actor or IP.  
 78
 79**Recovery and hardening**
 80- Apply least privilege policies; limit who can attach or modify administrative policies.  
 81- Enforce IAM Conditions such as `aws:PrincipalArn` or `aws:ResourceTag` to limit policy attachment scope.  
 82- Enable CloudTrail, GuardDuty, and Security Hub across all regions.  
 83- Implement SCPs at the organization level to restrict direct `AdministratorAccess` attachments.  
 84
 85### Additional information
 86- **[AWS IR Playbooks](https://github.com/aws-samples/aws-incident-response-playbooks/blob/c151b0dc091755fffd4d662a8f29e2f6794da52c/playbooks/): response steps related to IAM policy modification and unauthorized privilege escalation..  
 87- **[AWS Customer Playbook Framework](https://github.com/aws-samples/aws-customer-playbook-framework/): for containment, analysis, and recovery guidance.
 88- **AWS Documentation:** [AdministratorAccess Policy](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_job-functions.html#jf_administrator).  
 89"""
 90references = [
 91    "https://docs.aws.amazon.com/IAM/latest/APIReference/API_AttachRolePolicy.html",
 92    "https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AdministratorAccess.html",
 93    "https://hackingthe.cloud/aws/exploitation/iam_privilege_escalation/",
 94]
 95risk_score = 47
 96rule_id = "dde13d58-bc39-4aa0-87fd-b4bdbf4591da"
 97severity = "medium"
 98tags = [
 99    "Domain: Cloud",
100    "Data Source: AWS",
101    "Data Source: Amazon Web Services",
102    "Data Source: AWS IAM",
103    "Use Case: Identity and Access Audit",
104    "Tactic: Privilege Escalation",
105    "Tactic: Persistence",
106    "Resources: Investigation Guide",
107]
108timestamp_override = "event.ingested"
109type = "eql"
110
111query = '''
112iam where event.dataset == "aws.cloudtrail"
113   and event.provider == "iam.amazonaws.com"
114   and event.action == "AttachRolePolicy"
115   and event.outcome == "success"
116   and stringContains(aws.cloudtrail.request_parameters, "policyArn=arn:aws:iam::aws:policy/AdministratorAccess")
117'''
118
119
120[[rule.threat]]
121framework = "MITRE ATT&CK"
122[[rule.threat.technique]]
123id = "T1098"
124name = "Account Manipulation"
125reference = "https://attack.mitre.org/techniques/T1098/"
126[[rule.threat.technique.subtechnique]]
127id = "T1098.003"
128name = "Additional Cloud Roles"
129reference = "https://attack.mitre.org/techniques/T1098/003/"
130
131
132
133[rule.threat.tactic]
134id = "TA0004"
135name = "Privilege Escalation"
136reference = "https://attack.mitre.org/tactics/TA0004/"
137[[rule.threat]]
138framework = "MITRE ATT&CK"
139[[rule.threat.technique]]
140id = "T1098"
141name = "Account Manipulation"
142reference = "https://attack.mitre.org/techniques/T1098/"
143[[rule.threat.technique.subtechnique]]
144id = "T1098.003"
145name = "Additional Cloud Roles"
146reference = "https://attack.mitre.org/techniques/T1098/003/"
147
148
149
150[rule.threat.tactic]
151id = "TA0003"
152name = "Persistence"
153reference = "https://attack.mitre.org/tactics/TA0003/"
154
155[rule.investigation_fields]
156field_names = [
157    "@timestamp",
158    "user.name",
159    "user_agent.original",
160    "source.ip",
161    "aws.cloudtrail.user_identity.arn",
162    "aws.cloudtrail.user_identity.type",
163    "aws.cloudtrail.user_identity.access_key_id",
164    "event.action",
165    "event.outcome",
166    "cloud.account.id",
167    "cloud.region",
168    "aws.cloudtrail.request_parameters",
169]

Triage and analysis

Investigating AWS IAM AdministratorAccess Policy Attached to Role

The AdministratorAccess managed policy grants unrestricted privileges.
When attached to a role, it can enable privilege escalation or persistence, especially if the role is assumable by other accounts or services.
This rule detects AttachRolePolicy events where the policyName is AdministratorAccess.

Possible investigation steps

  • Identify both identities.
    Determine the calling user or role (aws.cloudtrail.user_identity.arn) and the target role (aws.cloudtrail.request_parameters.roleName).
    Validate whether this change aligns with intended administrative actions.

  • Review the target role’s trust policy.
    Examine who can assume the role (AssumeRolePolicyDocument).
    If the role is assumable by external accounts, this may indicate a potential persistence or lateral movement path.

  • Review CloudTrail details.
    Check source.ip, user_agent.original, and source.geo fields for anomalies.
    Compare with historical operations by the same principal.

  • Correlate with adjacent IAM events.
    Look for UpdateAssumeRolePolicy, CreateAccessKey, or PassRole calls.
    These often accompany privilege escalation activity.

  • Inspect downstream activity.
    Query CloudTrail for recent AssumeRole calls for the target role — determine if the newly elevated permissions were used.

False positive analysis

  • Delegated role management.
    Cloud administrators may legitimately grant temporary AdministratorAccess for troubleshooting. Confirm through tickets or change logs.
  • Automation or service-linked roles.
    Some services attach policies automatically for setup; verify whether the target is a service-linked role.

Response and remediation

Immediate containment

  • Detach the policy. Remove the AdministratorAccess policy from the target role.
  • Restrict access. Temporarily revoke the caller’s IAM privileges until the legitimacy of the action is confirmed.
  • Audit trust policies. Review the role’s trust relationships to ensure only approved principals can assume it.
  • Rotate credentials for any principals who assumed the affected role during the period of elevated privileges.

Evidence preservation

  • Export the triggering AttachRolePolicy event and related CloudTrail entries ±30 minutes from the alert.
  • Preserve AWS Config snapshots and GuardDuty findings for traceability.

Scoping and investigation

  • Identify if the elevated role was subsequently assumed.
    Correlate by matching aws.cloudtrail.eventName:AssumeRole with the target role ARN.
  • Search for other recent IAM policy attachments or modifications by the same actor or IP.

Recovery and hardening

  • Apply least privilege policies; limit who can attach or modify administrative policies.
  • Enforce IAM Conditions such as aws:PrincipalArn or aws:ResourceTag to limit policy attachment scope.
  • Enable CloudTrail, GuardDuty, and Security Hub across all regions.
  • Implement SCPs at the organization level to restrict direct AdministratorAccess attachments.

Additional information

References

Related rules

to-top