How the attack works
IAM users can have up to two access keys. A principal allowed to call iam:CreateAccessKey on other users (directly, through iam:*, or through a broad managed policy) can mint a new key for any of them and act as that user from anywhere, with no MFA and no console sign-in.
Attackers use this to escalate (creating a key for an administrator) or to persist (adding a second key to a user that already has one, so the legitimate key keeps working and nothing breaks). In CloudTrail the call shows who made it (userIdentity) and whose key was created (requestParameters.userName). A quieter variant needs no new key at all, because UpdateAccessKey can set an inactive key of the user back to active, and a credential that everyone believed retired works again.
What an attacker needs
- Credentials for a principal allowed to call iam:CreateAccessKey on the target user.
- A target IAM user with fewer than two existing access keys.
Impact
Long-term programmatic access with the target user's permissions. If the target is an administrator, the result is full account compromise; even unprivileged keys give a durable foothold that is easy to miss among existing keys.
Detection rules
IAM Access Key Status Changed for a Named User
Detects UpdateAccessKey calls that name a target user. UpdateAccessKey changes the status of an existing access key, and the IAM API reference gives Active and Inactive as the values: a call that sets an inactive key back to Active revives a credential that was believed retired, without a new key appearing in the account. The Threat Technique Catalog for AWS lists UpdateAccessKey next to CreateAccessKey under additional cloud credentials. The rule does not read the new status, because AWS publishes no example record that shows where the event carries it: read the request parameters, and compare the caller (userIdentity.arn) with requestParameters.userName. A call without a user name in the request is not matched. It also matches attempts that failed (errorCode present): check errorCode, because an unauthorized attempt is worth seeing.
title: IAM Access Key Status Changed for a Named User
id: 47fa0075-124f-4ba7-b9f7-c62ca40f502b
status: experimental
description: >-
Detects UpdateAccessKey calls that name a target user. UpdateAccessKey
changes the status of an existing access key, and the IAM API reference
gives Active and Inactive as the values: a call that sets an inactive key
back to Active revives a credential that was believed retired, without a
new key appearing in the account. The Threat Technique Catalog for AWS
lists UpdateAccessKey next to CreateAccessKey under additional cloud
credentials. The rule does not read the new status, because AWS publishes
no example record that shows where the event carries it: read the request
parameters, and compare the caller (userIdentity.arn) with
requestParameters.userName. A call without a user name in the request is
not matched.
It also matches attempts that failed (errorCode present): check errorCode,
because an unauthorized attempt is worth seeing.
references:
- https://docs.aws.amazon.com/IAM/latest/APIReference/API_UpdateAccessKey.html
- https://aws-samples.github.io/threat-technique-catalog-for-aws/Techniques/T1098.001.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/cloudtrail-integration.html
- https://attack.mitre.org/techniques/T1098/001/
author: Forestall
date: 2026-11-18
tags:
- attack.persistence
- attack.t1098.001
logsource:
product: aws
service: cloudtrail
detection:
selection:
eventSource: iam.amazonaws.com
eventName: UpdateAccessKey
requestParameters.userName|exists: true
condition: selection
falsepositives:
- Key rotation by administrators and rotation automation, which sets the old key to inactive before deleting it. Add the rotation roles to a filter_* selection on userIdentity.arn.
- Containment of an exposed key by the response team, and reactivation of a key that was switched off by mistake.
level: low
False positives
- Key rotation by administrators and rotation automation, which sets the old key to inactive before deleting it. Add the rotation roles to a filter_* selection on userIdentity.arn.
- Containment of an exposed key by the response team, and reactivation of a key that was switched off by mistake.
IAM Access Key Created for a Named User
Detects CreateAccessKey calls that name a target user. Triage by comparing the caller (userIdentity.arn) with requestParameters.userName: keys created for someone else are the escalation and persistence pattern. It also matches attempts that failed (errorCode present): check errorCode, because an unauthorized attempt is worth seeing.
title: IAM Access Key Created for a Named User
id: ded59287-4409-456b-8283-0598877d99fb
status: experimental
description: >-
Detects CreateAccessKey calls that name a target user. Triage by comparing
the caller (userIdentity.arn) with requestParameters.userName: keys created
for someone else are the escalation and persistence pattern.
It also matches attempts that failed (errorCode present): check errorCode,
because an unauthorized attempt is worth seeing.
references:
- https://attack.mitre.org/techniques/T1098/001/
author: Forestall
date: 2026-11-10
tags:
- attack.persistence
- attack.t1098.001
logsource:
product: aws
service: cloudtrail
detection:
selection:
eventSource: iam.amazonaws.com
eventName: CreateAccessKey
requestParameters.userName|exists: true
condition: selection
falsepositives:
- Administrators provisioning keys for service users, and identity automation; allow-list the automation roles.
level: medium
False positives
- Administrators provisioning keys for service users, and identity automation; allow-list the automation roles.
Detection logic
Patterns that need more than one event, a baseline or knowledge of your own environment. Each is a hypothesis to build and tune in your SIEM, not a ready rule.
Inactive access key set back to active and used again
Old keys are set to inactive during rotation and then forgotten. An attacker who holds such a key and can call UpdateAccessKey switches it back on and uses it, and no new credential appears in the account. The reactivation matters together with the use that follows it.
- An
UpdateAccessKeyevent fromiam.amazonaws.comwhose request sets the Status parameter to Active. Note the AccessKeyId and UserName parameters of the request and the caller inuserIdentity.arn. - Look back for the earlier
UpdateAccessKeycall that set the same key to Inactive. The longer the key was inactive, the less likely the reactivation is routine. - After the reactivation, collect the events whose
userIdentity.accessKeyIdis that key and comparesourceIPAddressanduserAgentwith the last use before the key was switched off.
EventsUpdateAccessKey
LimitsA rotation that is rolled back because an application still needed the old key looks the same, although its use continues from the known address. AWS publishes no example record of UpdateAccessKey, so check on one of your own events where the status and the key ID appear before you build the search.
New access key used from an address the user never used
A key that an administrator creates for a service user goes into the configuration of that service and is used from its hosts. A key that an attacker creates for someone else is used within minutes, from the address of the attacker, which the owner of the key has never called from.
- A
CreateAccessKeyevent fromiam.amazonaws.comwith a user inrequestParameters.userName. Note the AccessKeyId of the new key, which the call returns in its response. - Within 60 minutes, collect the events whose
userIdentity.accessKeyIdis the new key, withsourceIPAddressanduserAgent. - Compare the source address with the addresses that the other keys and the console sessions of that user (
userIdentity.userName) used in the weeks before, and alert when it is new.
EventsCreateAccessKey
LimitsA new service or a new host that receives its first key has no history either, so the comparison needs the context of who created the key. The 60 minutes are a starting point. AWS publishes no example record of CreateAccessKey, so check on one of your own events where the new key ID appears.
Triage
- Compare the caller (userIdentity.arn) with the key owner (requestParameters.userName); a key created for someone else is the strongest signal.
- Check the source IP address and user agent against normal automation.
- Deactivate unexplained keys immediately and review CloudTrail for their use.
Response
Once the attack is confirmed:
- Set the new access key to inactive, together with any other key the same caller created in that period. Deactivation stops API calls signed with the key and can be undone; delete the keys once you have reviewed what they were used for.
- Deny the sessions that were opened with the key. Temporary credentials requested with it, for example through
GetSessionTokenorGetFederationToken, stay valid until they expire, so attach a policy to the target user that denies requests made with credentials issued before the time of containment (condition keyaws:TokenIssueTime). - Contain the caller. Deactivate the access keys of the principal that created the key, or revoke its sessions if it is a role, because it can create another key for as long as it keeps
iam:CreateAccessKeyon other users. - Review what the target user did with the new key and undo it, with priority on new users, roles, access keys, login profiles and policy changes.
- Check the keys of the other privileged users in the account for keys that nobody owns, and confirm in CloudTrail that the deactivated key is no longer used.
Mitigation
- Prefer IAM Identity Center and roles with temporary credentials; minimize IAM users with access keys.
- Restrict iam:CreateAccessKey to self-service on the caller's own user (Resource
arn:aws:iam::*:user/${aws:username}) and to break-glass roles. - Remove unused and duplicate keys, rotate the rest, and alert on key creation for privileged users.
Frequently asked questions
Does the rule fire only when the key is created for a different user?
No. It matches every `CreateAccessKey` call that names a user in `requestParameters.userName`, whoever made the call. The rule does not compare the caller with the key owner, so a provisioning role and an attacker produce the same alert. Make that comparison in triage or in a SIEM filter, and note that a call without a user name in the request is not matched.
Why does a password reset on the target user not remove a key created this way?
An access key is a separate long-term credential. Requests signed with it do not go through the console sign-in, so the password of the user and the MFA device used at sign-in play no part. The key keeps working until it is set to inactive or deleted, which is why attackers use it as a backdoor that survives password resets.
What does a harmless CreateAccessKey event look like?
Administrators provisioning a key for a service user and identity automation produce the same event, from roles and networks you know. Look closer when the key is for a privileged user, when it is a second key on a user that already has one, or when the caller has never managed keys before. A second key lets the legitimate key keep working, so nothing breaks and nobody notices.
Does the rule also show attempts that were denied?
Yes. It matches the call whether it succeeded or not, and a failed call carries an errorCode. A denied attempt to create a key for another user means that someone tested the permission. No key exists in that case, but the caller and its source address are worth reviewing.