AWS IAM User Created Access Keys For Another User
An adversary with access to a set of compromised credentials may attempt to persist or escalate privileges by creating a
new set of credentials for an existing user. This rule looks for use of the IAM CreateAccessKey API operation to
create new programmatic access keys for another IAM user.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2024/06/13"
3integration = ["aws"]
4maturity = "production"
5updated_date = "2025/10/13"
6
7[rule]
8author = ["Elastic"]
9description = """
10An adversary with access to a set of compromised credentials may attempt to persist or escalate privileges by creating a
11new set of credentials for an existing user. This rule looks for use of the IAM `CreateAccessKey` API operation to
12create new programmatic access keys for another IAM user.
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 `CreateAccessKey` for the targeted user.
18 """,
19]
20from = "now-6m"
21language = "esql"
22license = "Elastic License v2"
23name = "AWS IAM User Created Access Keys For Another User"
24note = """## Triage and analysis
25
26> **Disclaimer**:
27> 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.
28
29
30### Investigating AWS IAM User Created Access Keys For Another User
31
32AWS IAM access keys are long-term credentials that grant programmatic access to AWS resources. The `iam:CreateAccessKey` permission allows an IAM principal to generate new access keys for an existing IAM user.
33While this operation can be legitimate (for example, credential rotation), it can also be abused to establish persistence or privilege escalation if one user creates keys for another account without authorization.
34
35This rule identifies `CreateAccessKey` API calls where the calling user (`aws.cloudtrail.user_identity.arn`) differs from the target user (`aws.cloudtrail.request_parameters.userName`), indicating one IAM identity creating credentials for another.
36
37#### Possible investigation steps
38
39- **Confirm both user identities and intent.**
40 Identify the calling user (who performed `CreateAccessKey`) and the target user (whose access key was created). Contact both account owners or application teams to confirm if this operation was expected.
41
42- **Review CloudTrail event details.**
43 Check the following fields directly in the alert or corresponding CloudTrail record:
44 - `source.ip` — does it align with expected corporate ranges or known admin automation?
45 - `user_agent.original` — AWS Console, CLI, SDK, or custom client? Unexpected user agents (for example, non-SDK scripts) may indicate manual or unauthorized use.
46 - `source.geo` fields — verify the location details are expected for the identity.
47
48- **Correlate with related IAM activity.**
49 In CloudTrail, search for subsequent or nearby events such as:
50 - `AttachUserPolicy`, `AttachGroupPolicy`, `UpdateAssumeRolePolicy`, or `CreateUser`.
51 These can indicate privilege escalation or lateral movement.
52 Also review whether the same principal recently performed `CreateAccessKey` for multiple users or repeated this action across accounts.
53
54- **Inspect the new access key’s usage.**
55 Search for the newly created key ID (`aws.cloudtrail.response_elements.accessKey.accessKeyId`) in CloudTrail events following creation. Determine if it was used from unusual IP addresses, geographies, or services.
56
57- **Assess the risk of credential compromise.**
58 If you suspect malicious behavior, consider the following indicators:
59 - A non-admin user invoking `CreateAccessKey` for another user.
60 - Creation outside of normal automation pipelines.
61 - Use of the new key from a different IP or AWS account soon after creation.
62
63- **Scope related activity.**
64 Review all activity from the calling user in the past 24–48 hours, focusing on `iam:*` API calls and resource creation events.
65 Correlate any S3, EC2, or KMS access attempts made using the new key to identify potential impact or data exposure.
66
67### False positive analysis
68
69- **Expected credential rotation.**
70 Some environments delegate credential rotation responsibilities to centralized automation or specific admin roles. Confirm if the calling user is authorized for such actions.
71- **Administrative workflows.**
72 Account provisioning systems may legitimately create keys on behalf of users. Check for standard tags, automation tools, or user agents that indicate managed operations.
73- **Service-linked roles or external IAM automation.**
74 Some AWS services create or rotate credentials automatically. Validate if the caller is a service-linked role or an automation IAM role used by a known deployment process.
75
76### Response and remediation
77
78> AWS IR playbooks classify unauthorized credential creation as a **Priority-1 incident** because it may allow persistence or privilege escalation.
79> The following steps scale for organizations with or without a dedicated IR team.
80
81**1. Immediate containment**
82- Deactivate or delete the access key from the target IAM user immediately using the AWS Console, CLI, or API (`DeleteAccessKey`).
83- Rotate or reset credentials for both the calling and target users to eliminate possible compromise.
84- Restrict risky principals. Temporarily deny `iam:CreateAccessKey` and `iam:UpdateAccessKey` permissions for non-administrative roles while scoping the incident.
85- Enable or confirm MFA on both accounts involved, if not already enforced.
86
87**2. Evidence preservation**
88- Export all related `CreateAccessKey`, `DeleteAccessKey`, and `UpdateAccessKey` events within ±30 minutes of the alert to an evidence bucket.
89- Preserve CloudTrail, GuardDuty, and AWS Config data for the same period.
90- Record key event details: caller ARN, target user, `accessKeyId`, `source.ip`, `userAgent`, and timestamps.
91
92**3. Scoping and investigation**
93- Search CloudTrail for usage of the new access key ID after creation. Identify any API activity or data access tied to it.
94- Review IAM policy changes, group modifications, or new role assumptions around the same time.
95- Determine if any additional credentials or trust policy changes were made by the same actor.
96- Check for GuardDuty findings referencing anomalous credential usage or suspicious API behavior.
97
98**4. Recovery and hardening**
99- Remove or disable any unauthorized keys and re-enable only verified credentials.
100- Implement least-privilege IAM policies to limit which users can perform `CreateAccessKey`.
101- Monitor for future `CreateAccessKey` events where `userIdentity.arn != request_parameters.userName`.
102- Ensure Cloudtrail, GuardDuty and Security Hub are active across all regions.
103- Educate administrative users on secure key rotation processes and the risk of cross-user key creation.
104
105### Additional information
106
107- **[AWS IR Playbooks](https://github.com/aws-samples/aws-incident-response-playbooks/blob/c151b0dc091755fffd4d662a8f29e2f6794da52c/playbooks/):** Reference “Credential Compromise” and “IAM Misuse” procedures for containment and recovery.
108- **[AWS Customer Playbook Framework](https://github.com/aws-samples/aws-customer-playbook-framework/):** See “Identity Access Review” and “Unauthorized Access Key Creation” for example response flows.
109- **AWS Documentation:** [Best practices for managing access keys](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html).
110- **Security Best Practices:** [AWS Knowledge Center – Security Best Practices](https://aws.amazon.com/premiumsupport/knowledge-center/security-best-practices/).
111"""
112references = [
113 "https://hackingthe.cloud/aws/exploitation/iam_privilege_escalation/#iamcreateaccesskey",
114 "https://cloud.hacktricks.xyz/pentesting-cloud/aws-security/aws-persistence/aws-iam-persistence",
115 "https://permiso.io/blog/lucr-3-scattered-spider-getting-saas-y-in-the-cloud",
116 "https://docs.aws.amazon.com/IAM/latest/APIReference/API_CreateAccessKey.html",
117]
118risk_score = 47
119rule_id = "696015ef-718e-40ff-ac4a-cc2ba88dbeeb"
120severity = "medium"
121tags = [
122 "Domain: Cloud",
123 "Data Source: AWS",
124 "Data Source: Amazon Web Services",
125 "Data Source: AWS IAM",
126 "Use Case: Identity and Access Audit",
127 "Tactic: Privilege Escalation",
128 "Tactic: Persistence",
129 "Resources: Investigation Guide",
130]
131timestamp_override = "event.ingested"
132type = "esql"
133
134query = '''
135from logs-aws.cloudtrail-* metadata _id, _version, _index
136| where event.dataset == "aws.cloudtrail"
137 and event.provider == "iam.amazonaws.com"
138 and event.action == "CreateAccessKey"
139 and event.outcome == "success"
140 and user.name != user.target.name
141| keep
142 @timestamp,
143 cloud.account.id,
144 cloud.region,
145 event.provider,
146 event.action,
147 event.outcome,
148 event.dataset,
149 user.name,
150 source.address,
151 source.ip,
152 user.target.name,
153 user_agent.original,
154 aws.cloudtrail.request_parameters,
155 aws.cloudtrail.response_elements,
156 aws.cloudtrail.user_identity.arn,
157 aws.cloudtrail.user_identity.type,
158 aws.cloudtrail.user_identity.access_key_id,
159 source.geo.*
160'''
161
162
163[[rule.threat]]
164framework = "MITRE ATT&CK"
165[[rule.threat.technique]]
166id = "T1098"
167name = "Account Manipulation"
168reference = "https://attack.mitre.org/techniques/T1098/"
169[[rule.threat.technique.subtechnique]]
170id = "T1098.001"
171name = "Additional Cloud Credentials"
172reference = "https://attack.mitre.org/techniques/T1098/001/"
173
174
175
176[rule.threat.tactic]
177id = "TA0003"
178name = "Persistence"
179reference = "https://attack.mitre.org/tactics/TA0003/"
180[[rule.threat]]
181framework = "MITRE ATT&CK"
182[[rule.threat.technique]]
183id = "T1098"
184name = "Account Manipulation"
185reference = "https://attack.mitre.org/techniques/T1098/"
186[[rule.threat.technique.subtechnique]]
187id = "T1098.001"
188name = "Additional Cloud Credentials"
189reference = "https://attack.mitre.org/techniques/T1098/001/"
190
191
192
193[rule.threat.tactic]
194id = "TA0004"
195name = "Privilege Escalation"
196reference = "https://attack.mitre.org/tactics/TA0004/"
197
198[rule.investigation_fields]
199field_names = [
200 "@timestamp",
201 "user.name",
202 "user_agent.original",
203 "source.ip",
204 "aws.cloudtrail.user_identity.arn",
205 "aws.cloudtrail.user_identity.type",
206 "aws.cloudtrail.user_identity.access_key_id",
207 "user.target.name",
208 "event.action",
209 "event.outcome",
210 "cloud.region",
211 "cloud.account.id",
212 "aws.cloudtrail.request_parameters",
213 "aws.cloudtrail.response_elements",
214]
Triage and analysis
Disclaimer: 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.
Investigating AWS IAM User Created Access Keys For Another User
AWS IAM access keys are long-term credentials that grant programmatic access to AWS resources. The iam:CreateAccessKey permission allows an IAM principal to generate new access keys for an existing IAM user.
While this operation can be legitimate (for example, credential rotation), it can also be abused to establish persistence or privilege escalation if one user creates keys for another account without authorization.
This rule identifies CreateAccessKey API calls where the calling user (aws.cloudtrail.user_identity.arn) differs from the target user (aws.cloudtrail.request_parameters.userName), indicating one IAM identity creating credentials for another.
Possible investigation steps
-
Confirm both user identities and intent.
Identify the calling user (who performedCreateAccessKey) and the target user (whose access key was created). Contact both account owners or application teams to confirm if this operation was expected. -
Review CloudTrail event details.
Check the following fields directly in the alert or corresponding CloudTrail record:source.ip— does it align with expected corporate ranges or known admin automation?user_agent.original— AWS Console, CLI, SDK, or custom client? Unexpected user agents (for example, non-SDK scripts) may indicate manual or unauthorized use.source.geofields — verify the location details are expected for the identity.
-
Correlate with related IAM activity.
In CloudTrail, search for subsequent or nearby events such as:AttachUserPolicy,AttachGroupPolicy,UpdateAssumeRolePolicy, orCreateUser.
These can indicate privilege escalation or lateral movement.
Also review whether the same principal recently performedCreateAccessKeyfor multiple users or repeated this action across accounts.
-
Inspect the new access key’s usage.
Search for the newly created key ID (aws.cloudtrail.response_elements.accessKey.accessKeyId) in CloudTrail events following creation. Determine if it was used from unusual IP addresses, geographies, or services. -
Assess the risk of credential compromise.
If you suspect malicious behavior, consider the following indicators:- A non-admin user invoking
CreateAccessKeyfor another user. - Creation outside of normal automation pipelines.
- Use of the new key from a different IP or AWS account soon after creation.
- A non-admin user invoking
-
Scope related activity.
Review all activity from the calling user in the past 24–48 hours, focusing oniam:*API calls and resource creation events.
Correlate any S3, EC2, or KMS access attempts made using the new key to identify potential impact or data exposure.
False positive analysis
- Expected credential rotation.
Some environments delegate credential rotation responsibilities to centralized automation or specific admin roles. Confirm if the calling user is authorized for such actions. - Administrative workflows.
Account provisioning systems may legitimately create keys on behalf of users. Check for standard tags, automation tools, or user agents that indicate managed operations. - Service-linked roles or external IAM automation.
Some AWS services create or rotate credentials automatically. Validate if the caller is a service-linked role or an automation IAM role used by a known deployment process.
Response and remediation
AWS IR playbooks classify unauthorized credential creation as a Priority-1 incident because it may allow persistence or privilege escalation.
The following steps scale for organizations with or without a dedicated IR team.
1. Immediate containment
- Deactivate or delete the access key from the target IAM user immediately using the AWS Console, CLI, or API (
DeleteAccessKey). - Rotate or reset credentials for both the calling and target users to eliminate possible compromise.
- Restrict risky principals. Temporarily deny
iam:CreateAccessKeyandiam:UpdateAccessKeypermissions for non-administrative roles while scoping the incident. - Enable or confirm MFA on both accounts involved, if not already enforced.
2. Evidence preservation
- Export all related
CreateAccessKey,DeleteAccessKey, andUpdateAccessKeyevents within ±30 minutes of the alert to an evidence bucket. - Preserve CloudTrail, GuardDuty, and AWS Config data for the same period.
- Record key event details: caller ARN, target user,
accessKeyId,source.ip,userAgent, and timestamps.
3. Scoping and investigation
- Search CloudTrail for usage of the new access key ID after creation. Identify any API activity or data access tied to it.
- Review IAM policy changes, group modifications, or new role assumptions around the same time.
- Determine if any additional credentials or trust policy changes were made by the same actor.
- Check for GuardDuty findings referencing anomalous credential usage or suspicious API behavior.
4. Recovery and hardening
- Remove or disable any unauthorized keys and re-enable only verified credentials.
- Implement least-privilege IAM policies to limit which users can perform
CreateAccessKey. - Monitor for future
CreateAccessKeyevents whereuserIdentity.arn != request_parameters.userName. - Ensure Cloudtrail, GuardDuty and Security Hub are active across all regions.
- Educate administrative users on secure key rotation processes and the risk of cross-user key creation.
Additional information
- AWS IR Playbooks: Reference “Credential Compromise” and “IAM Misuse” procedures for containment and recovery.
- AWS Customer Playbook Framework: See “Identity Access Review” and “Unauthorized Access Key Creation” for example response flows.
- AWS Documentation: Best practices for managing access keys.
- Security Best Practices: AWS Knowledge Center – Security Best Practices.
References
Related rules
- AWS IAM AdministratorAccess Policy Attached to Group
- AWS IAM AdministratorAccess Policy Attached to Role
- AWS IAM AdministratorAccess Policy Attached to User
- AWS IAM Login Profile Added for Root
- AWS IAM Create User via Assumed Role on EC2 Instance