New guide: how to warm up a dedicated IP without hurting your reputation. Read now →
Log in
MigoSMTP
Domains and DNSUpdated 26 Oct 2026

Wildcard DNS Records and Email: Risks for MX, SPF and Subdomain Spoofing

How wildcard DNS records (*.example.com) interact with email: surprising MX and TXT answers, SPF and DMARC inheritance, subdomain spoofing, catch-all behaviour, safer alternatives and how to audit a zone.

AO
Written by Amara Okafor
DNS and Domain Specialist
Reviewed by Mei Lin Tan
  • Published20 Jan 2025
  • Read time6 min
  • Length1,320 words
Share this guide

A wildcard record such as *.example.com answers for any name that has no more specific record. It is convenient for web hosting, tenant subdomains and quick setups, and it can quietly cause trouble for email. Mail servers query names that administrators rarely think about: the name _dmarc.sub.example.com, the DKIM selector host, the MX of a subdomain that no one ever created. A wildcard may answer these with unexpected data, make a non-existent subdomain look like a valid mail domain or let a wildcard TXT record spread SPF text that nobody intended. At the same time the absence of records on unused subdomains leaves them open to spoofing unless policies cover them. This guide explains how wildcards behave for different record types, what goes wrong in email, how to protect unused subdomains and how to audit a zone. It builds on DMARC subdomain policy, parked domains and DNS TTLs.

RuleA wildcard applies only where no record of any type exists at that exact name
TrapCreating any record at a subdomain stops the wildcard from applying to that name for every type
Email risksUnexpected MX and TXT answers, accidental mail acceptance, spoofable subdomains
FixPublish explicit records for sending and non-sending names, and avoid wildcard MX and TXT unless deliberate

How wildcards really work

The rules are subtle and are defined in RFC 4592. A wildcard record matches a query name if there is no explicit record set for that name and no records exist at any name below it. The wildcard supplies data for the record type requested; if the wildcard has no record of that type, the answer is "no data" for that type, not a fall-through to another wildcard. Names that exist only as parents of other names (called empty non-terminals) do not trigger the wildcard.

Zone contentQueryAnswer
*.example.com. A 203.0.113.5foo.example.com A203.0.113.5 (wildcard applies)
Samefoo.example.com MXNo data: the wildcard has no MX, and since the name is covered by the wildcard, no other type is found
*.example.com. A ... and mail.example.com. A 198.51.100.7mail.example.com TXTNo data: the name exists with an A record, so the wildcard does not supply a TXT answer
*.example.com. TXT "v=spf1 -all"_dmarc.example.com TXTReturns the wildcard SPF text for the DMARC name, which receivers will see as not a DMARC record, though odd
*.example.com. MX 10 mx.example.net.anything.example.com MXmx.example.net: every random subdomain appears to accept mail
a.b.example.com. A ... onlyb.example.com AName exists as an empty non-terminal, so no wildcard answer; no data

Problems with wildcard records in an email context

PatternWhat goes wrongBetter practice
Wildcard MXAny subdomain becomes a valid mail destination. Typo domains and made-up names accept mail, increasing spam and backscatter load; attackers can create addresses on unlimited subdomainsCreate MX only for subdomains that receive mail, or publish a null MX (0 .) where mail is not accepted
Wildcard TXT with SPF textEvery undefined name returns an SPF-looking record. Checks and tools become confusing, and the record can exceed lookup limits. See SPF limitsPublish SPF explicitly on each name that sends or should be locked down
Wildcard A/AAAA/CNAME for web tenantsReceivers that fall back to A records for domains without MX (the implicit MX rule) may try to deliver mail to the web serverPublish explicit MX or null MX for tenant names
Wildcard CNAMECan interfere with records that cannot coexist with CNAME and send queries for DKIM selectors to unexpected targetsAvoid wildcard CNAME; use specific names
No SPF/DMARC on unused subdomainsAttackers send mail as billing.example.com or secure-login.example.com; without a policy for subdomains, receivers apply noneSet DMARC sp=reject and null SPF on non-sending names. See subdomain policy
Dangling wildcard targetsA wildcard CNAME to a cloud service you stopped using enables takeover of every subdomainRemove records that point to decommissioned services

Protecting subdomains from spoofing

