by pyentropy · 5y ago · 0 comments
Bob owns bob.com and sets CNAME bob.com.us-east-1.amazonaws.com. Eve creates the bucket and can now serve any static content she wants.
- DNS TXT record
- HTML meta tag
- Upload a file with a randomized name to your site root
- Bob makes bob.com and sets the CNAME to be bobstaticsite.s3.aws
- Bob forgot to make a bucket called bobstaticsite.s3, and Alice, scanning the DNS records, creates it instead. Now Alice is serving data on Bob's domain
Am I missing something? How would AWS S3 stop you from creating a CNAME? Or how is this their responsibility? Don't make that CNAME entry pointing to a bucket you didn't create yet / don't own?
One final thing: S3 is not CloudFront. And CloudFront, AWS's CDN, does require domain name verification.
They (AWS) should not accept traffic on that hostname until ownership - tightly bound - is proven.
This also helps avoid related cases, such as deleting a bucket (which now frees it up) - other services like Heroku have similarly been vulnerable to this takeover hack because of a lack of strict verification: https://0xpatrik.com/subdomain-takeover-providers/
Every new bucket, service or account handling traffic for a domain should require re-verification. That verification should never persist beyond the lifetime of that resource.
That is, you'd prove you control www.example.com to AWS the exact same way www.example.com proves it is www.example.com to a web browser.