Skip to main content
miji.be

Subdomain Takeover

An attack in which a third party takes over a subdomain where an unused CNAME record remains, and exploits the trustworthiness of the legitimate domain.

Oct 31, 2026 / About 1 min read

Security

Subdomain takeover is an attack technique in which an attacker hijacks a subdomain by exploiting a state where the DNS record (mainly a CNAME) of a subdomain that an organization has stopped using still remains. For example, if blog.example.com keeps a CNAME record pointing to an external service after the account on that service has been deleted, an attacker can create a new account on the same service and seize control of the subdomain.

The attack works as follows. An organization runs a subdomain on an external service such as AWS S3, GitHub Pages, or Heroku and later cancels the service. However, if it forgets to delete the CNAME record in DNS, the subdomain is left "dangling." The attacker registers the same hostname on the target external service and becomes able to serve any content. Because it is a subdomain of the legitimate domain, it may be abused for phishing or for stealing Cookies.

This risk also exists when an organization sets up a custom domain with a URL shortener. When the organization stops using the URL shortener, if it does not delete the custom domain's CNAME record from DNS, an attacker may take over the subdomain. If malicious short URLs are issued on the hijacked subdomain, phishing attacks that exploit the trustworthiness of the organization's domain become possible.

OWASP's Web Security Testing Guide lists removing the relevant DNS records from the zone as a countermeasure and recommends continuous monitoring and periodic checks (as of October 2026). The same guide lists subzy and nuclei as tools for detecting subdomain takeovers. On the operations side, another approach is to add DNS record deletion to the checklist used when canceling a service. In addition, specifying in a CAA record (RFC 8659) which certificate authorities are allowed to issue certificates can reduce the risk of unintended certificate issuance.

Was this article helpful?

Related Terms

Subdomain

A prefix added before the main domain name, used to organize different sections or services of a website.

CNAME Record

A CNAME record maps one domain name to another in DNS. Used to point custom branded short URL domains to the URL shortening service infrastructure without changing IP addresses directly.

DNS Resolution

The process of translating a human-readable domain name into the IP address of the server hosting the website.

Custom Domain

A privately owned domain name used with a URL shortening service instead of the service's default domain.

Certificate Transparency

A framework for monitoring and auditing SSL/TLS certificates to detect misissued or fraudulent certificates.

Wildcard DNS

A DNS configuration that uses an asterisk (*) to point all subdomains to a single IP address with one record, enabling efficient management of large numbers of subdomains.

Related Articles

Short URL Security - Phishing Risks, Safe Sharing Practices, and Protection Guide

A comprehensive guide to short URL security. Understand phishing risks, malware distribution via shortened links, and best practices for safe sharing.

Short URL Phishing - How to Spot Scams and Protect Yourself from Malicious Links

Learn to identify phishing attacks that use short URLs. Covers 5 common scam patterns, URL preview tools, and practical defense strategies.

Self-Hosting a URL Shortener: Full Link Control

Explore the benefits and challenges of running your own URL shortening service. Covers open-source tools, serverless architecture, and cost-performance tips.

Put the terms to work

Shorten a URL for Free