Skip to main content

CNAME Chains That Outlive the SaaS Account Behind Them

High severityDNS / SaaS Custom Domains About 20 minutes to fix

Overview

A CNAME chain provisioned for a SaaS custom domain can keep resolving through a vendor's shared edge network long after the underlying account is deleted, because the intermediate hop stays alive and only the final hostname claim expires. Standard dangling-DNS scanners check for NXDOMAIN or dead IPs, miss this state entirely, and never flag the exposure until an attacker claims the same hostname on the same platform.

At a glance

Symptom
The vendor's edge still resolves and serves TLS for the hostname, so standard NXDOMAIN-based dangling-DNS checks report the record as healthy.
Likely cause
A CNAME record pointing to a multi-tenant SaaS edge domain is left in place after the vendor account or project behind it is deleted.
Impact
An attacker claims the same hostname on the same SaaS platform, gets a valid certificate issued, and serves content or intercepts callbacks under the trusted parent domain.
Verification signal
Re-run the detection test and a controlled negative-path test.
Safe correction
Resolve the full CNAME chain, probe with the original Host header for the vendor's unclaimed-domain signature, and delete the DNS record automatically when the corresponding SaaS resource is…
Rollback or recovery
Restore the exported configuration if the new control blocks required production traffic, then narrow the policy before redeployment.

The Trap

A CNAME chain can outlive the decommissioned SaaS tenant it points into. The DNS record itself never breaks, but the hostname claim behind it expires without anyone noticing.

The Default State

Adding a custom domain on Vercel, Shopify, Zendesk or any multi-tenant edge platform works the same way: create a CNAME from app.company.com to the vendor’s alias (a project-specific vercel-dns host, shops.myshopify.com, yoursubdomain.zendesk.com), the vendor’s edge terminates TLS and routes by Host header rather than by IP, and the record goes into Terraform or the DNS console as a one-off entry.

When the project is deleted, the trial lapses, or the team migrates platforms, the decommission runbook removes the compute, the billing account and sometimes the vendor-side domain mapping. The Route 53 or Azure DNS CNAME record is rarely tracked as a dependent resource, so it survives untouched.

The Blast Radius

On many such platforms the vendor’s edge stays live and answers on port 443 for any hostname, so the CNAME chain never resolves to NXDOMAIN and never times out. It just returns a generic “domain not configured” page for the unclaimed host. A dangling-DNS scanner that only looks for broken resolution or dead IPs marks the record healthy.

An attacker registers a new account on the same platform, adds the exact orphaned hostname as their custom domain.

They pass whatever verification the vendor requires (which varies by platform, and on some is nothing more than the CNAME already pointing at their edge), and the platform’s automatic certificate issuance (often Let’s Encrypt) mints a valid certificate for company.com’s subdomain under the attacker’s control.

With that certificate they serve arbitrary content under a trusted origin, harvest cookies set with Domain=.company.com, receive misdirected SAML ACS POSTs or OAuth redirect callbacks still configured against that subdomain, and pass CSP or CORS allowlists that trust the company’s subdomains.

The Lead Mechanic Fix

Treat every vendor CNAME target as a live dependency, not an inert string.

Resolve the full chain with dig app.company.com, then probe the hostname itself with curl -sv https://app.company.com/ so the vendor’s edge sees the original Host header and SNI, and match the response body against the vendor’s current “unclaimed” signature from a maintained fingerprint list such as can-i-take-over-xyz (the exact strings change) rather than trusting a 200 or 404 status code alone.

Keep the DNS record’s lifecycle in the same Terraform module that creates the SaaS resource, with the aws_route53_record referencing the vendor’s domain resource (for example vercel_project_domain) so that destroying the vendor resource also destroys the record that references it, instead of leaving an unmanaged orphan behind. A bare depends_on only orders operations and deletes nothing.

Schedule a subdomain-takeover sweep of every third-party CNAME in the zone using an up-to-date fingerprint list, and tag every SaaS CNAME with a TXT record carrying an owner and review date. The sweep should flag stale records and open a ticket for the owner, and no record is deleted without a dry-run report and manual approval.

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

dig app.company.com
curl -sv https://app.company.com/
depends_on
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

  • : Corrected during a review of published articles. Details

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.

More from KBY that goes with this config trap.