Most AWS accounts I review don’t have one big IAM problem. They have the same ten small ones, left behind by years of “just give it admin for now” and a few people who have since left the company. None of them is exotic, and most take an afternoon to fix once you know where to look.

This post is the list I work through, in roughly the order I check it. For each finding there’s why it matters, how to check your own account, and the fix. If you only have an hour, run the checks and write down what comes back. That list is already better than most of the IAM documentation I’m handed at the start of an engagement.

The ten findings at a glance

#FindingHow to checkFix
1Root user has access keys or is used day to dayget-account-summary, credential reportDelete keys, MFA, centralize root access
2Active access keys nobody can explainCredential reportDeactivate, replace with roles
3Trust policies that trust too muchAccess Analyzer external access, list-roles queryPin principals, add sts:ExternalId and sub conditions
4iam:PassRole on "Resource": "*"Authorization-details scriptScope to role ARNs + iam:PassedToService
5AdministratorAccess attached to machineslist-entities-for-policyScoped deploy roles
6Roles and permissions nobody usesRoleLastUsed, Access Analyzer unused accessDelete, or trim to what’s used
7Anyone who can create roles can create an adminLook for iam:CreateRole without conditionsRequire a permissions boundary
8Humans with long-lived credentials and no MFACredential reportIdentity Center
9Nothing at the organization level stops any of thislist-policies --filter SERVICE_CONTROL_POLICYA small set of SCPs
10Nobody would notice an IAM changeEventBridge rules in us-east-1Alerts on root, keys, policy changes

Everything below uses the AWS CLI v2. Run it with a read-only role (the AWS managed SecurityAudit policy is enough for the checks; the fixes need more).

Before you start: get the raw material

Two exports answer most of the questions in this post. Pull them once and keep them next to you:

# Every user, when they last signed in, key age, key last used, MFA status
aws iam generate-credential-report
aws iam get-credential-report --query Content --output text | base64 -d > credential-report.csv

# Every user, group, role and policy, with the policy documents
aws iam get-account-authorization-details --output json > auth.json

On macOS use base64 -D. The credential report can take a few seconds to generate; if get-credential-report says it isn’t ready, run it again.

1. The root user has access keys, or someone uses it

What I find: root access keys that were created years ago “for a script”, root sign-ins in CloudTrail from the last month, or root MFA on a phone that belonged to someone who left.

Why it matters: root can’t be restricted by IAM policies or by SCPs in the management account. A leaked root key is the whole account.

Check:

aws iam get-account-summary \
  --query 'SummaryMap.{RootKeys:AccountAccessKeysPresent,RootMFA:AccountMFAEnabled}'

You want RootKeys: 0 and RootMFA: 1. Then check the first row of credential-report.csv (<root_account>) for password_last_used. If it’s recent and nobody can say why, that’s the first conversation to have.

Fix: delete the root access keys (there is no legitimate use for them), put MFA on root, and if you run AWS Organizations, take root credentials away from member accounts entirely with centralized root access:

# Run in the management account
aws organizations enable-aws-service-access --service-principal iam.amazonaws.com
aws iam enable-organizations-root-credentials-management
aws iam enable-organizations-root-sessions

After that you can delete the root credentials of member accounts, and new accounts are created without them. The few tasks that require root (unlocking a misconfigured S3 bucket policy, for example) are done through a short-lived privileged session from the management account.

2. Active access keys nobody can explain

What I find: keys older than a year, keys on users named after people who left, and keys whose “last used” date is empty because they were never used but were never deleted either.

Why it matters: long-lived keys are how most AWS accounts get breached. They end up in Git history, CI logs, laptops and paste sites, and they keep working until someone deletes them. I wrote about how leaked keys end up for sale separately.

Check: in credential-report.csv, filter for access_key_1_active or access_key_2_active = true, then look at access_key_N_last_rotated and access_key_N_last_used_date. For a single key:

aws iam get-access-key-last-used --access-key-id AKIA...

Fix: for every active key, find the owner and what it’s used for, replace it with a role, deactivate it, wait, then delete it. Deactivate first, because a deactivated key can be turned back on if something breaks. The full migration, including what to replace each kind of key with, is in Stop Using IAM Users.

