1. Resources
  2. Identity Threats
  3. AWS

AWS IAM Enumeration

Also known as: IAM reconnaissance, AWS account discovery, IAM permission enumeration, GetAccountAuthorizationDetails enumeration, AWS whoami

An attacker with any AWS credential identifies the principal behind it and maps the account's users, groups, roles, policies and trust relationships to find a path to more privilege.

Platform
AWS
Tactic
Discovery
Impact
Low
Last updated
Attack difficulty
Low
Detection difficulty
Medium
Privileges required: Any authenticated identity
Any valid AWS credential. sts:GetCallerIdentity needs no permission; the full inventory needs IAM read actions such as iam:GetAccountAuthorizationDetails or iam:List*.
What the attacker gains
The identity behind the credential and a map of users, roles, policies and role trust: the input for every privilege escalation and lateral movement step.
Threat groups
APT29Storm-0501Scattered SpiderShinyHuntersGroups that MITRE ATT&CK records using T1087.004, T1069.003, T1580, T1526.

How it works

Every AWS API request is signed with a credential, and AWS resolves it to a principal before it decides whether to allow the call. An attacker who obtains a credential, from a file, a CI secret or an instance, usually knows nothing about it: not the account, not the principal, not the permissions. IAM enumeration answers those questions with the same read APIs that administrators and compliance tools use.

The questions come in a fixed order:

  1. Who am I? sts:GetCallerIdentity returns the account ID, the ARN and the unique ID of the caller. It needs no permission and cannot be denied. The ARN already says a lot: an IAM user, an assumed role and its session name, or a federated user.
  2. What can I do? For an IAM user: group memberships, managed policies attached to the user and its groups, and inline policies. For a role: its attached and inline policies. A managed policy attachment is only a pointer; the statements are in the policy's default version.
  3. Who else is there? Users, groups, roles and customer managed policies of the whole AWS IAM account. GetAccountAuthorizationDetails returns all of it in one call, including each role's trust policy.
  4. Where can I go? A role's trust policy (AssumeRolePolicyDocument) names the principals that may assume it. Reading every trust policy shows which roles the current identity can enter, in this account and from others. See AssumeRole.
  5. Which credentials are weak? The credential report lists every user with password, MFA and access key status and last-used dates. GetAccessKeyLastUsed gives the last service and Region for one key.

Effective access is more than the sum of allows. Explicit denies override allows, and a permissions boundary, a session policy or an organization's service control policy can cap what an identity policy grants. Enumeration that stops at "the policy says Allow" overstates access; tools that simulate the evaluation get closer.

When the principal cannot read IAM at all, the fallback is brute force: call many read-only operations and see which ones succeed.

Prerequisites

  • A working AWS credential of any kind: a long-term access key (AKIA...), temporary credentials with a session token (ASIA...), or a console session. The key prefix is only a hint about the type.
  • Network access to the AWS API endpoints.
  • For the structured inventory: IAM read permissions on the principal. ReadOnlyAccess, SecurityAudit, IAMReadOnlyAccess or a broad iam:Get* and iam:List* grant are enough.
  • For brute force: nothing beyond the credential.

Attack steps

For authorized security testing and lab use only. Run these steps against systems you own or have written permission to assess.

1. Identify the credential

# Which account does this key ID belong to? (no need to hold the secret)
aws sts get-access-key-info --access-key-id AKIAIOSFODNN7EXAMPLE

# Who does AWS think I am?
aws sts get-caller-identity
{
    "UserId": "AIDAEXAMPLEUSERID",
    "Account": "111122223333",
    "Arn": "arn:aws:iam::111122223333:user/alice"
}

2. Read the principal's own permissions

# Groups, attached managed policies and inline policies of an IAM user
aws iam list-groups-for-user --user-name alice
aws iam list-attached-user-policies --user-name alice
aws iam list-user-policies --user-name alice
aws iam get-user-policy --user-name alice --policy-name inline-policy-name

# The statements of a managed policy are in its default version
aws iam get-policy --policy-arn arn:aws:iam::111122223333:policy/app-policy
aws iam get-policy-version --policy-arn arn:aws:iam::111122223333:policy/app-policy --version-id v1

3. Take the whole inventory

