Subdomain Takeover
A DNS record for a subdomain points to a cloud or hosting resource that no longer exists, so anyone can claim that resource and serve their own content on the subdomain.
| Severity | High |
| CVSS 3.1 | 7.5 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N Open in the calculator |
| CVSS 4.0 | 8.7 CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:L/SI:L/SA:N Open in the calculator |
| CWE | CWE-672: Operation on a Resource after Expiration or Release |
| MITRE ATT&CK | T1584.001 Domains, T1566.002 Spearphishing Link, T1539 Steal Web Session Cookie |
| Category | Security Misconfiguration |
Description
Organisations often point subdomains at third-party services with CNAME or other records, for example at a cloud web application, a storage bucket website, a content delivery network endpoint or a hosted platform. When the service is cancelled or the resource deleted but the DNS record is left in place, the record is described as dangling. If the provider lets any customer create a resource with the same name, an attacker can register it, and the organisation's subdomain then serves content the attacker controls.
That can be any content under the organisation's domain name, and the attacker can usually obtain a valid TLS certificate for the subdomain, since certification authorities validate control of a name through the content or DNS it serves. They can host convincing phishing pages and malware, capture cookies scoped to the parent domain, which browsers send to every subdomain, and abuse trust that the organisation's applications place in their own subdomains, such as cross-origin (CORS) rules, Content Security Policy sources and OAuth redirect addresses. Malicious content on the organisation's own domain can also cause significant reputational harm, even where no data is taken.
Services where this has been possible include Azure resources referenced by their default host names, Amazon S3 website endpoints and GitHub Pages; whether a takeover works depends on how each provider checks ownership, which changes over time. A records pointing to released cloud IP addresses, and NS records delegating to deleted DNS zones, create the same risk. The weakness is identified by resolving the organisation's known subdomains and looking for records that point to unclaimed resources or that return the provider's error page for a missing resource, then confirming, where the rules of engagement allow, by claiming the resource with harmless content. Community references such as the can-i-take-over-xyz list record which services are affected.
Remediation
Remove the dangling record and stop new ones appearing:
- Delete or correct the affected DNS record immediately. If someone else has already claimed the resource, removing the record is the quickest way to take the name back out of their control.
- Make DNS part of decommissioning: remove the DNS record before deleting the resource it points to, not after.
- Keep an inventory of DNS records linked to the resources and owners they belong to, and check every CNAME, A and NS record regularly for targets that no longer exist.
- Use the provider's ownership verification where it exists, such as the
asuidTXT record for Azure App Service custom domains, and in Azure DNS use alias records that point to the resource itself, which become empty when the resource is deleted. - Avoid wildcard DNS records that point to third-party services, and do not scope session cookies to the parent domain unless that is required.
- Review logs and content for the period the subdomain was exposed, and check Certificate Transparency logs for certificates issued for it that the organisation did not request, asking the issuing authority to revoke any found.
Confirm the fix by resolving the subdomain and checking that the record no longer exists or points to a resource the organisation controls.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.