Misaligned SPF CIDR Entries Can Cause Inconsistent DMARC Rejections

Summary
A misaligned IPv4 CIDR in an SPF record can produce inconsistent receiver results and cause legitimate mail to fail under DMARC p=reject. The article recommends checking network boundaries, lookup limits, mechanisms, aggregate reports and test sends.
Key points
- The example SPF mechanism, ip4:135.84.68.123/28, uses a host address instead of the network address; the article says to use 135.84.68.112/28 for the block or omit the CIDR to authorize only .123.
- The article reports that receivers handle the misaligned mechanism differently: some mask the host bits, while others may return permerror or temperror.
- It says many validators check SPF syntax and lookup counts but do not verify that a CIDR address is aligned to its network boundary.
- Other cited SPF pitfalls include exceeding the 10-DNS-lookup limit, using deprecated ptr mechanisms, placing mechanisms after all, and using +all, which authorizes every IP.
- The article explains that DMARC p=reject can cause messages that fail authentication to be rejected at the SMTP layer, making inconsistent SPF evaluation a deliverability risk.
- Before enforcement, it recommends reviewing SPF mechanisms and nested includes, checking 14 days of DMARC aggregate reports, and testing authorized senders with several mailbox providers.
Article Details
- Defense Focus
- Prevent legitimate email delivery failures under DMARC p=reject by identifying malformed or inconsistently evaluated SPF records before enforcement.
- Detection Methods
- Inspect each SPF ip4 or ip6 CIDR mechanism and verify that the address is the network address for the stated prefix.
- Resolve nested SPF includes and count all DNS lookups across the evaluation chain; the total must not exceed 10.
- Check for deprecated ptr mechanisms, mechanisms placed after all, duplicate all mechanisms, and an unsafe +all qualifier.
- Review recent DMARC aggregate reports for SPF permerror, temperror, softfail, or fail results, especially recurring results associated with a receiver or sending IP.
- Send test messages from each authorized source to multiple receiving providers and inspect the Authentication-Results header for spf=pass.
- Data Sources
- Published SPF DNS TXT records and their nested include records
- DMARC aggregate reports, including SPF results and receiver information
- Delivered-message Authentication-Results headers
- SMTP bounce reports
- Rule Types
- SPF record mechanism and semantic validation, including CIDR alignment, DNS lookup limits, and mechanism ordering
- DMARC aggregate-report review in XML format
- Platforms
- Receiving mail platforms used for cross-provider test messages, including Gmail, Microsoft 365, and Yahoo
- Defensive Actions
- Correct a misaligned CIDR mechanism by using the actual network address, or remove the CIDR suffix when authorizing a single IP.
- Keep SPF evaluation at 10 or fewer DNS lookups, including nested includes; consolidate or remove unused mechanisms if needed.
- Remove ptr mechanisms and ensure all appears exactly once as the final mechanism, with a ~ or - qualifier rather than +.
- Before moving to p=reject, review 14 days of aggregate reports and resolve SPF errors or recurring temperror results from legitimate sending sources.
- Test every authorized sending source against multiple receiving providers before enabling enforcement.
Tools
dmarcianKitterman, MXToolbox, EasyDMARC, and dmarcian's inspector all return clean results on the same record.EasyDMARCKitterman, MXToolbox, EasyDMARC, and dmarcian's inspector all return clean results on the same record.KittermanKitterman, MXToolbox, EasyDMARC, and dmarcian's inspector all return clean results on the same record.MXToolboxKitterman, MXToolbox, EasyDMARC, and dmarcian's inspector all return clean results on the same record.URIportsURIports is the only mainstream tool we've found that catches this specific bug, and it does so explicitly, flagging that the IP address is not aligned with its CIDR network mask.
