andras marton personal site
~/ | ctf | projects

flAWS Cloud 1

These CTF write-ups contain spoilers

Written: 2021/08/14

These CTF challenges focus on misconfiguration and mistakes associated with using Amazon Web Services (AWS).

Level 1

Challenge notes

This level is buckets of fun. See if you can find the first sub-domain.

For this challenge, we are asked to find the next level’s sub-domain. The clue we get is it will be related to Amazon S3 buckets. Looking at’s DNS records we can see that the domain is pointed at an IP address (

dig A +noall +answer		5	IN	A

Checking for CNAME records did not reveal anything interesting, but the IP address appears to belong to an S3 bucket. Trying to directly visit this IP address in the browser redirects us to the Amazon S3 site. Based on the hint about buckets, we we can start exploring the idea that the site may be hosted as a static site within an AWS Bucket. If this is the case, reviewing the Configuring a static website using a custom domain documentation comes to hand. Step 2 indicates the following: These bucket names must match your domain name exactly. Searching around for the domain structure of static sites hosted on AWS S3 buckets, I found this article on hosting a site on an S3 bucket which lead me to thefollowing syntax:

AWS auto-populated:
Direct, Region spcific S3 URL to use:

We already know that when hosting a static site, the bucket name will need to match the custom domain. Using the above formula, therefore we can try out the domain In my experience, Amazon bucket information is displayed as an XML file. Going to the above site, that is exactly that we end up with.

Looking through the XML data, we eventually find a file with an interesting name, referring to secrets:
This XML file does not appear to have any style information associated with it. The document tree is shown below. 

Towards the bottom, we can see a file called secret-dd02c7c.html. When we visit the page we find our flag.
Congrats! You found the secret file!
Level 2 is at

Following the above link leads us to Level 2. The above link provides some additional information on how to avoid exposing AWS bucket based sites in a similar manner.

Level 2

Challenge Notes

The next level is fairly similar, with a slight twist. You’re going to need your own AWS account for this. You just need the free tier.

This challenge starts off much like the first challenge, however on this occasion we are making use of an AWS account. I suspected this may be to use AWS CLI. This is not something I used a lot, so it was back to digging around documentation. I started to look at the Amazon configuration basics documentation for AWS CLI for an idea. This is where it became apparent why I needed an AWS account in the first place. According to the document using aws configure, we can configure our AWS Access Key ID and AWS Secret Access Key along with a region. This can then be used to connect to buckets. After setting up my own configuration based on the documentation and using my account I tried the syntax suggested.

aws s3 --profile myprofile ls s3://
2017-02-26 20:02:15      80751 everyone.png
2017-03-02 21:47:17       1433 hint1.html
2017-02-26 20:04:39       1035 hint2.html
2017-02-26 20:02:14       2786 index.html
2017-02-26 20:02:14         26 robots.txt
2017-02-26 20:02:15       1051 secret-e4443fc.html
We can see the secret-e4443fc.html towards the bottom. Visiting that page we get the following message:
Congrats! You found the secret file!
Level 3 is at

Much like the previous level, navigating to the third level gives us insight as to what caused us the ability to list out the content.

Level 3

Challenge notes

The next level is fairly similar, with a slight twist. Time to find your first AWS key! I bet you’ll find something that will let you list what other buckets are.

We are still on the s3 command trend and building on our knowledge from the earlire challenge about listing things out. The hint the notes give us is that we are looking for an AWS key and that we are going to try and list out other buckets. Much like in Level 1, we can try to see if the S3 bucket is accessible over the browser by using the bucket URL:

Visiting this, we find that the bucket’s settings are configured to allow everyone access without the need for keys. Looking through the bucket listing, I noticed that there was a .git directory:





This is extremely useful as it may contain our key, alternatively we can explore the commit history to see if previously a key has been committed. In order to download the content of the .git directory so we can use git locally to browse through the content, I found an article How to copy folder from s3 using aws cli that was very helpful.

aws s3 --profile myprofile sync s3:// git

Running the above syncs the .git directory found on the Level 3 bucket. We can then start to explore the repo. I first searched through the commit history using git log:

git log
commit b64c8dcfa8a39af06521cf4cb7cdce5f0ca9e526 (HEAD -> master)
Author: 0xdabbad00 <[email protected]>
Date:   Sun Sep 17 09:10:43 2017 -0600

    Oops, accidentally added something I shouldn't have

commit f52ec03b227ea6094b04e43f475fb0126edb5a61
Author: 0xdabbad00 <[email protected]>
Date:   Sun Sep 17 09:10:07 2017 -0600

    first commit

Looks like right after our first commit, another one was made, noting that something was accidentally added that should not have been added. We can now focus on seeing what was committed on the first commit:

% git cat-file -p f52ec03b227ea6094b04e43f475fb0126edb5a61
tree f2a144957997f15729d4491f251c3615d508b16a
author 0xdabbad00 <[email protected]> 1505661007 -0600
committer 0xdabbad00 <[email protected]> 1505661007 -0600

first commit

% git cat-file -p f2a144957997f15729d4491f251c3615d508b16a
100644 blob e3ae6dd991f0352cc307f82389d354c65f1874a2	access_keys.txt
100644 blob 76e4934c9de40e36f09b4e5538236551529f723c	authenticated_users.png
100644 blob 5323d77d2d914c89b220be9291439e3da9dada3c	hint1.html
100644 blob 2fc08f72c2135bb3af7af5803abb77b3e240b6df	hint2.html
100644 blob 0eaa50ae75709eb4d25f07195dc74c7f3dca3e25	hint3.html
100644 blob 92d5a82ef553aae51d7a2f86ea0a5b1617fafa0c	hint4.html
100644 blob db932236a95ebf8c8a7226432cf1880e4b4017f2	index.html
100644 blob c2aab7e03933a858d1765090928dca4013fe2526	robots.txt

% git cat-file -p e3ae6dd991f0352cc307f82389d354c65f1874a2
access_key AKIAJ366LIPB4IJKT7SA
secret_access_key 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 

By stepping through the git cat-file command, we are able to gather up the access_key and secret_access_key. The hint from the challenge notes indicate we may be able to list out other buckets using these keys. Following the steps to create a new profile, I created one using these keys.

I found that you can list the s3 buckets your keys have access to over AWS CLI using the list-buckets command.

aws s3api list-buckets --query "Buckets[].Name" --profile hacked
We can then navigate to the Level 4 URL to complete this challenge: