Email Authentication Deep Dive: SPF, DKIM, and DMARC Explained
Email spoofing remains a top attack vector. Learn how SPF, DKIM, and DMARC work together to protect your domain from phishing and business email compromise.
Why Email Authentication Matters
Sending an email that appears to come from any domain in the world is trivially easy. The Simple Mail Transfer Protocol (SMTP) has no built-in sender verification -- the "From" address is entirely self-reported, just like the return address on a physical envelope. Attackers exploit this daily to impersonate executives, vendors, and trusted brands.
Business email compromise (BEC) remains one of the most financially devastating attack categories. The FBI's Internet Crime Complaint Center has consistently reported BEC losses in the billions of dollars annually, dwarfing ransomware and most other cybercrime categories combined. A single well-crafted spoofed email from the "CEO" requesting a wire transfer can cost an organization millions -- see our guide on preventing business email compromise for the full range of technical defenses.
Three DNS-based protocols -- SPF, DKIM, and DMARC -- work together to close this gap. They let domain owners declare who is authorized to send email on their behalf and instruct receivers on how to handle messages that fail verification. Despite being available for over a decade, most domains have these protocols misconfigured or missing entirely.
SPF: Sender Policy Framework
SPF allows a domain owner to publish a DNS TXT record specifying which mail servers are authorized to send email for that domain. When a receiving server gets a message, it checks the sending server's IP address against the SPF record of the domain in the envelope "MAIL FROM" address.
A properly constructed SPF record looks like this:
v=spf1 ip4:203.0.113.0/24 include:_spf.google.com include:amazonses.com -all
This record authorizes a specific IP range, Google Workspace servers, and Amazon SES, then instructs receivers to reject everything else (-all).
The 10-Lookup Limit
SPF has a critical constraint that trips up many administrators: a maximum of 10 DNS lookups during evaluation. Each include, a, mx, and redirect mechanism triggers a lookup, and nested includes count toward the total. Exceed 10 and the entire SPF evaluation returns a "permerror" result -- effectively the same as having no SPF record at all. The dangerous part is that this fails silently. Your emails keep flowing, but SPF protection is gone.
Organizations using multiple SaaS platforms (marketing automation, CRM, helpdesk, transactional email) can hit this limit quickly. The fix typically involves consolidating includes, replacing mechanisms with direct IP ranges where possible, or using SPF flattening services. For a step-by-step walkthrough, see our SPF record configuration guide.
Common SPF Mistakes
- Multiple SPF records: A domain must have exactly one SPF TXT record. Publishing two makes both invalid per the RFC.
- Using
+allor~all: The+allqualifier authorizes the entire internet to send as your domain -- it defeats the purpose entirely. The~all(softfail) qualifier signals suspicion but does not instruct rejection, giving attackers a wide opening. Always use-all(hardfail) once you have a complete sender inventory. - Forgetting third-party senders: Every service that sends email on your behalf needs to be included. Overlooking your ticketing system, invoice platform, or newsletter tool means legitimate mail fails SPF checks.
DKIM: DomainKeys Identified Mail
While SPF validates the sending server's IP address, DKIM validates the message itself. The sending mail server cryptographically signs specific headers and the message body using a private key. The corresponding public key is published in DNS, allowing any receiver to verify the signature.
A DKIM DNS record (published under a selector subdomain) looks like this:
selector1._domainkey.example.com. IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqhki..."
When a receiver gets a signed message, it retrieves the public key from DNS using the selector specified in the email's DKIM-Signature header, then verifies the cryptographic signature. If the message was altered in transit -- even by a single character -- verification fails.
Key Length Matters
DKIM key strength is a real security consideration. RSA keys under 1024 bits are considered crackable with modern computing resources. Keys of 1024 bits offer baseline protection but are increasingly seen as insufficient. The current recommendation is 2048-bit RSA keys, which provide a strong security margin without causing DNS packet size issues in most configurations.
Selector-Based Key Rotation
DKIM's selector mechanism enables zero-downtime key rotation. You can publish a new key under a new selector (e.g., selector2), configure your mail server to sign with the new key, and then remove the old selector's DNS record after a transition period. This is important for regular key hygiene and essential if you suspect a private key has been compromised. Our DKIM, MTA-STS, and TLS-RPT setup guide covers the full key generation and rotation process.
Common DKIM Issues
- Missing DKIM records entirely: Many domains rely solely on SPF and never configure DKIM signing, losing a critical authentication layer.
- Weak keys: Legacy configurations sometimes still use 512-bit or 768-bit keys that offer no meaningful protection.
- Broken signatures from forwarding: When emails are forwarded through mailing lists or auto-forwarding rules, the message body or headers may be modified, breaking the DKIM signature. This is a known limitation and one of the reasons DMARC supports passing on either SPF or DKIM (not necessarily both).
DMARC: The Policy Layer
DMARC ties SPF and DKIM together and adds a critical missing piece: a policy that tells receivers what to do when authentication fails. Without DMARC, each receiving server makes its own decision about unauthenticated mail. DMARC puts the domain owner in control.
A DMARC record is published as a TXT record at _dmarc.example.com:
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com; adkim=r; aspf=r;
The Three Policy Levels
p=none: Monitor mode. No action is taken on failing mail, but aggregate reports are sent to the address specified inrua=. This is the starting point for deployment.p=quarantine: Failing messages are delivered to the spam or junk folder instead of the inbox.p=reject: Failing messages are dropped entirely. This is the gold standard and the only policy that truly prevents spoofing.
Why Most Domains Never Progress Past p=none
A surprising number of organizations deploy DMARC in monitor mode and never advance. The reasons are predictable: the aggregate reports reveal legitimate senders they forgot about, the XML report format is difficult to parse without tooling, and the risk of blocking real email creates organizational inertia. Without a structured rollout plan, p=none becomes permanent -- offering zero protection against spoofing while giving a false sense of security. Our DMARC policy enforcement guide provides a phased approach to move safely from monitoring to full rejection.
Alignment Requirements
DMARC introduces the concept of alignment: the domain in the visible "From" header must match (or be a subdomain of) the domain authenticated by SPF or DKIM. This prevents attackers from passing SPF with their own domain while spoofing yours in the "From" header. Alignment can be set to relaxed (r, allowing subdomains to match the parent) or strict (s, requiring an exact match). Relaxed alignment is the default and works well for most organizations.
Aggregate vs. Forensic Reports
DMARC supports two reporting types. Aggregate reports (rua=) are XML summaries sent daily by receivers, showing authentication results for all mail claiming to be from your domain. Forensic reports (ruf=) contain details about individual failing messages. In practice, most large receivers only send aggregate reports, and forensic reports raise privacy concerns that limit their adoption.
The Progressive Deployment Strategy
Deploying email authentication correctly requires a methodical approach. Rushing to p=reject without preparation will break legitimate email delivery.
Step 1: Deploy DMARC in Monitor Mode
Publish a DMARC record with p=none and an rua= address to receive aggregate reports. This has zero impact on mail delivery while giving you visibility into who is sending email as your domain.
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com;
Step 2: Analyze Reports and Inventory Senders
Review aggregate reports for 2-4 weeks. Identify every legitimate service sending email on your behalf -- your mail server, marketing platform, transactional email service, CRM, helpdesk, and any other tools. Note which are failing SPF, DKIM, or alignment checks.
Step 3: Fix Authentication for All Senders
Update your SPF record to include all legitimate senders (while staying under the 10-lookup limit). Configure DKIM signing for every sending service. Verify alignment by ensuring each service sends with a "From" address under your domain.
Step 4: Ramp Up Enforcement Gradually
Move to p=quarantine with a percentage tag to limit the blast radius:
v=DMARC1; p=quarantine; pct=10; rua=mailto:dmarc-reports@example.com;
This applies the quarantine policy to only 10% of failing messages. Monitor reports, confirm no legitimate mail is affected, then increase to pct=25, pct=50, and eventually pct=100.
Step 5: Enforce Full Rejection
Once you are confident all legitimate senders pass authentication, move to the final policy:
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com; adkim=r; aspf=r;
Continue monitoring aggregate reports to catch any new senders or configuration drift. With Google and Microsoft now requiring DMARC, reaching p=reject is no longer just a best practice -- it is a deliverability requirement.
What CyberShield Checks
CyberShield's posture scan automates the detection of email authentication issues that are tedious to audit manually. The scan evaluates:
- SPF record validity: Checks for syntax errors, multiple conflicting records, and overly permissive qualifiers like
+all. - SPF lookup count: Counts DNS lookups recursively through all includes to flag records exceeding the 10-lookup limit before they silently break.
- DKIM key strength: Retrieves DKIM public keys for common selectors and flags keys below 1024 bits.
- DMARC policy level: Identifies domains stuck on
p=noneor missing DMARC entirely, and flags missing reporting addresses. - Alignment settings: Verifies that SPF and DKIM alignment is properly configured and that subdomain policies are intentional.
These checks run against your domain's live DNS records and provide actionable findings ranked by severity. If you have not audited your email authentication recently, run a scan to see where your domain stands. Misconfigured email authentication is one of the easiest attack surfaces to fix -- and one of the most dangerous to ignore.
Continue Reading
DMARC Policy: From Monitoring to Full Enforcement
Step-by-step guide to deploying DMARC, progressing from p=none monitoring to p=reject enforcement, with reporting configuration.
SPF Records: How to Configure Sender Policy Framework
Learn what SPF records are, how to create them correctly, and fix common issues like missing SPF, permissive qualifiers, and the 10-lookup limit.
AI-Powered Phishing: Why Email Authentication Is Your First Defense
AI-generated phishing emails are increasingly sophisticated, personalized, and difficult to detect. Learn why technical email authentication controls (SPF, DKIM, DMARC) are more important than ever as AI eliminates the traditional warning signs.