Subdomain Takeover

High

Subdomain Takeover

Definition

Subdomain Takeover happens when a subdomain points (via CNAME or A record) to an external service that is no longer in use or has not been claimed. An attacker can register that external service and take control of the subdomain, serving malicious content, stealing cookies from the parent domain or running convincing phishing.

Impact

Sophisticated phishing from a legitimate subdomain of the organizationCookie theft from the parent domain (if the Domain attribute is not used correctly)Malware distribution from a seemingly trusted URLReputational damage to the organizationCSP policy bypass if the subdomain is allowlisted

Examples

Subdomain Takeover on GitHub Pages

The subdomain blog.victim.com has a CNAME pointing to victim.github.io, but the organization/repo on GitHub does not exist. The attacker creates the repository and configures GitHub Pages to serve content under the victim's subdomain.

# 1. Find a subdomain with a CNAME to GitHub Pages
$ dig blog.victim.com CNAME
blog.victim.com.  CNAME  victim.github.io.

# 2. Verify that the repository/organization does not exist
$ curl https://blog.victim.com
# Response: "There isn't a GitHub Pages site here."

# 3. Create the repository victim.github.io in your GitHub account
# 4. Add a CNAME file with "blog.victim.com"
# 5. Now you control blog.victim.com

External references

Practice Subdomain Takeover with real labs

Apply what you've learned in safe environments based on real bug bounty reports.

See practice labs
hunters training
712

hunters training

labs from real reports
55

labs from real reports

completions
1,206

completions

in bounties practiced
$213,970

in bounties practiced

46 flags captured this week·Real reports from HackerOne · Bugcrowd · Intigriti·No commitment·Free Academy
BBLabs · bug bounty training

Stop reading about bugs and start hunting them

Create your free account and practice on labs based on real reports that paid out thousands of euros. The Academy is free forever.

No card · free Academy · cancel anytime