Back to TIL
TIL

Cloudflare Nameservers Can Hint at Shared Ownership

Identical Cloudflare nameserver pairs can be a clue that domains share an account, but they are not proof.

Two illustrated cats wearing matching Cloudflare-logo bandanas

I came across an interesting Hacker News discussion about how Cloudflare assigns nameservers to domains.

When you add a domain to Cloudflare, it typically assigns two authoritative nameservers, such as:

text
aryanna.ns.cloudflare.com
peyton.ns.cloudflare.com

What I didn't know is that Cloudflare generally tries to assign the same nameserver pair to domains within the same account.

This means that if two seemingly unrelated domains have identical Cloudflare nameservers, they might be managed through the same account.

You can inspect a domain's nameservers with:

Bash
dig NS example.com +short

There is an important catch, though. Cloudflare's standard nameserver pairs are not unique to individual accounts. Unrelated customers can share a pair, and domains within the same account can sometimes receive different pairs due to conflicts.

Cloudflare's documentation confirms that it favors consistent assignments within an account, but does not guarantee them.

An interesting security implication

This led me to another question: what happens if a domain is pointed at a DNS provider's nameservers before the domain is added to an account?

For example, Vercel uses the same authoritative nameservers for its DNS customers:

text
ns1.vercel-dns.com
ns2.vercel-dns.com

If I configure my domain to use these nameservers but haven't added it to Vercel yet, what prevents another customer from claiming it first?

The answer depends on how the provider verifies domain control. Shared nameservers alone cannot establish which customer is authorized to manage a domain.

Cloudflare's nameserver conflict-handling mechanisms are particularly interesting in this context. Vercel, which uses shared nameserver hostnames, must handle the account-ownership problem differently.

This doesn't establish a vulnerability in either provider, but it highlights an important distinction: delegating DNS to a provider is not the same as proving which account should control the domain.

References