Privilege Escalation
Privilege escalation on AWS is based on misconfigurations, if we have more permissions than necessary, its possible to obtain higher privileges.
Case study
A user was compromised with the List Policy and Put User Policy permissions, an attacker could leverage this Put User privilege to add an inline administrator to itself, making it administrator of the instance.
Exploitation
1) Getting the IAM user
aws sts get-caller-identity2) Listing policies attached to a user
aws iam list-attached-user-policies --user-name EXAMPLE_NAME -- profile EXAMPLE_PROFILE3) Retrieving information about a specific policy
aws iam get-policy --policy-arn POLICY_ARNIf there are more than one version of the policy, we can also list them
aws iam list-policy-versions --policy-arn POLICY_ARNNow we can finally retrieve the contents of the policy
It's important to use the command above to chech the information about the default policy
Escalation
If we have the PutUserPolicy is enabled, we can add an inline administrator policy to our user.
Administrator Policy Example:
Attaching this policy into our user
Listing inline policies of our user
Listing a restricted resource (Example S3)
Last updated