Safeguard
Security Guides•

Are wildcard DNS records a security risk?

A wildcard DNS record answers for names that do not exist. See where that helps, where it hides typos and takeover paths, and how to scope it.

Safeguard Security Team
4 min read

A wildcard record is not a vulnerability by itself, but it widens what your domain appears to serve. It answers for hostnames that do not exist, which can hide typos, make takeover audits harder and combine badly with wildcard certificates and cookies. Use one where a design needs it, and scope it narrowly.

What a wildcard does

A wildcard record has an asterisk as its leftmost label, for example the name *.example.com. RFC 4592 explains the mechanism: when a query names something that does not exist in the zone, the server may synthesise an answer from the wildcard. Names that do exist are not affected. A query for anything.example.com gets the wildcard's data even though no one created that host.

Typical uses are multi tenant software with a hostname per customer, preview environments, and catch all web servers.

Where the risk comes from

IssueWhy it matters
Hidden typosA mistyped internal hostname resolves instead of failing, so mistakes live longer
Audit blind spotA zone list shows one wildcard but hides every name that resolves through it, so inventories are incomplete
Takeover surfaceA wildcard CNAME pointing at a third party platform can expose every name under it if that platform lets others claim names
Phishing aidAnyone can craft a long, convincing hostname on your domain that really resolves
Cookie scopeParent scoped cookies reach every name the wildcard serves, see subdomain takeover impact
Certificate scopeA wildcard certificate plus a wildcard record means one key protects a large set of names

The takeover point is worth care. MDN and Microsoft both describe subdomain takeover as a CNAME pointing at a service where nothing now answers. A wildcard CNAME can turn one stale target into many exposed names.

A scoping approach

  1. Ask whether you need it. Per tenant records created by your provisioning code give a precise inventory.
  2. Scope it down. Use a wildcard below a dedicated zone, for example under a customer content domain, rather than on the apex of your main domain.
  3. Keep it off your main registrable domain if the wildcard points to untrusted or customer controlled content.
  4. Validate hostnames in the application. Have the server reject Host headers it does not recognise, rather than serving a default site.
  5. Do not point it at third party platforms unless you know the platform's rules on who can claim names.
  6. Pair it with narrow cookies. Leave out the Domain attribute and use the host prefix.
  7. Document it. Record why it exists, who owns it and when it should be reviewed.

Wildcards and certificates

If you use a wildcard certificate, think about where the private key lives. A single compromise exposes every name. Compare with per host certificates in our wildcard certificate decision guide. Certificate Transparency logs, covered in using CT logs to find hostnames, show wildcard issuance but not the hostnames used under it.

Testing

Query a random name under the wildcard and see what answers. Request a name with a made up Host header against your web tier. If it returns a real application, tighten the default behaviour.

Safeguard's asset discovery and SBOM scanning cover software you run, and do not inspect DNS zones. You can try a free scan at gold.safeguard.sh/scan.

Quick check

Does a wildcard override a record I create explicitly?

No. An explicit record for a name takes precedence. The wildcard answers for names that do not otherwise exist in the zone.

Should I never use wildcards?

They have good uses, such as per customer hostnames. Keep them narrow, documented and reviewed.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.