Skip to content
Subdomain takeover Write-up Intermediate

DNS and CloudFront Domain Takeover via Deleted S3 Buckets

An attacker can discover orphaned CloudFront distributions or DNS records that point to deleted S3 buckets, then create a bucket with the same name to serve malicious content. This content would be distributed by the victim and appear legitimate, potentially allowing cookie theft or actions as the user.

hackingthe.cloud

Published on hackingthe.cloud

Discover Dangling Domains that point to your cloud assets to prevent subdomain takeover - Tools mentioned in this article

The author, on hackingthe.cloud

The full write-up lives on its author's site

It belongs to its author, 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 poor hygiene in retiring cloud resources: DNS records or CloudFront distributions were left pointing to an S3 bucket that was deleted, allowing an attacker to recreate the bucket and serve content.

Impact

An attacker could serve JavaScript that steals browser cookies or performs actions as the user, and the content would appear legitimate because it is distributed by the victim's domain.

What the attacker needed

Orphaned DNS record or CloudFront distribution; deleted S3 bucket name known or enumerable

The fix

Delete DNS records before deleting the S3 bucket, and use automated discovery tools to find vulnerable domains.

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.

When a company deletes an S3 bucket (a storage space in Amazon's cloud) but forgets to remove the DNS record or CloudFront distribution (the web address that points to it), anyone can recreate that bucket with the same name. The attacker then controls what content is served at that address, so visitors think they are still on the company's site.

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.

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.