0Pricing
Ethical Hacking Academy · Lesson

IAM Misconfigurations

Over-permissive roles.

IAM Misconfigurations is a free Ethical Hacking Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Ethical Hacking Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Why IAM Is the Real Perimeter

In the cloud, identity is the new perimeter. IAM (Identity and Access Management) decides who can do what. A flaw in IAM lets an attacker move from a low-privilege foothold to full account control.

  • Users, roles, and service accounts are identities
  • Policies define permissions
  • Misconfigured policies are the number-one cloud risk

Most cloud privilege escalation is an IAM problem.

Users, Roles, and Policies

AWS IAM has three building blocks you must understand:

  • Users — long-lived identities with access keys
  • Roles — temporary identities that can be assumed by users or services
  • Policies — JSON documents granting or denying actions on resources

A policy attached too broadly is how over-permissioning happens.

{
  "Effect": "Allow",
  "Action": "s3:GetObject",
  "Resource": "arn:aws:s3:::reports-bucket/*"
}

The Danger of Wildcards

The single most dangerous IAM pattern is the wildcard policy. It grants every action on every resource.

If an attacker compromises an identity with this policy, they own the entire account.

{
  "Effect": "Allow",
  "Action": "*",
  "Resource": "*"
}

# Action:* Resource:* = full administrative control.
# Flag this everywhere it appears outside a break-glass admin role.

Enumerating Your Own Permissions

Once you hold a credential, list what it can do. IAM has read APIs that reveal attached policies.

Some accounts even grant iam:Get* and iam:List* to ordinary users, handing you a free map.

# List policies attached to a user
aws iam list-attached-user-policies --user-name devuser

# Get the JSON of a managed policy version
aws iam get-policy-version \
  --policy-arn arn:aws:iam::aws:policy/AmazonS3FullAccess \
  --version-id v1

Privilege Escalation via iam:PassRole

A classic escalation: a user has iam:PassRole plus a service-creation permission. They can launch a resource that assumes a high-privilege role and inherit its access.

  • User has ec2:RunInstances + iam:PassRole
  • They launch an EC2 instance with an admin role attached
  • The instance now holds admin credentials, which they retrieve

The user never had admin directly, but escalated into it.

Dangerous Permission Combinations

Individual permissions can be harmless but become escalation paths in combination. Known risky combos include:

  • iam:CreatePolicyVersion — rewrite an existing policy to grant admin
  • iam:AttachUserPolicy — attach AdministratorAccess to yourself
  • iam:CreateAccessKey on another user — steal their identity
  • sts:AssumeRole on an over-trusting role

Tools enumerate these automatically.

Trust Policies and AssumeRole

Roles have a trust policy defining who may assume them. An over-broad trust policy is a backdoor.

If a role trusts the whole account or even an external account by mistake, an attacker can assume it.

{
  "Effect": "Allow",
  "Principal": { "AWS": "arn:aws:iam::123456789012:root" },
  "Action": "sts:AssumeRole"
}

# Trusting the entire account root means ANY identity in it can assume the role.

Automating Escalation Discovery

Manually checking every policy combination is tedious. Tools map escalation paths for you.

  • Pacu — AWS exploitation framework with privesc modules
  • PMapper — graphs IAM relationships and finds privesc edges
  • enumerate-iam — brute-forces which API calls a key can make
# Run Pacu's IAM privilege escalation enumeration
pacu
# > run iam__privesc_scan

# Build an IAM access graph and query it
pmapper graph create
pmapper query 'preset privesc *'

Inline vs Managed Policies

Permissions can be granted two ways, and attackers check both:

  • Managed policies — reusable, attached to many identities
  • Inline policies — embedded directly in one user/role

Inline policies are easy to miss in audits, so they often hide excessive permissions. Always enumerate both when assessing an identity.

# Inline policies are listed separately from attached ones
aws iam list-user-policies --user-name devuser
aws iam get-user-policy --user-name devuser --policy-name custom-inline

Hardening: Least Privilege

The fix for IAM misconfigurations is least privilege: grant only the exact permissions needed.

  • Replace wildcards with explicit actions and resource ARNs
  • Use roles with short-lived credentials instead of long-lived keys
  • Audit unused permissions with Access Analyzer
  • Enforce MFA on privileged identities

Your report should map each finding to a least-privilege remediation.

Stay Within Authorization

Privilege escalation testing actively changes account state. Be careful:

  • Creating policies, keys, or roles is intrusive, get written approval
  • Document every change so it can be reverted
  • Prefer read-only enumeration to prove a path before exploiting it

Demonstrating that a privesc path exists is often enough, you do not always need to fully exploit it.

Quick Check

Which permission combination is a classic AWS privilege-escalation path?

Recap: IAM Misconfigurations

You learned why IAM is the cloud's true perimeter and how attackers exploit it.

  • Wildcard Action:* Resource:* policies are catastrophic
  • iam:PassRole + service creation enables privilege escalation
  • Over-broad trust policies let attackers assume roles
  • Tools like Pacu and PMapper automate path discovery
  • Remediation is always least privilege

Next we look at S3 and storage exposure.

Frequently asked questions

Is the “IAM Misconfigurations” lesson free?

Yes — the full text of “IAM Misconfigurations” is free to read here on the web, and the Ethical Hacking Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Ethical Hacking Academy course, upgrade to CoddyKit PRO.

What will I learn in “IAM Misconfigurations”?

Over-permissive roles. You practise Ethical Hacking Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Ethical Hacking Academy?

No prior experience is required. Ethical Hacking Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “IAM Misconfigurations” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Ethical Hacking Academy lesson?

Yes. Every Ethical Hacking Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Cloud Attack Surface
  2. IAM Misconfigurations
  3. S3 and Storage Exposure
  4. Metadata and SSRF
← Back to Ethical Hacking Academy