tashatuvango - Fotolia
What is subdomain takeover and why does it matter?
Subdomain takeover exposure can happen when cloud-hosted web services are incompletely decommissioned, but configuration best practices can reduce the risks.
Subdomain takeover attacks are a class of security issues where an attacker is able to seize control of an organization's subdomain via cloud services like AWS or Azure. They commonly happen when web projects are ended but the subdomain DNS entries are not fully shut down.
When webpages are hosted at cloud providers, the webpage is usually created on a subdomain at the cloud provider first. For example, at Azure, such a subdomain would have the form webproject.azurewebsites.net. The customer will ultimately want the project to appear to be hosted on a subdomain of the customer's own domain. Therefore, queries to the customer's subdomain -- for example, webproject.example.org -- would be forwarded to the subdomain hosted in the cloud -- in this case, webproject.azurewebsites.net.
To effect this change, a CNAME domain name system (DNS) record -- a record for a canonical name -- is configured to forward all queries to the customer's subdomain, e.g., webproject.example.org, to the cloud provider's subdomain, webproject.azurewebsites.net, where the web project is hosted.
The potential for a subdomain takeover occurs when the webpage hosted at the cloud provider is deleted but the DNS entry is kept. There's a reason for this common occurrence: While hosting at the cloud provider costs money, having a stale DNS entry is usually free. Thus, while there's an incentive to delete obsolete webpages, the DNS entries are often forgotten.
An attacker can now reregister the host at the cloud provider, add the organization's subdomain as an alias and thus control what content is hosted. Variations of this attack involve NS records -- records for authorized name servers -- where the control of a domain is delegated to the cloud provider's DNS service.
The vulnerabilities related to subdomain takeovers continue to be an issue, despite them first being reported in 2014 by Frans Rosén, knowledge advisor at the Stockholm-based website vulnerability scanner company Detectify. Detectify first found 17 service providers where subdomain takeover was possible, but after the initial discovery, more people started looking into the issue and found over 100 services vulnerable to such attacks.
The best defense against subdomain takeover is to remove unused DNS entries. Ideally, organizations should also regularly monitor and test where each subdomain is being used. Indirect subdomain takeovers can be prevented by regularly monitoring the presence of all web resources and making sure that no invalid web resources are referenced from webpages.
Dig Deeper on Threats and vulnerabilities
Related Q&A from Hanno Böck
How can developers avoid a Git repository security risk?
Learn how managing web development content with the popular version control system can be risky without taking action to avoid these basic Git ... Continue Reading
What is MTA-STS and how will it improve email security?
Discover how the MTA-STS specification will improve email security by encrypting messages and enabling secure, authenticated email transfers between ... Continue Reading
Can PDF digital signatures be trusted?
Digital signatures on PDF documents don't necessarily guarantee their contents are valid, as new research shows viewer implementations don't always ... Continue Reading