AWS/S3 Subdomain Takeover
A subdomain pointed at an AWS S3 bucket that no longer existed, so the bucket name was free to claim. The author registered a bucket with the same name and uploaded a proof-of-concept file, taking control of the subdomain's content.
Published on medium.com
These are the steps I took to successfully take over this subdomain and link it to my own AWS bucket
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 a dangling DNS record still pointing at an S3 bucket that had been deleted, leaving the bucket name free for anyone to register.
Impact
An attacker could host their own content on the organisation's subdomain, which the author notes could be used for phishing, malware distribution and defacement.
What the attacker needed
Dangling DNS record to a deleted S3 bucket; bucket name still available to register; AWS account
The fix
The dangling DNS record should be removed or repointed, and bucket names tied to subdomains should be kept registered.
How it was found
- Enumerate the target's subdomains with a recon tool.
- Scan the subdomains for takeover signatures such as the S3 'bucket does not exist' message.
- Confirm the takeover is possible using the can-i-take-over-xyz reference.
- Create a new S3 bucket named after the subdomain.
- Upload a proof-of-concept file and make it publicly readable.
- Optionally enable static website hosting on the bucket.
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 is a name like shop.example.com that points to some service. If that service (here, an S3 storage bucket) is deleted but the DNS record still points at it, anyone who recreates a bucket with the same name can serve their own content on that subdomain. This is called subdomain takeover.
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.