How to read SPF, DKIM and DMARC in a phishing email
By Hari PatelPublished Updated
SPF, DKIM and DMARC are the three email authentication checks. SPF tests whether the sending IP may send for the envelope domain, DKIM verifies a domain's signature over the message, and DMARC passes only when one of them passes for a domain aligned with the visible From. None of them proves the message is safe.
Authentication tells you which domain is accountable for a message. It does not tell you the message is safe. Here is how to read each result, where analysts misread them, and how attackers get a clean pass.
Paste a message's headers to see SPF, DKIM, DMARC, alignment and the compauth reason decoded in your browser. The DKIM checker verifies the signatures against DNS keys.
Analyze your headersOn this page
How a receiver evaluates SPF, DKIM and DMARC
- SPFThe connecting IP is checked against the SPF record of the envelope sender (Return-Path) domain.
- DKIMEach DKIM-Signature is verified with the public key published at selector._domainkey under its d= domain.
- AlignmentDMARC takes the From domain and asks whether a passing SPF or DKIM domain matches it.
- PolicyIf neither aligns, the From domain's DMARC policy (none, quarantine or reject) says what to do.
- compauthMicrosoft 365 also weighs ARC from forwarders and its own sender checks into one composite verdict.
- StampThe results are written to Authentication-Results at your boundary: the header you read.
What is the difference between SPF, DKIM and DMARC?
Each check authenticates a different domain, and only DMARC is tied to the From address the user sees:
| Check | What it checks | Domain it authenticates | Where you see the result | Survives forwarding? | What a pass proves |
|---|---|---|---|---|---|
| SPF | The connecting IP is listed in the domain's SPF record | Envelope sender (Return-Path, smtp.mailfrom) | spf= in Authentication-Results, and Received-SPF | No: the forwarder's IP is not in the sender's record | That domain allowed this IP to send. Nothing about the From |
| DKIM | A signature over the body and chosen headers, verified with a public key in DNS | The signing domain (d=, shown as header.d) | dkim= in Authentication-Results | Yes, unless something changes the signed content | The signed parts are unchanged since d= signed them |
| DMARC | SPF or DKIM passed for a domain aligned with the From | The From domain (header.from) | dmarc= and action= in Authentication-Results | Through DKIM, or ARC if the receiver trusts the forwarder | The visible From domain is not spoofed |
Read the right header
Servers add headers on top as a message travels, so the topmost Authentication-Results written by your own mail system is the one to read. Copies further down were written by servers you do not control, and an attacker can add fake ones before sending. ARC-Authentication-Results headers record what intermediaries such as forwarders and mailing lists saw.
A typical Microsoft 365 result looks like this: spf=pass smtp.mailfrom=mail.example.com; dkim=pass header.d=example.com; dmarc=pass action=none header.from=example.com; compauth=pass reason=100.
The email header analyzer reads the topmost Authentication-Results, decodes each result with its alignment, and shows the ARC chain for forwarded mail.
SPF: the sending IP
SPF checks whether the connecting IP is allowed to send for the envelope sender's domain (Return-Path, shown as smtp.mailfrom), not the From address the user sees. Results are pass, fail, softfail, neutral, none, temperror and permerror.
An SPF pass for bounce.mailer.example says nothing about a From of [email protected]. Forwarding breaks SPF because the forwarder's IP is not in the original sender's record, and a record with more than ten DNS lookups returns permerror.
DKIM: the signature
DKIM is a signature over chosen headers and the body by the domain in d=, verified with a public key published at selector._domainkey.domain. It survives forwarding as long as the signed content is unchanged.
- The signing domain can be any domain, including the email platform's own, so a pass alone proves little.
- An
l=tag signs only the first part of the body. Anything appended after it, such as a phishing link, is unsigned but the signature still passes. - DKIM replay: an attacker sends one genuinely signed message through a real service, then resends it to thousands of recipients. The signature stays valid. Signs are a To or Date that does not match the recipient or delivery time.
The DKIM checker verifies each signature against the published key, so you can prove a message was or was not altered, and looks up a selector's record to show its key type, size and flags.
DMARC: the From you see
DMARC passes when SPF or DKIM passes and the passing domain aligns with the From domain: the same organizational domain in relaxed mode, an exact match in strict mode. It is the only one of the three tied to what the user sees.
action= shows the policy applied: none, quarantine or reject. A domain with p=none can be spoofed with nothing worse than a fail verdict. Microsoft 365 shows dmarc=bestguesspass when a domain publishes no DMARC record but the result would have aligned.
compauth in Microsoft 365
Composite authentication combines SPF, DKIM, DMARC, ARC and Microsoft's own sender checks into one verdict: compauth=pass, fail, softpass or none. Its reason code explains it:
| Reason | Meaning |
|---|---|
| 000 | Failed explicit authentication (compauth=fail), for example DMARC fail with a quarantine or reject policy |
| 001 | Failed implicit authentication (compauth=fail): no authentication records, or only weak ones such as SPF softfail or neutral, or DMARC p=none |
| 002 | Your organization's policy explicitly prohibits this sender and domain pair from sending spoofed mail. An admin set this up |
| 010 | Failed DMARC with reject or quarantine, and the From is one of your own accepted domains (intra-org spoofing) |
| 1xx, 7xx | Passed (compauth=pass). The last two digits are Microsoft internal codes |
| 130 | Passed because ARC results were used to override a DMARC failure |
| 2xx | Soft pass of implicit authentication (compauth=softpass) |
| 3xx | Not checked for composite authentication (compauth=none) |
| 4xx, 9xx | Composite authentication was bypassed (compauth=none). The last two digits are Microsoft internal codes |
| 6xx | Failed implicit authentication, and the From is one of your own accepted domains (intra-org spoofing) |
compauth sits next to the spam filter's own verdict. To read SFV, SCL and CAT in the same message, see Microsoft 365 anti-spam headers.
How does phishing still pass SPF, DKIM and DMARC?
- Attacker-owned domains with perfect SPF, DKIM and DMARC. A lookalike registered yesterday authenticates as well as your bank.
- Compromised accounts at real organizations, sending from the genuine mailbox.
- Legitimate services: invoices, document shares and calendar invites sent by real platforms on the attacker's behalf, signed by the platform.
- DKIM replay of a genuinely signed message.
- Subdomains of a brand whose DMARC policy does not cover them.
So treat a pass as "this domain sent it" and move on to the content, the links and the relationship. Treat a DMARC fail on a brand that publishes p=reject as close to a verdict on its own.
How each role works it
- SOC analyst
- Reads one header to decide whether the From can be trusted, then moves on to the content. A DMARC fail on a brand that publishes p=reject is close to a verdict on its own.
- Incident responder
- Uses the authenticated domain and sending IP as block and hunt keys, and checks whether your own domain is being spoofed because of a weak policy.
- DFIR
- Verifies the DKIM signature against the published key to prove whether a message was altered, and records the selector and DNS state at the time, since keys get rotated.
- Malware analyst
- Rarely needed for the payload, but the sending infrastructure (IP, HELO, signing domain) ties a sample to a campaign or a known bulk-sending service.
What the workbench checks
Drop the reported email into the free workbench and these are checked in your browser before you read a line. Nothing is uploaded.
- Every Authentication-Results and ARC header, with the one from your boundary identified
- SPF, DKIM, DMARC and compauth results with reason codes
- Alignment between From, envelope sender and DKIM signing domain
- Local DKIM verification with the DNS key: body hash, signature, l= appended content and replay hints
- Your own domain arriving from outside without authentication
Hunting queries
KQL to scope the campaign and look for impact. The workbench writes these with the real sender, subject, domains and hashes filled in.
EmailEvents
| where Timestamp > ago(7d) and EmailDirection == "Inbound"
| extend Auth = parse_json(AuthenticationDetails)
| extend SPF = tostring(Auth.SPF), DKIM = tostring(Auth.DKIM),
DMARC = tostring(Auth.DMARC), CompAuth = tostring(Auth.CompAuth)
| where DMARC == "fail" and DeliveryLocation == "Inbox/folder"
| summarize Messages = count(), Recipients = dcount(RecipientEmailAddress)
by SenderFromDomain, SPF, DKIM, CompAuth
| sort by Messages desclet mydomains = dynamic(["contoso.com"]);
EmailEvents
| where Timestamp > ago(30d) and EmailDirection == "Inbound"
| where SenderFromDomain in~ (mydomains)
| extend DMARC = tostring(parse_json(AuthenticationDetails).DMARC)
| where DMARC != "pass"
| summarize Messages = count(), Recipients = dcount(RecipientEmailAddress)
by SenderMailFromDomain, SenderIPv4, DMARC
| sort by Messages descReplace contoso.com with your accepted domains.
Questions
Does dmarc=pass mean an email is safe?
No. It means the From domain authorized the message. Attackers register their own domains with full authentication, and compromised accounts send from genuine domains. A pass only removes spoofing as an explanation.
Why does a legitimate email fail SPF?
Usually forwarding, a new sending service that was never added to the SPF record, or a record that needs more than ten DNS lookups and returns permerror. Check ARC and DKIM before calling it spoofed.
What does compauth=fail reason=001 mean?
Implicit authentication failed. The sending domain has no DMARC record or only a weak policy, and Microsoft's own checks could not confirm the sender. It is common on spoofed mail from domains that never set up DMARC.
What is DKIM replay?
Resending a genuinely signed message, unchanged, to new recipients. The signature still verifies. The giveaways are a To header that does not include the recipient, an old Date, and the same message reaching many unrelated organizations.
References
- RFC 7208: Sender Policy Framework
- RFC 6376: DKIM Signatures
- RFC 7489: DMARC
- RFC 8617: Authenticated Received Chain
- RFC 8601: Authentication-Results header
- Microsoft: Anti-spam message headers
Related on WETNav