IAM
IAM privileges - Privesc
Unauthenticated IAM Enumeration
IAM User Accounts
AWeSomeUserFinder
Uses
UpdateAssumeRolePolicyto identify external IAM users.
Modify S3 bucket policies to enumerate valid IAM users in external accounts
Pacu
PacuIAM Privilege escalation
List inline policies, attached policies and group policies
IAM Enumeration Tools
PMapper
CloudPEASS

IAMActionHunter
IAMFinder
EnumerateIAM
aws_iam_enum

aws_escalate.py
Pacu
PacuPrivilege escalation opportunities in IAM configurations
Multiple privesc vectors
Multiple privesc vectors in a single policy
lambda:UpdateFunctionConfiguration
iam:PassRole + ec2:RunInstances: Creating an EC2 instance with an existing instance profile
iam:CreateAccessKey: Creating a new user access key
iam:CreateLoginProfile: Creating a new login profile
iam:UpdateLoginProfile: Updating an existing login profile
iam:AttachUserPolicy: Attaching a policy to a user
iam:AttachGroupPolicy: Attaching a policy to a group
iam:AttachRolePolicy: Attaching a policy to a role
iam:PutUserPolicy: Creating/updating an inline policy for a user
iam:PutGroupPolicy: Creating/updating an inline policy for a group
iam:PutRolePolicy: Creating/updating an inline policy for a role
iam:AddUserToGroup: Adding a user to a group
iam:PassRole + lambda:CreateFunction + lambda:InvokeFunction: Passing a role to a new Lambda function, then invoking it
iam:PassRole + lambda:CreateFunction + lambda:AddPermission
iam:UpdateAssumeRolePolicy + sts:AssumeRole: Updating the AssumeRolePolicyDocument of a role
lambda:UpdateFunctionCode: Updating the code of an existing Lambda function
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.


arn:aws:iam::[Account_ID]:user/[Username]
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 BooksAdvanced Penetration Testing: Hacking AWS 2 This book delves deeper into analyzing the security of various AWS services and shows techniques and tactics used by an attacker to breach an AWS environment
Hands-On AWS Penetration Testing with Kali Linux Set up a virtual lab and pentest major AWS services, including EC2, S3, Lambda, and Cloud
Last updated
