Skip to content
Subdomain takeover Write-up Beginner

AWS Cloudfront - Subdomain takeover

A dangling CNAME record pointed a subdomain to a deleted AWS CloudFront distribution, allowing an attacker to claim the matching S3 bucket name and serve arbitrary content on that subdomain. The attacker could host phishing pages or other malicious content under the trusted domain.

Tutorgeeks Follow

Published on tutorgeeks.blogspot.com

The original lives on tutorgeeks.blogspot.com

We do not hold its text, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the victim left a CNAME DNS record pointing to a deleted CloudFront distribution, and the attacker could create an S3 bucket with the same name as the subdomain to serve content.

Impact

An attacker could serve arbitrary content, such as a phishing page asking for credentials, on the trusted subdomain, potentially deceiving users.

What the attacker needed

Dangling CNAME record; attacker has AWS account; subdomain name matches bucket name

The fix

Remove CNAME entries pointing to third-party services when the subdomain is no longer needed.

How it was found

  1. Enumerate subdomains using tools like Sublist3r or knockpy.
  2. Check for CNAME entries pointing to third-party services such as CloudFront.
  3. Visit the subdomain and observe a CloudFront error page indicating the distribution no longer exists.
  4. Use the host command to confirm the CNAME record still exists.
  5. Create an S3 bucket with the exact name of the vulnerable subdomain.
  6. Upload content (e.g., an index.html file) to the bucket, which is then served on the subdomain.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

A subdomain takeover happens when a website points a subdomain (like test.example.com) to an external service, then stops using that service but forgets to remove the DNS record. An attacker can then sign up for that same service using the subdomain's name and take control of the content shown at that address. This lets them host fake login pages or other content that appears to come from the real website.

What is Subdomain takeover?

A company's DNS still points at a cloud service it no longer uses, so anyone can claim it and serve content on the company's domain.

More by Tutorgeeks

View all

8 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Subdomain takeover

The lesson behind this report.

A company's DNS still points at a cloud service it no longer uses, so anyone can claim it and serve content on the company's domain.