Skip to main content

Wildcard Records Pinned to Dead Load Balancer IPs

High severityDNS / AWS Route53 About 20 minutes to fix

Overview

A wildcard A record pinned to a load balancer's raw IP survives the load balancer's deletion. Once the provider reassigns that IP, every unregistered subdomain under the wildcard resolves to whichever tenant holds it, and scanners looking for dangling CNAMEs miss it.

At a glance

Symptom
The load balancer is decommissioned, its IP is released, and the cloud provider reassigns it to another tenant.
Likely cause
A wildcard record resolves directly to a load balancer's static IP instead of its DNS name.
Impact
Every unregistered subdomain under the wildcard silently routes to a third party's infrastructure with no DNS error raised.
Verification signal
Re-run the detection test and a controlled negative-path test.
Safe correction
Bind wildcard records to the load balancer's ALIAS/DNS name inside the same Terraform dependency graph, and audit random subdomain resolutions monthly against live infrastructure inventory.
Rollback or recovery
Restore the exported configuration if the new control blocks required production traffic, then narrow the policy before redeployment.

The Trap

Wildcard DNS records (*.domain.com) configured as A or AAAA entries pointing at the static IP address of a load balancer, rather than an alias or CNAME to the load balancer’s own DNS name.

The Default State

Engineers building a catch-all record for multi-tenant subdomains often skip a CNAME because some registrars and legacy DNS zones reject wildcard CNAMEs at certain apex positions, or because a Network Load Balancer (the only AWS load balancer type that accepts Elastic IPs) was assigned a fixed Elastic IP for a past compliance reason.

The wildcard gets written as *.domain.com A 52.x.x.x pointing straight at the ELB/NLB’s public IP, and that record is never revisited once the infrastructure it points to is retired.

The Blast Radius

When the load balancer is decommissioned — a Terraform destroy, a CloudFormation stack teardown, an EIP release — the IP address returns to the cloud provider’s general allocation pool. AWS, Azure and GCP all reuse released public IPs, with no guaranteed delay before one goes to another customer.

The wildcard record still resolves every non-existent subdomain to that IP, so whoever the provider hands it to next silently inherits all traffic for *.domain.com. Because the record is a wildcard rather than a fixed hostname, standard subdomain takeover scanners find nothing to enumerate: there is no specific dangling CNAME on a list, because any arbitrary string resolves.

An attacker who requests any subdomain, presents a matching TLS certificate for the new tenant, and waits, can capture OAuth callback traffic, session cookies scoped to the parent domain, or HTTP-01 ACME challenges for certificates they never should have been able to issue.

Internal tooling that assumes subdomain-based routing integrity — multi-tenant SaaS platforms, preview environments, SSO redirect allow-lists — inherits the exposure without any alert firing, because the DNS zone itself reports no error.

The Lead Mechanic Fix

Never bind a wildcard record to a load balancer’s raw IP. In Route53, use an ALIAS record referencing the load balancer’s stable DNS name (dualstack.my-alb-1234567890.us-east-1.elb.amazonaws.com), not the resolved address.

Wire the record into Terraform via aws_lb.main.dns_name as a direct resource attribute so the record set sits in the same dependency graph as the load balancer and gets updated or destroyed atomically with it.

Add a monthly audit job that resolves a random unregistered subdomain (dig +short $(uuidgen).domain.com) and checks the returned IP against a live infrastructure inventory, alerting on any address not currently owned by the account.

3

Apply the safer control

Before you change production

Confirm the affected scope, export the current configuration, and test the replacement control in a non-production environment first.

Fix commands and configuration

dualstack.my-alb-1234567890.us-east-1.elb.amazonaws.com
aws_lb.main.dns_name
dig +short $(uuidgen).domain.com
4

Verify, roll back or escalate

Verify

Re-run the detection test and a controlled negative-path test. Confirm the unsafe behaviour is blocked while approved traffic still succeeds.

Rollback

Restore the exported configuration if the new control blocks required production traffic, then narrow the policy before redeployment.

Escalate

Escalate when the blast radius is uncertain, the control cannot be tested safely, or remediation requires an outage or security exception.

The KBY Brief

Fixed? Get the next one before it hits you: The KBY Brief

Practical fixes for the systems you run, by email about twice a week. Unsubscribe at any time.

About this page

Credited to

Dates

Published

Last updated

Corrections

No corrections are listed for this page. Some review sweeps corrected pages without naming each one; those are in the corrections log.

Was this useful?

Reports go to the site owner and are used to correct pages. Corrections are listed at /corrections.

After remediation

Further reading stays below the corrective workflow and is selected by platform, category and shared technical keywords.

Discover more

Connected KBY resources