How Dangling DNS and Wildcard Certificates Enable Subdomain Takeovers

The proliferation of microservices, service meshes, and multi-cloud architectures has triggered an explosion in the number of subdomains organizations must manage. Historically, IT and DevOps teams re...

Tim Henrich
August 05, 2026
5 min read
32 views

How Dangling DNS and Wildcard Certificates Enable Subdomain Takeovers

The proliferation of microservices, service meshes, and multi-cloud architectures has triggered an explosion in the number of subdomains organizations must manage. Historically, IT and DevOps teams relied on Wildcard certificates to secure these expanding perimeters. Issuing a single *.example.com certificate and deploying it across dozens of servers was a pragmatic shortcut to bypass cumbersome manual Certificate Signing Request (CSR) processes.

Today, that shortcut is a critical security vulnerability.

Driven by strict Zero Trust mandates, the imminent reduction of maximum public certificate lifespans to 90 days, and the finalized NIST Post-Quantum Cryptography (PQC) standards, the industry is actively deprecating the use of Wildcard and multi-domain SAN (Subject Alternative Name) certificates.

This shift is not just about compliance; it is a necessary response to active threats. Cloud sprawl has made subdomain takeovers via dangling DNS a persistent attack vector. When combined with the broad blast radius of Wildcard certificates, organizations face severe risks of impersonation and data interception.

Here is a technical breakdown of why legacy subdomain certificate strategies fail, how dangling DNS attacks execute, and how to architect an automated, per-subdomain Certificate Lifecycle Management (CLM) pipeline.

The Core Vulnerability: Wildcards and the Principle of Least Privilege

A Wildcard certificate secures an apex domain and all its first-level subdomains. While convenient, it fundamentally violates the Principle of Least Privilege in cryptography.

If an organization uses a Wildcard certificate for *.company.com, the private key associated with that certificate must reside on every server hosting a subdomain. This includes highly secure production environments (api.company.com) and frequently neglected, lower-tier environments (dev-test-legacy.company.com).

If an attacker compromises the private key from the poorly secured development server, they can impersonate any first-level subdomain. They can execute Man-in-the-Middle (MitM) attacks against your production API, intercepting authentication tokens and sensitive payload data without triggering browser or client-side TLS warnings.

Furthermore, Wildcard certificates expose infrastructure to cross-protocol attacks like ALPACA (Application Layer Protocol Confusion - Analyzing and Mitigating Cracks in TLS Authentication). If a web server and an FTP server share the same Wildcard certificate, an attacker can trick a victim's web browser into sending sensitive data to the FTP server, extracting cookies or credentials.

Because of these risks, NIST SP 1800-16 explicitly warns against the overuse of Wildcard certificates, advocating for strict key separation.

The Mechanics of a Subdomain Takeover via Dangling DNS

The risk of Wildcard certificates is magnified exponentially by cloud infrastructure sprawl and "dangling DNS" records. Subdomain takeovers occur when a DNS record points to a deprovisioned cloud resource, allowing an attacker to claim that resource and hijack the subdomain.

Consider this standard DevOps scenario:

  1. A development team requests a new subdomain for a marketing campaign: promo.company.com.
  2. IT creates a DNS CNAME record pointing promo.company.com to an AWS S3 bucket: company-promo-bucket.s3.amazonaws.com.
  3. Six months later, the campaign ends. The development team deletes the S3 bucket via their AWS console to save costs.
  4. The Failure: The team forgets to delete the CNAME record in Route 53 or Cloudflare. The DNS record is now "dangling."

An attacker running automated reconnaissance scripts scans the internet for dangling CNAME records. Upon discovering promo.company.com pointing to the non-existent company-promo-bucket.s3.amazonaws.com, the attacker simply logs into their own AWS account and creates an S3 bucket with that exact name.

Because the organization's DNS still points to that bucket name, the attacker now controls the content served at promo.company.com.

If the organization relies on a Wildcard certificate, the attacker's job is even easier. If they manage to extract the Wildcard private key from any other compromised host, they can instantly serve a trusted, encrypted malicious site. Even without the organization's key, the attacker can use a protocol like ACME via Let's Encrypt to provision a valid, trusted certificate for promo.company.com because they currently control the HTTP response for that domain (passing the HTTP-01 challenge).

The Industry Standard: Automated Per-Subdomain Certificates

To neutralize the blast radius of key compromise and integrate seamlessly with Infrastructure as Code (IaC), the consensus strategy is the Automated Single-Domain (Per-Subdomain) Certificate.

In this model, every single subdomain—whether public-facing or an internal microservice—receives its own unique certificate and private key.

Previously, organizations attempted to use Multi-Domain/SAN certificates to avoid Wildcards while limiting the number of total certificates. However, SAN certificates are notoriously hostile to CI/CD pipelines. If a microservice scales down and a subdomain is decommissioned, the entire SAN certificate must be regenerated, re-signed, and redeployed to all other servers listed on the certificate. This creates unacceptable operational friction.

Per-subdomain certificates solve this, provided they are entirely automated. With Google's push to reduce maximum certificate lifespans to 90 days, manual provisioning is mathematically impossible for enterprise environments. Automation via the Automated Certificate Management Environment (ACME) protocol is mandatory.

Implementation: Automating Subdomain Issuance in Kubernetes

For cloud-native environments, cert-manager is the industry standard for automating per-subdomain certificate issuance and rotation within Kubernetes clusters.

To avoid exposing internal subdomains to the internet for validation, and to seamlessly issue certificates for isolated services, the DNS-01 challenge is vastly superior to the HTTP-01 challenge.

Here is how to architect an automated issuance pipeline using cert-manager, Let's Encrypt, and AWS Route 53.

Step 1: Configure IAM Permissions

First, cert-manager needs permission to create temporary TXT records in your DNS zone to prove domain ownership. Using IAM Roles for Service Accounts (IRSA) in AWS, you attach a policy strictly scoped to the necessary hosted zone:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "route53:GetChange",
      "Resource": "arn:aws:route53:::change/*"
    },
    {
      "Effect": "Allow",
      "Action": [
        "route53:ChangeResourceRecordSets",
        "route53:ListResourceRecordSets"
      ],
      "Resource": "arn:aws:route53:::hostedzone/YOUR_HOSTED_ZONE_ID"
    }
  ]
}

Step 2: Define the ClusterIssuer

Next, define a ClusterIssuer in Kubernetes. This tells cert-manager how to communicate with the Certificate Authority (Let's Encrypt) and how to solve the DNS challenge.

apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
  name: letsencrypt-production-dns
spec:
  acme:
    server: https://acme-v02.api.letsencrypt.org/directory
    email: devops-alerts@company.com
    privateKeySecretRef:
      name: letsencrypt-production-account-key
    solvers:
    - dns01:
        route53:
          region: us-east-1
          hostedZoneID: YOUR_HOSTED_ZONE_ID

Step 3: Request a Per-Subdomain Certificate

When a developer deploys a new service (e.g., api-v2.company.com), they simply include a Certificate resource in their Helm chart or deployment manifest.

```yaml
apiVersion: cert-manager.io/v1
kind: Certificate
metadata

Share This Insight

Related Posts