# Everything in one snapshot: users, groups, roles, policies, memberships, trust
aws iam get-account-authorization-details > iam-snapshot.json

# Or piece by piece
aws iam list-users
aws iam list-roles
aws iam get-role --role-name app-role
aws iam list-attached-role-policies --role-name app-role
aws iam list-role-policies --role-name app-role

Check IsTruncated on list responses: a page boundary hides the rest.

4. Find weak credentials

aws iam generate-credential-report
aws iam get-credential-report --query Content --output text | base64 -d > credential-report.csv

aws iam list-access-keys --user-name alice
aws iam get-access-key-last-used --access-key-id AKIAIOSFODNN7EXAMPLE

The report shows users without MFA, passwords and keys that were never rotated, and keys that are active but unused.

5. Test what is allowed

aws iam simulate-principal-policy \
    --policy-source-arn arn:aws:iam::111122223333:user/alice \
    --action-names iam:PassRole iam:CreateAccessKey sts:AssumeRole

6. Automate it

Pacu stores the results per session and feeds them to its privilege escalation modules:

pip3 install -U pacu
pacu        # first launch: name a session, then run set_keys and enter the key pair

pacu --session audit --module-name iam__enum_users_roles_policies_groups --exec
pacu --session audit --module-name iam__enum_permissions --exec

CloudFox summarizes principals, permissions and role trust across an account:

cloudfox aws --profile target all-checks
cloudfox aws --profile target principals
cloudfox aws --profile target permissions
cloudfox aws --profile target role-trusts

7. Brute force when IAM cannot be read

# enumerate-iam: try read-only calls across services and report which succeed
./enumerate-iam.py --access-key AKIAIOSFODNN7EXAMPLE --secret-key <secret-access-key>

# Pacu equivalent
pacu --session audit --module-name iam__bruteforce_permissions --exec

Impact

Enumeration changes nothing in the account, and its direct impact is information. Its value is what it enables. With the inventory an attacker can pick the shortest route to administrator: a policy they can rewrite (CreatePolicyVersion), a role they can pass to a service (PassRole), a role whose trust policy lets them in (cross-account role trust abuse), or a user without MFA and with an old access key.

The inventory also tells the attacker what to avoid: which roles belong to security tooling, which keys are in daily use, and whether the caller is likely a honeytoken.

OPSEC and artifacts

  • One call instead of hundreds. GetAccountAuthorizationDetails returns the whole configuration in a few paginated requests, which is far quieter than walking users, groups and roles one by one. It is also rarely called by workloads, so the event stands out: GetAccountAuthorizationDetails.
  • Read your own policies first. Listing only the current principal's policies produces a handful of events that resemble an SDK or a deployment tool starting up.
  • Avoid brute force. A permission brute force leaves a dense burst of denied calls (errorCode AccessDenied, or Client.UnauthorizedOperation for EC2) across many services from one principal within minutes. Operators use it only when nothing else works.
  • Look like the owner. Calls from the expected network range, with the user agent of the AWS CLI or SDK the workload uses, blend into the key's history. A key that has only ever been used by one Lambda function and now calls IAM from a workstation does not.
  • What CloudTrail keeps: one management event per request with eventSource, eventName, userIdentity (including accessKeyId and, for role sessions, sessionContext.sessionIssuer), sourceIPAddress, userAgent, awsRegion and errorCode. Read events are in Event history for 90 days and in a trail only if it logs read management events.
  • What it does not keep: the response. A ListUsers event is a count of requests, not of users returned. The credential report content is not logged either, only that it was generated and retrieved.
  • GetCallerIdentity is recorded, but on its own it has weak specificity: every SDK session and many health checks call it.

Detection

The same calls are made all day by consoles, infrastructure-as-code tools and compliance scanners, so detection is about the caller, not the call.

  • Inventory calls by a principal that never made them. The IAM enumeration rules watch GetAccountAuthorizationDetails, credential report generation and broad List* activity by principals outside the known audit and deployment roles.
  • Bursts of denied calls. Many distinct denied operations by one principal in a short window: the permission enumeration by brute force rules.
  • A workload identity doing human things. An instance role or a CI role that calls IAM list operations it has never needed.
  • GetCallerIdentity from a new place. A long-term key that calls it from an address, Region or user agent it has not used before, shortly followed by IAM reads.
  • GuardDuty. The Discovery:IAMUser/AnomalousBehavior finding reports discovery API calls that are unusual for the principal.
