Inbound Sender Domains Failing Email Authentication
Description
This query lists inbound sender domains with the most email authentication failures (DMARC, DKIM, SPF, and Composite Authentication), using the EmailEvents table.
Query · kql
// Inbound sender domains with the most email authentication failures (DMARC, DKIM, SPF, Composite Authentication).
EmailEvents
| where Timestamp > ago(30d)
| where OrgLevelPolicy !in ("Phishing simulation", "SecOps Mailbox")
| where EmailDirection == "Inbound"
| extend Key = strcat(NetworkMessageId, '-', RecipientEmailAddress)
| summarize arg_max(Timestamp, *) by Key
| extend Auth = parse_json(AuthenticationDetails)
| summarize TotalInbound = count(), MessagesFailingAnyAuth = countif(tostring(Auth.DMARC) == "fail" or tostring(Auth.DKIM) == "fail" or tostring(Auth.SPF) == "fail" or tostring(Auth.CompAuth) == "fail"), DMARCFail = countif(tostring(Auth.DMARC) == "fail"), DKIMFail = countif(tostring(Auth.DKIM) == "fail"), SPFFail = countif(tostring(Auth.SPF) == "fail"), CompAuthFail = countif(tostring(Auth.CompAuth) == "fail") by SenderDomain = SenderFromDomain
| where MessagesFailingAnyAuth > 0
| top 20 by MessagesFailingAnyAuth
| project SenderDomain, MessagesFailingAnyAuth, DMARCFail, DKIMFail, SPFFail, CompAuthFail, TotalInbound