How the attack works
A stolen access key or role session does not say what it may do. If the principal cannot read its own policies, the attacker finds out by trying: one harmless read call after another across IAM, EC2, S3, Lambda, Secrets Manager and other services, usually from a script that runs through a long list of operations in a few minutes. Every call that succeeds marks a permission, and the calls that fail are discarded.
CloudTrail keeps them. A request that is rejected for missing permissions is recorded like any other event, with the reason in errorCode. In its own guidance on finding unauthorized calls AWS uses AccessDenied and, for Amazon EC2, Client.UnauthorizedOperation, and it states that a significant number of unauthorized API calls by one principal can indicate that the principal is compromised. A single denied call is everyday noise from misconfigured applications. What sets the enumeration apart is its breadth: many different operations, across many services, by one principal in a short time. The rules on this page count exactly that. Most of the calls are read operations, so the trail has to log Read management events.
What an attacker needs
- Valid credentials for any principal, for example a leaked access key or a role session taken from a workload.
- No permission is needed for the attempts themselves. They are recorded whether they succeed or not.
Impact
A list of what the credential can do, without the attacker having to read a single policy. Nothing is changed by the enumeration itself. It tells the attacker which data can be read and which escalation path is open, and for the defender it is often the earliest sign that a credential is in the wrong hands.
Detection rules
API Calls Denied in Many Services for One Principal
Counts, per calling principal (userIdentity.arn), in how many different AWS services (eventSource) a call was denied for it. Denied calls in five or more services within 10 minutes show breadth: a workload calls the few services it was built for, while someone who tests a credential walks through services it has never used. The rule complements the count of different denied operations on this page, which a single misbehaving application can reach inside one service. The count and the window are starting points to tune. Most of the attempts are read operations, so the trail has to log Read management events. For role sessions the principal is the session ARN, so one role used with different session names is counted per session.
Fires when one userIdentity.arn has at least 5 different eventSource values within 10 minutes.
title: AWS API Call Denied (Denied Services Base Event)
id: 2dc1923c-3552-48ca-8616-11b5042bbd71
name: aws_api_call_denied_services
status: experimental
description: >-
Base event of the threshold rule in this file. Any CloudTrail event whose
errorCode contains AccessDenied or UnauthorizedOperation, which are the
codes AWS uses in its own queries for unauthorized calls
(AccessDenied, and Client.UnauthorizedOperation for Amazon EC2).
logsource:
product: aws
service: cloudtrail
detection:
selection:
errorCode|contains:
- AccessDenied
- UnauthorizedOperation
condition: selection
level: low
---
title: API Calls Denied in Many Services for One Principal
id: 1144674f-f926-47b1-bec4-50dc2b67e47c
status: experimental
description: >-
Counts, per calling principal (userIdentity.arn), in how many different
AWS services (eventSource) a call was denied for it. Denied calls in five
or more services within 10 minutes show breadth: a workload calls the few
services it was built for, while someone who tests a credential walks
through services it has never used. The rule complements the count of
different denied operations on this page, which a single misbehaving
application can reach inside one service. The count and the window are
starting points to tune. Most of the attempts are read operations, so the
trail has to log Read management events. For role sessions the principal
is the session ARN, so one role used with different session names is
counted per session.
references:
- https://aws.amazon.com/blogs/security/logging-strategies-for-security-incident-response/
- https://repost.aws/knowledge-center/cloudwatch-logs-analyze
- https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference-record-contents.html
- https://attack.mitre.org/techniques/T1580/
author: Forestall
date: 2026-11-18
tags:
- attack.discovery
- attack.t1580
correlation:
type: value_count
rules:
- aws_api_call_denied_services
group-by:
- userIdentity.arn
timespan: 10m
condition:
field: eventSource
gte: 5
falsepositives:
- Security posture scanners and inventory tools whose role lacks part of the permissions they try, and administrators who browse the console with a narrow role. Exclude those roles or complete their policy.
- The values of 5 services and 10 minutes are starting points, not tested limits. Measure what your own tools produce and adjust both.
level: medium
False positives
- Security posture scanners and inventory tools whose role lacks part of the permissions they try, and administrators who browse the console with a narrow role. Exclude those roles or complete their policy.
- The values of 5 services and 10 minutes are starting points, not tested limits. Measure what your own tools produce and adjust both.
Many Different API Calls Denied for One Principal
Counts, per calling principal (userIdentity.arn), how many different operations (eventName) were denied for it. Fifteen or more different denied operations within 10 minutes is the pattern of someone trying one API after another to learn what a credential is allowed to do. An application with a missing permission fails on the same few operations again and again and stays below the count. AWS states that a significant number of unauthorized API calls by one principal can indicate that the principal is compromised. The count and the window are starting points to tune. Most of the attempts are read operations, so the trail has to log Read management events. For role sessions the principal is the session ARN, so one role used with different session names is counted per session.
Fires when one userIdentity.arn has at least 15 different eventName values within 10 minutes.
title: AWS API Call Denied (Denied Operations Base Event)
id: 7036a7dd-b3c0-4922-8bb6-18ccceaff7ff
name: aws_api_call_denied_operations
status: experimental
description: >-
Base event of the threshold rule in this file. Any CloudTrail event whose
errorCode contains AccessDenied or UnauthorizedOperation, which are the
codes AWS uses in its own queries for unauthorized calls
(AccessDenied, and Client.UnauthorizedOperation for Amazon EC2).
logsource:
product: aws
service: cloudtrail
detection:
selection:
errorCode|contains:
- AccessDenied
- UnauthorizedOperation
condition: selection
level: low
---
title: Many Different API Calls Denied for One Principal
id: 84a68f77-1cbe-4fc5-8940-d35ddd04d702
status: experimental
description: >-
Counts, per calling principal (userIdentity.arn), how many different
operations (eventName) were denied for it. Fifteen or more different
denied operations within 10 minutes is the pattern of someone trying one
API after another to learn what a credential is allowed to do. An
application with a missing permission fails on the same few operations
again and again and stays below the count. AWS states that a significant
number of unauthorized API calls by one principal can indicate that the
principal is compromised. The count and the window are starting points to
tune. Most of the attempts are read operations, so the trail has to log
Read management events. For role sessions the principal is the session
ARN, so one role used with different session names is counted per session.
references:
- https://aws.amazon.com/blogs/security/logging-strategies-for-security-incident-response/
- https://repost.aws/knowledge-center/cloudwatch-logs-analyze
- https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference-record-contents.html
- https://attack.mitre.org/techniques/T1580/
author: Forestall
date: 2026-11-18
tags:
- attack.discovery
- attack.t1580
correlation:
type: value_count
rules:
- aws_api_call_denied_operations
group-by:
- userIdentity.arn
timespan: 10m
condition:
field: eventName
gte: 15
falsepositives:
- Security posture scanners and inventory tools whose role lacks part of the permissions they try. Exclude the roles they use or complete their policy.
- A new deployment whose policy is incomplete, and consoles that load many panels for a user with narrow rights.
- The values of 15 different operations and 10 minutes are starting points, not tested limits. Measure what your own tools produce and adjust both.
level: medium
False positives
- Security posture scanners and inventory tools whose role lacks part of the permissions they try. Exclude the roles they use or complete their policy.
- A new deployment whose policy is incomplete, and consoles that load many panels for a user with narrow rights.
- The values of 15 different operations and 10 minutes are starting points, not tested limits. Measure what your own tools produce and adjust both.
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.
GetCallerIdentity from a new address followed by a burst of denied calls
The first thing most people do with a credential they found is ask who it belongs to. AWS requires no permission for GetCallerIdentity, so the call succeeds for every credential, and it is followed within minutes by the calls that test what the identity may do.
- A
GetCallerIdentityevent fromsts.amazonaws.com. Note the caller inuserIdentity.arn, itsuserIdentity.accessKeyIdand thesourceIPAddress. - Check whether that access key has called from this source address before. The keys of workloads call from the same few addresses.
- Within 15 minutes, count the events of the same caller that carry an access denied
errorCode, and alert when the address is new and the denied calls span several services (eventSource).
EventsGetCallerIdentity
LimitsDevelopers and deployment tools call GetCallerIdentity all the time, so the call alone means nothing, and the baseline of addresses is what makes the pattern useful. An actor who knows this skips the call. The 15 minutes are a starting point.
Access key that was idle for a long time becomes active again
Keys that nobody uses any more stay valid until someone removes them. When such a key suddenly makes calls, from a new place and with operations it never used, the likeliest explanation is that somebody else found it.
- Keep, for each
userIdentity.accessKeyIdwhoseuserIdentity.typeisIAMUser, the time of its last event and the event names it normally calls. - Alert when a key that made no call for 30 days or more becomes active again.
- Raise the priority when the new activity comes from a new
sourceIPAddress, uses event names the key never called before, or carries access denied errors.
LimitsKeys of jobs that run once a quarter and of emergency users wake up in the same way. The 30 days are a starting point. The search needs a long history of events for every key, and Event history keeps only 90 days.
Triage
- Identify the principal (userIdentity.arn), its access key, the source address and the user agent. Decide whether this is a scanner you run, a new deployment with an incomplete policy, or a workload identity that has no reason to call these services.
- List the event sources and event names that were denied. An application with a missing permission fails on the same few calls again and again, while an enumeration touches many services once each.
- List the calls by the same principal that succeeded in the same period, because they are what the attacker learned and may already have used.
- Check whether the access key is being used from a new address, and whether GetCallerIdentity was called shortly before the burst.
Response
Once the attack is confirmed:
- Deactivate the access key or revoke the role sessions of the principal, and rotate the credential at its source.
- Go through the calls that succeeded during and after the enumeration and treat what they returned as known to the attacker, with priority on secrets, data and IAM information.
- Review what the principal did after the burst, with priority on IAM write calls, new credentials and AssumeRole calls.
- Find out how the credential was exposed, for example in code, in a build log or on a compromised workload, and close that source.
- Reduce the permissions of the principal to what its work needs before the credential goes back into use.
Mitigation
- Replace long-term access keys with roles and temporary credentials, so that a leaked credential expires before it can be explored.
- Give each workload only the permissions it uses and remove wildcard actions from policies, so that an enumeration finds little.
- Record Read management events in a trail or event data store. Most enumeration calls are read-only events, and a trail that keeps only Write events holds no trace of them.
- Know which of your tools probe many APIs by design, such as posture scanners and inventory tools, and give them dedicated roles so that they can be told apart.
Frequently asked questions
Which error codes do the threshold rules count?
Every event whose `errorCode` contains `AccessDenied` or `UnauthorizedOperation`. AWS uses `AccessDenied` and, for Amazon EC2, `Client.UnauthorizedOperation` in its own queries for unauthorized calls. The rules match a part of the code, so that longer forms of the same codes are counted too.
How is this different from the IAM enumeration page?
IAM enumeration reads the IAM service to map users, roles and policies, and its calls mostly succeed. Here the attacker cannot or does not read IAM and learns the permissions by trying operations across all services, so most calls are denied. The rule on that page counts different IAM read operations. The rules on this page count different denied operations and services.
Which legitimate activity produces many denied calls?
Security posture scanners and inventory tools whose role lacks some permissions, a new deployment whose policy is not complete yet, and consoles that load many panels for a user with narrow rights. They repeat the same pattern from known roles. A burst from a workload role, an application user or a new source address is a different matter.
References
- MITRE ATT&CK T1580: Cloud Infrastructure Discovery
- AWS Security Blog: Logging strategies for security incident response (unauthorized attempts)
- AWS re:Post Knowledge Center: analyze CloudTrail logs with CloudWatch Logs Insights (AccessDenied and UnauthorizedOperation)
- CloudTrail record contents (errorCode, eventSource, eventName)
- CloudTrail userIdentity element
- Logging management events (Read and Write events)
- AWS STS API Reference: GetCallerIdentity
- Revoke IAM role temporary security credentials