Subdomain Takeover
MediumDetects unclaimed subdomains pointing to external services.
What is Subdomain Takeover?
Subdomain takeover occurs when a DNS record points to an external service (like Heroku, AWS, or GitHub Pages) that you no longer control. Attackers can claim the service and serve malicious content on your subdomain.
Security Impact
Severity: High
- Phishing attacks using your domain
- Malware distribution
- Reputation damage
- SEO poisoning
- Session hijacking
How to Fix
1. Audit DNS Records
# List all DNS records
dig yourdomain.com ANY
# Check specific subdomain
dig subdomain.yourdomain.com
# Check CNAME records
dig subdomain.yourdomain.com CNAME
2. Remove Dangling DNS Records
Remove CNAME records pointing to services you no longer use:
# Vulnerable
blog.yourdomain.com CNAME myblog.herokuapp.com
# If you deleted the Heroku app, remove this DNS record!
3. Monitor Common Services
Services vulnerable to takeover:
- Heroku:
*.herokuapp.com - GitHub Pages:
*.github.io - AWS S3:
*.s3.amazonaws.com - Azure:
*.azurewebsites.net - Shopify:
*.myshopify.com
4. Verify Subdomains
# Check if subdomain resolves
nslookup app.yourdomain.com
# Check what it points to
dig app.yourdomain.com CNAME
5. Implement CAA Records
# DNS CAA record
yourdomain.com. CAA 0 issue "letsencrypt.org"
yourdomain.com. CAA 0 issuewild ";"
Prevention
- Document all subdomains
- Before deleting services, remove DNS records
- Regular DNS audits
- Use DNS monitoring tools
- Implement DNS CAA records
Verification Steps
- List all DNS records
- Verify each CNAME resolves correctly
- Check for orphaned records
- Test subdomain accessibility
- Use automated scanners
Tools
dig,nslookup- DNS queries- can-i-take-over-xyz - Service fingerprints
- Security scanners with subdomain takeover detection
Related Issues
- DNS Security
- Email Security
Automatically detect this issue
StackShield can automatically scan your Laravel application for this security issue and alert you when it's detected.
Start Free Trial