Escalate Privileges by IAM Policy Rollback
A walkthrough demonstrating how to abuse the IAM permission: SetDefaultPolicyVersion
CTF Source: Pwned Labs
Overview
In this walkthrough, we're provided access keys for an Intern with seemingly little access, but we find a way to escalate our privileges and obtain access to sensitive data!
Pre-Requisites
Install awscli:
brew install awscli
(mac)apt install awscli
(linux)Install JohnTheRipper:
brew install john
(mac)apt intall john
(linux)
Walkthrough
After configuring our AWS access keys (aws configure
), let's begin to enumerate our access.
This command tells us who we are.
We can then list policies attached to this user.
Let's see if we have multiple versions of this policy.
We can view both policies like so: aws iam get-policy-version --policy-arn arn:aws:iam::214768663777:policy/intern_policy --version-id v1
(or v2
).
Escalating Privileges
The v1
policy gives us some additional S3 permissions over all resources. We'll set this version as our policy.
If we list the buckets in the account, we'll find one and download the data.
Password Cracking
Unfortunately, the file is password-protected.
Not to worry as we can attempt to crack the password.
We'll create a hash and save it to a new file.
Next, we'll use JohnTheRipper and the classic rockyou.txt password list.
Finding the Flag!
We found the password! Attempting to unzip the file with this password results in discovering the flag!
Get the final flag.
Last updated