# Fix SPF Void Lookups Limit Exceeded (>2 NXDOMAIN or Empty DNS Answers)

> Why dead SaaS includes and non-existent A/MX mechanisms trigger RFC 7208 §4.6.4 PermError after just 2 void lookups, even when total lookups are under 10.

- **Canonical URL**: https://opslint.dev/spf/void-lookups-limit-2-nxdomain-permerror/
- **Category**: `SPF`
- **Interactive Workbench**: [Open in Live Workbench](https://opslint.dev/spf/#domain=microsoft.com)
- **Normative Specifications**: `RFC 7208 §4.6.4 (Void Lookups Limit of 2)`, `RFC 7208 §11.1 (Denial-of-Service amplification mitigation)`

## Incident Symptom & Root Cause

**Production Symptom**: An SPF record with only 5 total mechanisms (well below the 10-lookup ceiling!) unexpectedly fails SPF authentication at strict receivers with spf=permerror (too many void lookups).

**Protocol / Engine Root Cause**: To stop attackers from abusing SPF parsers for NXDOMAIN DNS amplification attacks, RFC 7208 §4.6.4 specifies a SEPARATE counter for 'void lookups': any DNS query triggered by an SPF mechanism/modifier that returns either RCODE 3 (NXDOMAIN) or RCODE 0 (NOERROR) with 0 answer records. Exceeding 2 void lookups returns PermError!

## Remediation Diff (Broken vs Verified Fix)

### SPF Record with 3 Void Lookups (Only 5 Total Lookups, Still PermError!)

```text
; Total lookups = 5 (<= 10), YET void lookups = 3 (> 2) -> PermError!
; 1. 'a' on a domain with no root A/AAAA record (only www CNAME exists) -> Void #1 (NODATA)!
; 2. 'include:spf.defunct-startup-crm.io' (expired domain) -> Void #2 (NXDOMAIN)!
; 3. 'include:_spf.typo-mailer.com' (DNS typo) -> Void #3 (NXDOMAIN) -> PermError!
example.com. 3600 IN TXT "v=spf1 a include:_spf.google.com include:spf.defunct-startup-crm.io include:_spf.typo-mailer.com -all"
```

### Zero-Void-Lookup Audited SPF Record

```text
; Removed 'a' (apex has no A record) and purged dead/typo vendor includes!
; Total lookups = 4, Void lookups = 0!
example.com. 3600 IN TXT "v=spf1 include:_spf.google.com -all"
```

## Engineering Deep Dive

Many DNS linters check only the 10-mechanism limit and completely miss the 2-void-lookup fuse in the second paragraph of RFC 7208 §4.6.4: 'SPF implementations SHOULD limit void lookups to two. An implementation MAY choose to make such a limit configurable. In this case, a default of two is RECOMMENDED. Exceeding the limit produces a permerror result.' Major mailbox providers including Google, Yahoo, and rspamd/SpamAssassin enforce this 2-void limit in production.

Notice that TWO distinct DNS outcomes count as a void lookup! The obvious culprit is Status=3 (NXDOMAIN) from a typoed include: domain or a shuttered SaaS vendor whose domain expired. The hidden culprit is Status=0 (NOERROR / NODATA) with zero matching RRset answers! For instance, if marketing hosts example.com on a CDN or parks the apex without an A or AAAA record (redirecting only www.example.com), putting 'a' in example.com's SPF record queries example.com A -> returns 0 answers (NODATA) -> silently burns 1 of your 2 allowed void lookups on every single email!

Another frequent source of fake void-lookup alarms in naive web checkers is RFC 7208 §7 SPF macros (such as exists:%{i}._spf.mta.salesforce.com). A broken checker that queries the literal string '%{i}._spf...' over DNS gets NXDOMAIN and falsely reports a void lookup, whereas a real SMTP receiver expands %{i} to the connecting client IPv4 address before querying DNS. Always test macro-bearing records with a simulated sender IP in an RFC-aware SPF workbench.

## Void Lookup Triggers & Diagnostic Matrix

| Case / Engine | Protocol Behavior | Production Remediation |
| :--- | :--- | :--- |
| **Churned vendor / Typoed include: (RCODE=3 NXDOMAIN)** (`#void-nxdomain-vendor`) | Increments both global mechanism count (+1) and void lookup count (+1). | Audit all include: targets quarterly and immediately remove decommissioned SaaS tools. |
| **a or a:host where host has TXT/MX only, no A/AAAA (RCODE=0, 0 answers)** (`#void-nodata-apex-a`) | Counts as a NODATA void lookup (+1 void lookup) despite domain existing in DNS! | Verify dig +short A <host> returns >=1 IP before keeping 'a' in v=spf1. |
| **mx on subdomain with no MX records (or RFC 7505 Null MX '0 .')** (`#void-empty-mx`) | Zero usable MX answers increments void lookup counter. | Never include 'mx' on outbound-only subdomains that do not publish inbound MX hosts. |
| **exists:%{i}._spf.vendor.com tested without IP simulation** (`#void-macro-false-positive`) | Unexpanded literal %{i} returns NXDOMAIN in naive DNS tools; valid IPs resolve A=127.0.0.2 at SMTP time. | Pass a real sending IP into OpsLint's simulatedIp field when auditing macro SPF records. |

## Frequently Asked Engineering Questions

### Does an include: that resolves TXT cleanly but does not match the sender IP count as a void lookup?

No! 'Void lookup' refers strictly to the DNS query returning zero DNS resource records (NXDOMAIN or NODATA), NOT whether the SPF CIDR matched the client IP. An include: that returns a valid TXT record costs 0 void lookups.

### What if an include: domain exists (has an A record) but has NO TXT record at all?

Two bad things happen: first, the TXT query returns 0 TXT answers (NODATA -> +1 void lookup); second, per RFC 7208 §5.2 Table 1, an include: target that yields 'None' (no valid v=spf1 TXT record) immediately causes the parent SPF evaluation to abort with PermError!

### How can I quickly scan our domain for void lookups from the terminal?

Paste your domain into the OpsLint SPF Workbench (which tracks Mechanisms, Per-MX, and Void Lookups separately), or inspect every a, mx, and include target with dig +noall +comments +answer TXT <target> looking for status: NXDOMAIN or ANSWER: 0.

## Related Problem-Cluster Guides

- [Fix SPF PermError: Too Many DNS Lookups (Exceeding the RFC 7208 10-Lookup Limit)](https://opslint.dev/spf/permerror-too-many-dns-lookups-10-limit/) — Understand which SPF mechanisms count toward RFC 7208 §4.6.4's hard 10-lookup ceiling, why nested vendor includes blow the budget, and how to cut lookups safely.
- [SPF Macros Explained: exists:%{i}, %{ir}, %{d}, and Why Naive Checkers Falsely Error](https://opslint.dev/spf/spf-macros-exists-percent-i-enterprise-senders/) — Decode RFC 7208 §7 dynamic SPF macros (%{i}, %{ir}, %{s}, %{d}, %{h}) used by Salesforce, Proofpoint, and Mimecast, and prevent false NXDOMAIN void-lookup errors.
- [Remove Deprecated SPF ptr Mechanism and Fix Per-MX (>10) Lookup Explosions](https://opslint.dev/spf/deprecated-ptr-mechanism-and-mx-lookup-explosion/) — Why RFC 7208 §5.5 officially deprecated the SPF ptr mechanism, how mx mechanisms trigger hidden secondary 10-lookup PermErrors, and how to replace both.
- [Protect Parked Domains & Non-Mail Hosts with Null SPF (v=spf1 -all), Null MX, and DMARC Reject](https://opslint.dev/spf/null-spf-v-spf1-minus-all-parked-domains/) — Lock down parked domains, API/CDN subdomains, and defensive lookalike domains in 4 DNS lines using RFC 7208 v=spf1 -all, RFC 7505 Null MX, and DMARC p=reject.