-- Identity discovery calls per caller, including denied ones (Athena, CloudTrail table)
SELECT useridentity.arn AS caller,
       useridentity.accesskeyid AS access_key,
       sourceipaddress,
       eventsource,
       eventname,
       errorcode,
       count(*) AS requests
FROM cloudtrail_logs
WHERE eventtime >= '2026-11-28T00:00:00Z'
  AND eventtime <  '2026-11-29T00:00:00Z'
  AND (
      (eventsource = 'iam.amazonaws.com'
          AND (eventname LIKE 'List%'
               OR eventname IN ('GetAccountAuthorizationDetails',
                                'GenerateCredentialReport', 'GetCredentialReport',
                                'SimulatePrincipalPolicy')))
      OR (eventsource = 'sts.amazonaws.com' AND eventname = 'GetCallerIdentity')
      OR (eventsource = 'organizations.amazonaws.com' AND eventname = 'ListAccounts')
  )
GROUP BY 1, 2, 3, 4, 5, 6
ORDER BY requests DESC

The filter includes failures; a denied list call is evidence of an attempt. Compare each caller with scheduled compliance jobs and deployment roles before escalating, and do not infer the tool from the API sequence, which SDKs, consoles and scanners share. An empty result means little until you have confirmed that the trail logs read management events for the account and Region in question.

Mitigation

  • Remove IAM read rights from identities that do not need them. Application roles rarely need iam:List*, iam:Get* or iam:GetAccountAuthorizationDetails. Keep them in dedicated audit roles, and review broad managed policies such as ReadOnlyAccess on workloads.
  • Prefer temporary credentials. Enumeration starts with a credential someone found. Fewer long-term access keys means fewer starting points; the IAM Identity Center guide covers moving people off IAM users. See also access key theft.
  • Cap what any identity can reach. Service control policies and permissions boundaries limit the damage of whatever the attacker finds, and explicit denies on sensitive actions hold even when an identity policy is too broad.
  • Tighten role trust. A trust policy that names an account root or uses a wildcard principal turns enumeration into access. Bind trust to specific principals and conditions.
  • Log read management events in an organization trail with retention beyond the 90 days of Event history, and enable GuardDuty in every account and Region.
  • Plant a canary. An unused IAM user with an access key and no permissions, placed where an attacker would look, turns the first GetCallerIdentity into a high-fidelity alert.

Detection rules for this attack

Log events to collect

FAQ

Can sts:GetCallerIdentity be blocked?

No. AWS documents that no permissions are required for this operation, and that it still works when a policy explicitly denies sts:GetCallerIdentity, because the same information is returned in an access denied message anyway. It is the usual first call with a found key. The call is recorded in CloudTrail, which makes it a useful signal when the caller or source is unfamiliar.

What is the single most valuable IAM enumeration call?

iam:GetAccountAuthorizationDetails. One call (paginated) returns every user, group, role and customer managed policy in the account, with inline policies, attachments, group memberships and role trust policies. AWS describes it as a snapshot of the account's IAM permission configuration. Few workloads need it, so a new caller is worth an alert.

How does an attacker find permissions without IAM read access?

By trying. Tools such as enumerate-iam and Pacu's iam__bruteforce_permissions module call harmless read operations across many services and note which succeed. No IAM permission is needed, and the price is a burst of denied calls from one principal in CloudTrail, which is one of the clearest signs of a credential in the wrong hands.

Does IAM enumeration show up in CloudTrail?

Yes. IAM and STS calls are management events, and read-only management events are recorded in Event history for 90 days. A trail only stores them if it is configured to log read management events. The log shows the request, not the answer: a ListUsers event does not tell you how many users were returned.

References

Techniques, tactics and threat groups: MITRE ATT&CK® Enterprise v20.1. © The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation. Last updated 2026-11-29.

Does this attack work in your environment?

Forestall maps every identity and the attack paths between them across Active Directory, Entra ID and cloud, read-only and agentless.