11 September 2026 · 9 min read

SPF: too many DNS lookups — and the bigger number underneath it

Most people arrive at this subject through an error message: too many DNS lookups, or a checker returning PermError. The fix is well documented and this guide covers it. But the error is a symptom of something the fix does not address, and almost nobody counts it: the number of IP addresses your domain currently authorizes to send mail as you. On one real record we assessed, that number was 1,086,996.

The error, and what actually triggers it

SPF is evaluated by the receiving mail server, at delivery time, by walking your record and resolving whatever it points at. RFC 7208 caps that walk at ten DNS-querying mechanisms. Exceed it and the evaluation does not fail politely part-way through — it returns PermError, and a receiver treating PermError as a failure stops honouring your record at all. Legitimate mail from senders that were listed correctly starts landing in spam, and it happens to every sender at once.

The reason it surprises people is that the count is not the number of entries you typed. It is the number of lookups the receiver performs, which includes everything your includes include. A record naming seven mailing platforms can easily require fifteen.

Scroll the table sideways →

MechanismCounts toward the ten?In practice
include:Yes — one each, plus everything it resolves toThe usual cause. Eight includes is eight lookups before you have added a single sender.
a / a:domainYes — one eachOften a leftover from a server that has been decommissioned or transferred.
mx / mx:domainYes — one, plus one per MX host returnedA domain with five MX records spends six lookups here, not one.
exists:Yes — one eachRare outside macro-based setups.
ptrYes — and deprecatedRFC 7208 says do not publish it. Remove rather than budget for it.
redirect=Yes — one, plus the record it points atEasy to overlook because it sits at the end of the record.
ip4: / ip6:NoFree against the limit. This is why flattening works, and why the limit is a poor proxy for exposure.
allNoThe qualifier in front of it does the real work: ~all softfails, -all fails.

There is a second, quieter cap: at most two “void” lookups — queries that return nothing. An include pointing at a domain that no longer publishes a record is not inert. It spends budget and, past two, it breaks the record.

The fix, and the tradeoff in the popular version of it

The remaining option is flattening: resolving the chain yourself and publishing the resulting ip4: blocks directly, which cost nothing against the limit. It works, and it moves the problem rather than removing it. Your providers change their ranges without telling you, and a flattened record is correct on the day it is generated and progressively wrong afterwards. If you flatten, it needs to be regenerated on a schedule by something that will still be running in a year.

In practice

Notice what flattening reveals. The lookup limit constrains how many DNS queries a receiver makes, not how many addresses you trust. You can take a record from PermError to valid without reducing your exposure by a single address — which is why the error is a poor proxy for the risk.

The number nobody counts

Every checker will tell you whether you are over ten lookups. We have not found one that answers the question a security owner would ask instead: how many distinct IP addresses can currently send mail that passes SPF for our domain? The arithmetic is not hard. Resolve the whole chain, collect every ip4: and ip6: block, and add up what the prefixes mean.

Scroll the table sideways →

PrefixAddresses authorizedTypically
/321A single mail server
/24256One small sender's own range
/204,096A mid-sized ESP block
/1665,536A shared provider region
/15131,072Two of those
/14262,144A large shared cloud range

A real record, counted

The following is a real chain from an assessment of a mid-sized B2B SaaS company, anonymised — the domain is not named, and everything below was read from public DNS that any visitor can query. No system was accessed and nothing was scanned.

Read those last two lines together with the first three. Mail sent from anywhere inside a million-address envelope passes SPF for the domain. Relaxed alignment lets it align. A quarantine policy asks receivers to set it aside rather than reject it — and plenty of receivers deliver quarantined mail to a folder the recipient still reads. Nothing in that sequence requires a vulnerability, an exploit or a credential. It requires an SMTP client and a position inside a shared range.

That last part is the step people wave away, so it is worth being precise about how cheap it is. The BreakSPF research presented at NDSS assembled a pool of 87,430 usable addresses across five shared-infrastructure providers at a cost of under one cent per address, and used it to confirm 23,916 domains that could be spoofed as a direct consequence of over-broad SPF — 23 of them in the Tranco top 1,000. The same work found that 51.7% of domains in the Tranco top million authorize more than 65,536 addresses through their SPF chain. The slides are public. A million-address record is not an outlier. It is the median outcome of a decade of adding senders and never removing any.

Count your own, in about five minutes

You need dig and a calculator. Nothing here touches a system you do not own, and nothing here sends mail. If you would rather not do the arithmetic, the same walk runs as code in the free SPF DNS lookup checker — it returns both numbers and prints every record it read, so you can check the working.

Now look up who owns the largest blocks — an RDAP query against the relevant registry will tell you. The useful version of the finding is never “we authorize a million addresses”. It is “we authorize a million addresses, 590,000 of which belong to shared provider ranges we do not control, and our policy asks receivers to quarantine rather than reject”. One of those sentences can be acted on.

Where this sits against your other findings

Practitioners genuinely disagree about how seriously to weigh this, and the disagreement is reasonable, because severity-scored tooling has no opinion on it at all. There is no CVE and no CVSS score for a record that trusts too much, so it does not appear on the report that drives most remediation queues. Ranking it needs the three questions that rank anything: can something outside your boundary reach it, what does the attacker actually need, and what is behind it.

On those four, an over-broad SPF chain frequently outranks findings scored 9.8 — which is the argument made at length, with a worked reordering, in how to prioritize security findings when everything is labelled critical.

The sequence for actually reducing it, in the order that avoids breaking your own mail: inventory who legitimately sends as you, remove everyone else, narrow what remains, then tighten policy in stages — DMARC p=none with aggregate reports arriving first, so you can see what you are about to block, then quarantine, then reject, and only then consider moving ~all to -all. Reversing that order is how companies break payroll notifications.

What the number does not tell you

It is not evidence that anyone has spoofed you. It is a measure of what is permitted, not of what has happened — and the two get conflated in vendor material more often than they should. Only your DMARC aggregate reports show what is actually being sent in your name, which is a good reason to publish a rua address even at p=none.

Nor is a large count automatically an incident. A domain that authorizes a single well-run provider’s range has a big number and a defensible one. The finding is about ranges you do not control and senders nobody can name, not about arithmetic for its own sake.

And it is one of three signals. SPF says where mail may originate; DKIM proves it was not altered; DMARC ties either of them to the domain a human reads. A tight SPF record alongside unsigned mail and no DMARC policy is a locked window in an open house. If the reason you are reading this is that a customer asked how you authenticate mail, the companion piece on answering a security questionnaire without a security team covers how to evidence that answer rather than assert it.

Free · No card · No login

Free Exposure Check, researched by hand

We will run the count above on your domain, plus two other prioritized exposures on your public surface, each with the observable evidence that surfaced it — by email within 24 hours. Read only what any visitor can see: public DNS and the headers your servers return. No scanning, no access to your systems. Free, no card, no login.

We use your email only to deliver your free check. No spam, no automated scanning of your systems, no unauthorized access.