Cloud Breach S3
Exploit misconfigured reverse proxy to query EC2 metadata service
Create a cloudgoat IAM profile generate with access keys - set it up via
aws configure
Simply deploy the cloud breach scenario - wait until it configures a vulnerable env
If you face any issues - read the Issues tab
Scenario Start
The IP address of an EC2 instance is running a misconfigured reverse proxy
Scenario Goal
Dump the confidential data from the S3 buckets
Getting Started
So when we analyze the start.txt
- we find our EC2 IP address
When we ping the IP we don't get any response - maybe they've disabled ICMP on thier instance
Let's scan the IP using
We find port 80 and 22 being open - Let's quickly
curl
itThe error says
This server is configured to proxy reqs only to the EC2 metadata service
Please modify the req's host header !
Ok let's add the magic IP as the host header and then request again
It works! - we see alot of dirs displayed, out of which the latest
stands out
We require the meta-data
, and iam/security-credentials
looks interesting :)
We get a AcessKeyId
, SecretAccessKey
and a SessionToken
- we can now configure a new user with this and try enumerating the S3 buckets !
After configuring the profile - we'll have to edit the
.aws/credentials
fileAdd a new-line,
aws_session_token = <TOKEN_VALUE>
The user can't retrieve the user details - He's not authorized, let's now enumerate it
Hurray! we now found the sensitive files - let's dump them :)
Exploitation Route
Last updated