The organisational DMARC record (_dmarc.example.com) applies to subdomains through the sp tag, or through p if sp is absent, so one reject policy can cover every unused subdomain at once, provided each legitimate sender authenticates and aligns. Add these protections without relying on wildcards for TXT data:

; Organisational DMARC covering all subdomains
_dmarc.example.com.        TXT  "v=DMARC1; p=reject; sp=reject; rua=mailto:[email protected]"

; Non-sending names (explicit, not wildcard)
www.example.com.           TXT  "v=spf1 -all"
www.example.com.           MX   0 .

; Optional: null SPF for every undefined name WITHOUT affecting named records
*.example.com.             TXT  "v=spf1 -all"

The last line shows a legitimate use of a wildcard TXT: a null SPF for all otherwise undefined names. It works because any name that has any record of its own stops matching the wildcard; consequently, whenever you create a record at a subdomain, you must also add its SPF text if the subdomain should send or be locked, since the wildcard no longer answers there. This is the most common cause of "SPF none" on a subdomain that used to look protected. Test wildcards deliberately before relying on them, and note that wildcards never apply to names with underscores in the same way for every tool: some validators query specific names only and do not expand wildcards.

Auditing your zone

  1. Export the full zone from your DNS provider and list every wildcard record by type.
  2. For each wildcard, write down its purpose, the owner and what would break if it were removed.
  3. Query a random, non-existent subdomain for MX, TXT, A, AAAA and CNAME and see what comes back: dig MX qx7n2z.example.com.
  4. Check _dmarc and typical selector names under a random subdomain to confirm you do not return confusing data.
  5. Search for subdomains with a CNAME to external services that are no longer used (takeover risk).
  6. For subdomains that must never send mail, add explicit null SPF and a null MX. For those that send, add their own SPF, DKIM and DMARC alignment. See sending subdomain strategy.
  7. Review DMARC aggregate reports for subdomain names you did not know existed. See DMARC report tools.
  8. Repeat after each major DNS change and include the checks in your release routine.

A practical test routine

Run a short test whenever you add or change a wildcard. Query a made-up name such as zz-test-91.example.com for MX, TXT, A, AAAA and CNAME and write down the answers. Query _dmarc.zz-test-91.example.com and a likely selector name such as s1._domainkey.zz-test-91.example.com. Then create a single record at a different made-up name, for example a TXT at zz-test-92.example.com, and repeat the queries there: you should see that the wildcard no longer answers for any other type at that name. Keeping this small experiment in your runbook makes the abstract rules concrete for new team members, and it is the fastest way to find out whether a managed DNS provider implements wildcards exactly as the standard describes, because some providers add their own behaviour or limit wildcards to certain record types.

Multi-tenant platforms

Platforms that give each customer a subdomain often use a wildcard web record. Pair it with deliberate email decisions: publish a null MX and null SPF at the wildcard level for tenants who do not use mail, and create explicit records when a tenant enables sending, including DKIM and return-path names. Treat the tenant subdomain list as an inventory that feeds DNS automation, so that records are created and removed together with the tenant. See tenant sending.

Wildcards are neither good nor bad; they are broad. For email, breadth is risky, because mail systems ask many narrow questions. Use wildcards for web convenience, cover subdomains with DMARC and explicit null records and audit the zone so that every name that matters has an intentional answer.

Check a domain and its subdomains Verify SPF, DKIM and DMARC records.

Open the checker

References and further reading

Frequently asked questions

When does a wildcard DNS record apply?

Only when no record of any type exists at the queried name and no names exist below it.

Is a wildcard MX record a good idea?

Rarely. It makes every subdomain look like a mail destination; use explicit MX or a null MX instead.

How do I stop subdomain spoofing?

Use DMARC with sp=reject and publish null SPF and null MX on names that never send or receive mail.

Why does my subdomain show no SPF record after I added a record?

Creating any record at a name stops the wildcard from answering there, so you must add the SPF text explicitly.

How can I test wildcard behaviour?

Query a random non-existent subdomain for MX and TXT with dig and compare with what you expect.

Topics#dns#wildcard#subdomains#spoofing#spf
Was this guide helpful?Your answer helps us improve our documentation.

Start sending in minutes.

Create an account, add your domain and send your first email.

Get started Talk to sales