IAM

IAM privileges - Privesc

Unauthenticated IAM Enumeration

IAM User Accounts

AWeSomeUserFinder

  • Uses UpdateAssumeRolePolicy to identify external IAM users.

  • Modify S3 bucket policies to enumerate valid IAM users in external accounts

Pacu

Pacu

IAM Privilege escalation

IAM Enumeration Tools

PMapper

CloudPEASS

IAMActionHunter

IAMFinder

EnumerateIAM

aws_iam_enum

aws_escalate.py

Pacu

Pacu

Privilege escalation opportunities in IAM configurations

Multiple privesc vectors

Multiple privesc vectors in a single policy

iam:CreateAccessKey

An attacker with the iam:CreateAccessKey permission on other users can create an access key ID and secret access key belonging to another user in the AWS environment

iam:CreateLoginProfile

An attacker with the iam:CreateLoginProfile permission on other users can create a password to use to login to the AWS console on any user that does not already have a login profile setup.

You can now login as the victim into the AWS console

iam:UpdateLoginProfile

You can now login as the victim into the AWS console - See iam:CreateAccessKey

iam:CreatePolicyVersion

Create a new version of an IAM policy that they have access to.

administrator/policy.json

iam:SetDefaultPolicyVersion

Where “v2” is the policy version with the most privileges available.

Example: CloudGOAT - iam_privesc_by_rollback

With Pacu:

iam:AddUserToGroup

iam:AttachUserPolicy

If attaching AdministratorAccess fails, try to attach another dangerous permission such as SecretsManagerReadWrite

iam:AttachGroupPolicy

Also try with AdministratorAccess - See iam:AttachUserPolicy

iam:PutUserPolicy

Create a policy document policy.json

Check if the policy is in place:

iam:PutGroupPolicy

Create policy.json

Upload the policy to your group

iam:AttachRolePolicy

Find a role you can assume: "Action": "sts:AssumeRole"

Attach Role Policy

iam:PutRolePolicy

Find a role you can assume - See iam:AttachRolePolicy

Create policy.json

Put the role

sts:AssumeRole

List of IAM roles

Retrieve trust relationship between role and user

List managed policies attached to the specified role

Retrieve information about the specified version of the managed policy

Assume role - retrieve temporary security credentials of assumed role

Use the credentials

lambda:UpdateFunctionConfiguration

Allow to attach a layer to a function

iam:PassRole + lambda:CreateFunction + lambda:InvokeFunction

Persistence - IAM Role Anywhere

An attacker with sufficient permissions could exploit IAM Roles Anywhere to gain persistent access to an AWS account

Interesting Book

Interesting Books

Disclaimer: As an Amazon Associate, I earn from qualifying purchases. This helps support this GitBook project at no extra cost to you.

Last updated