3. Trust policies that trust too much

This is the finding with the biggest gap between how serious it is and how rarely anyone looks at it. A role’s permissions policy says what it can do; its trust policy says who can become it. Three patterns come up again and again:

  • The whole of another account is trusted ("Principal": {"AWS": "arn:aws:iam::444455556666:root"}) with no conditions, so every role and user in that account that has sts:AssumeRole can use it.
  • A vendor role without an external ID. If the trust policy names the vendor’s AWS account but has no sts:ExternalId condition, any other customer of that vendor can potentially ask the vendor to assume your role (the confused-deputy problem).
  • A GitHub Actions OIDC role that trusts a whole organization (repo:my-org/*) or has no sub condition at all, so any workflow in any repository that can request a token can deploy to your account.

Check: IAM Access Analyzer finds roles that can be assumed from outside your account or organization. It’s free for external access:

# Once, in the management or delegated admin account
aws accessanalyzer create-analyzer --analyzer-name org-external-access --type ORGANIZATION

aws accessanalyzer list-findings-v2 \
  --analyzer-arn arn:aws:access-analyzer:eu-west-1:111122223333:analyzer/org-external-access \
  --filter '{"resourceType": {"eq": ["AWS::IAM::Role"]}, "status": {"eq": ["ACTIVE"]}}'

Every finding is a role someone outside your organization can assume. Some are intended (a vendor, a partner); each one should have an owner and a reason.

For GitHub OIDC roles, list them and read the conditions yourself:

aws iam list-roles \
  --query "Roles[?contains(to_string(AssumeRolePolicyDocument), 'token.actions.githubusercontent.com')].RoleName"

aws iam get-role --role-name github-deploy --query Role.AssumeRolePolicyDocument

Fix: name the exact role instead of the account root where you can, require sts:ExternalId on every vendor role, and pin GitHub roles to one repository and branch:

"Condition": {
  "StringEquals": {
    "token.actions.githubusercontent.com:aud": "sts.amazonaws.com",
    "token.actions.githubusercontent.com:sub": "repo:my-org/my-app:ref:refs/heads/main"
  }
}

4. iam:PassRole on every role

What I find: a CI or developer policy with iam:PassRole and "Resource": "*", next to ec2:RunInstances, lambda:CreateFunction or ecs:RunTask.

Why it matters: this is the most common privilege-escalation path in AWS. If I can pass any role to a new EC2 instance or Lambda function, I can pass the most powerful role in the account and then run code as it. The policy looks harmless on review because it never mentions admin.

Check: this script reads auth.json and prints every managed and inline policy that allows PassRole on *. It also catches iam:* and *, so expect your admin policies in the output too:

# find_passrole.py — usage: python find_passrole.py auth.json
import json, sys, urllib.parse

def as_list(x):
    return x if isinstance(x, list) else [x]

def doc_of(d):
    # The CLI usually decodes policy documents; handle the URL-encoded form too.
    return json.loads(urllib.parse.unquote(d)) if isinstance(d, str) else d

def risky(stmt):
    if stmt.get("Effect") != "Allow":
        return False
    actions = [a.lower() for a in as_list(stmt.get("Action", []))]
    resources = as_list(stmt.get("Resource", []))
    passrole = any(a in ("*", "iam:*") or a.startswith("iam:pass") for a in actions)
    return passrole and "*" in resources

data = json.load(open(sys.argv[1]))

for p in data["Policies"]:
    doc = next(doc_of(v["Document"]) for v in p["PolicyVersionList"] if v["IsDefaultVersion"])
    if any(risky(s) for s in as_list(doc["Statement"])):
        print(f"managed policy: {p['PolicyName']} (attached {p['AttachmentCount']}x)")

for kind, key, name in (("UserDetailList", "UserPolicyList", "UserName"),
                        ("GroupDetailList", "GroupPolicyList", "GroupName"),
                        ("RoleDetailList", "RolePolicyList", "RoleName")):
    for entity in data.get(kind, []):
        for ip in entity.get(key, []):
            if any(risky(s) for s in as_list(doc_of(ip["PolicyDocument"])["Statement"])):
                print(f"inline policy: {entity[name]} / {ip['PolicyName']}")

For a broader sweep of escalation paths (not just PassRole), Prowler has a check for it: prowler aws --checks iam_policy_allows_privilege_escalation. It looks at customer-managed policies, so keep the script above for inline ones.

Fix: scope PassRole to the roles that workload actually needs, and to the service it passes them to:

{
  "Effect": "Allow",
  "Action": "iam:PassRole",
  "Resource": "arn:aws:iam::111122223333:role/app/ecs-task-*",
  "Condition": {
    "StringEquals": { "iam:PassedToService": "ecs-tasks.amazonaws.com" }
  }
}

5. AdministratorAccess attached to machines

What I find: the CI/CD role, the Terraform role and a couple of Lambda functions all have AdministratorAccess, because it was the fastest way to make the pipeline work.

Why it matters: your pipeline becomes the easiest way into production. Anyone who can change a workflow file, a build script or a dependency it pulls can run code as admin.

Check:

aws iam list-entities-for-policy \
  --policy-arn arn:aws:iam::aws:policy/AdministratorAccess

Then search auth.json for custom policies with "Action": "*". The script above already prints them.

Fix: a Terraform role does need broad permissions, but it rarely needs IAM user management, Organizations or billing. Start from what the role actually called (Access Analyzer can generate a policy from CloudTrail activity), then add a deny for what it should never touch. Separate the role that plans (read-only, runs on every pull request) from the one that applies (runs only on the main branch).

6. Roles and permissions nobody uses

What I find: dozens of roles for projects that ended, test roles from a proof of concept, and roles that use three of the two hundred permissions they have.

Why it matters: every unused role is attack surface that nobody is watching, and unused permissions are what turn a small compromise into a big one.

Check (free): list-roles doesn’t return last-used dates, so ask for each role:

for r in $(aws iam list-roles \
    --query "Roles[?!starts_with(Path, '/aws-service-role/')].RoleName" --output text); do
  echo "$r $(aws iam get-role --role-name "$r" \
    --query 'Role.RoleLastUsed.LastUsedDate' --output text)"
done | sort -k2

None means the role hasn’t been used in the last 400 days, which is as far back as IAM tracks. Roles under /aws-reserved/sso.amazonaws.com/ belong to Identity Center; leave them alone and manage them through permission sets.

Check (paid, much better): Access Analyzer’s unused access analyzer reports unused roles, unused access keys, unused passwords and unused permissions inside roles that are used. It’s charged per role and user analyzed each month, so check the pricing page first, but for most small organizations it costs less than an hour of anyone’s time:

aws accessanalyzer create-analyzer \
  --analyzer-name org-unused-access \
  --type ORGANIZATION_UNUSED_ACCESS \
  --configuration '{"unusedAccess": {"unusedAccessAge": 90}}'

Fix: delete roles that haven’t been used in 90 days and have no owner. Tag the rest with an owner. For used roles with unused permissions, trim the policy to what Access Analyzer says the role actually uses. The least-privilege guide covers that loop.

7. Anyone who can create roles can create an admin

What I find: developers or pipelines allowed to create IAM roles so they can ship Lambda functions without waiting for the platform team. Nothing limits what those roles can do.

Why it matters: iam:CreateRole plus iam:AttachRolePolicy is admin with extra steps. Create a role, attach AdministratorAccess, assume it.

Check: in auth.json, look for policies that allow iam:CreateRole, iam:AttachRolePolicy or iam:PutRolePolicy with no iam:PermissionsBoundary condition.

Fix: let them create roles, but only with a permissions boundary attached, and only under a path you control:

{
  "Sid": "CreateRolesOnlyWithBoundary",
  "Effect": "Allow",
  "Action": ["iam:CreateRole", "iam:AttachRolePolicy", "iam:PutRolePolicy", "iam:PutRolePermissionsBoundary"],
  "Resource": "arn:aws:iam::111122223333:role/app/*",
  "Condition": {
    "StringEquals": {
      "iam:PermissionsBoundary": "arn:aws:iam::111122223333:policy/app-boundary"
    }
  }
},
{
  "Sid": "NoRemovingTheBoundary",
  "Effect": "Deny",
  "Action": ["iam:DeleteRolePermissionsBoundary", "iam:CreatePolicyVersion", "iam:DeletePolicy"],
  "Resource": [
    "arn:aws:iam::111122223333:role/app/*",
    "arn:aws:iam::111122223333:policy/app-boundary"
  ]
}

The boundary caps what any role they create can do, whatever policy they attach to it. The deny stops them removing the boundary or editing the boundary policy itself.

8. Humans with long-lived credentials and no MFA

What I find: engineers signing in as IAM users with a password and an access key on their laptop. A few of them have no MFA.

Why it matters: this is where stolen laptop credentials, phished passwords and session hijacking start.

Check: in credential-report.csv, password_enabled = true and mfa_active = false is the urgent list.

Fix: MFA on those users today, then move people to IAM Identity Center so they get short-lived credentials from aws sso login instead of keys. The IAM users guide has the Terraform for permission sets and the ~/.aws/config setup.

9. Nothing at the organization level stops any of this

What I find: an AWS Organization with every account in the root OU and only the default FullAWSAccess SCP.

Why it matters: every fix above can be undone by anyone with admin in a member account. Service control policies are the guardrails that hold even when an account admin makes a mistake or a role is compromised.

Check:

aws organizations list-policies --filter SERVICE_CONTROL_POLICY \
  --query 'Policies[].Name'

If the only result is FullAWSAccess, there are no guardrails.

Fix: start small. The SCPs that pay for themselves first: deny creating IAM users and access keys, deny leaving the organization, deny disabling CloudTrail, GuardDuty and Config, and restrict regions. AWS SCPs That Actually Work has the policies and how to roll them out without breaking things.

10. Nobody would notice an IAM change

What I find: CloudTrail is on, but nothing reads it. A new access key on an admin user or a root sign-in would sit in the logs until someone went looking.

Fix: a few EventBridge rules routed to wherever your team already looks (Slack, email, the on-call tool). One catch: IAM is a global service and its CloudTrail events are delivered to us-east-1, so create these rules there even if everything else runs in another region.

Root sign-in:

{
  "detail-type": ["AWS Console Sign In via CloudTrail"],
  "detail": { "userIdentity": { "type": ["Root"] } }
}

Changes that create credentials or grant permissions:

{
  "source": ["aws.iam"],
  "detail-type": ["AWS API Call via CloudTrail"],
  "detail": {
    "eventName": [
      "CreateUser", "CreateAccessKey", "CreateLoginProfile",
      "AttachUserPolicy", "AttachRolePolicy", "PutUserPolicy", "PutRolePolicy",
      "UpdateAssumeRolePolicy", "DeleteRolePermissionsBoundary"
    ]
  }
}

If you also run GuardDuty, its IAM findings (credential use from unusual locations, InstanceCredentialExfiltration) cover the “someone is using a stolen key” side. The GuardDuty setup guide shows the same EventBridge routing for findings.

What a review doesn’t fix

Running these checks tells you where you stand. It doesn’t tell you why an account ended up with admin on the pipeline, and without that, the same findings come back six months later. The fixes that last are the boring ones: an owner tag on every role, a permission-set catalogue in Terraform instead of console clicks, SCPs that make the bad pattern impossible, and an alert when someone tries anyway.

Checklist

  • Root: no access keys, MFA on, centralized root access enabled for member accounts
  • Every active access key has a named owner and a plan to replace it
  • Access Analyzer external-access findings reviewed; every external trust has an owner
  • Vendor roles require sts:ExternalId; GitHub OIDC roles pin sub to repo and branch
  • No iam:PassRole on * outside admin roles
  • No AdministratorAccess on CI/CD, Terraform or application roles
  • Roles unused for 90+ days deleted; remaining roles tagged with an owner
  • Role creation by developers and pipelines requires a permissions boundary
  • Every human with console access has MFA, and is on the way to Identity Center
  • SCPs deny IAM user creation, leaving the org and disabling CloudTrail/GuardDuty
  • EventBridge alerts in us-east-1 for root sign-in and IAM credential/policy changes

Want someone to run this on your accounts? An IAM review is one of the most common things I do for small teams on AWS: all ten checks across every account, a prioritized list of what to fix first, and the policies and Terraform to fix it. Book a free 30-minute call and we’ll look at where your IAM stands.


Related guides: