Skip to content

AWS Subdomain Takeover even with the DNS entry pointing to a cloudfront distribution

0

Hello. I'm aware that the subdomain takeover happens when you have an orphan entry in the DNS that can be taken over by a hacker to display malicious content, however, my current setup is as follows:

  • I have a bucket containing a static webpage called app.mysite.com
  • I have a CloudFront distribution with two Alternate domain names: app.mysite.com and www.app.mysite.com
  • I then have two DNS entries type A that are aliases to this Cloudfront distribution: app.mysite.com and www.app.myapp.com

Recently I got contacted by a hacker that has taken over www.app.mysite.com and he did it by creating a bucket named www.app.mysite.com. How come this vulnerability is even possible if my DNS entry is not even pointing directly to this bucket? both app. and www.app. are pointing to the Cloudfront distribution.

*** Recent Update *** Also, upon further investigation and looking at the hacker report a new relevant information was found: at the window of the attack, the hacker reported that the www.app.mysite.com was throwing 404, meaning that for some reason, the cloudfront distribution lost the connection with the bucket at the time of the attack. That rises that the rootcause wasn't the initial setup, which was rightly protecting from such exploit, but the fact that the Cloudfront removed the connection of that subdomain to our bucket, causing it to be vulnerable for the take over. Has anyone seen a known issue where Cloudfront simply stops pointing to your bucket and in case, how can this outage be prevented?

2 Answers
5

Please take note, the vulnerability may arises if:

The CloudFront distribution no longer exists The distribution doesn’t actively serve content for the subdomain The subdomain is listed as an Alternate Domain Name (CNAME) but not backed by a valid origin or certificate

EXPERT

answered a year ago

  • In case I double-checked and the distribution still exists and points out to the CloudFront distribution. In my DNS I only have an A type record pointing to this distribution, there's no CNAME entry for www.app.mysite.com

1

They cant take over the DNS Domain www.app.mysite.com if you own the Domain and manage it but they can create a bucket and use the AWS Static host bucket DNS Name still.

If they have taken over mysite.com then they would have full control of your DNS

EXPERT

answered a year ago

  • In my case I have an A type entry in the DNS specifically for www.app.mysite.com pointing to a CloudFront distribution that points to my bucket called app.mysite.com. I'm intrigued how the hacker was able to bypass this entry and redirect to his bucket. I tried reproducing this takeover with www.lp.mysite.com, that has the same configuration and I wasn't able to take over the subdomain, what leads me to believe he did some extra step that isn't clear to me. This would be a huge security flaw that would compromise anyone that have static sites hosted in AWS and would void any possibility to use this approach in a production environment, that's why I'm trying to figure out what's happening.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.