The SPF Check Passed... For The Wrong Domain
The email looked legitimate.
The visible sender used a familiar company name.
Microsoft Defender recorded SPF = Pass.
Everyone assumed the sender had been authenticated.
Nobody asked which domain SPF had actually checked.

Email Authentication Investigation
SPF passed. The visible sender still did not deserve trust.
The message looked authenticated
SPF passed—but for which identity?
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
Visible From address: accounts@trusted-brand.example Envelope sender: bounce@mailer-platform.example SPF result: PASS — for mailer-platform.example
The first KQL question
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
EmailEvents
| where Timestamp > ago(7d)
| project Timestamp,
Subject,
SenderFromAddress,
SenderMailFromAddress,
AuthenticationDetails,
NetworkMessageId
Find messages where the domains do not align
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
EmailEvents
| where Timestamp > ago(7d)
| extend VisibleFromDomain = tostring(split(SenderFromAddress, "@")[1])
| extend EnvelopeFromDomain = tostring(split(SenderMailFromAddress, "@")[1])
| where isnotempty(VisibleFromDomain)
| where isnotempty(EnvelopeFromDomain)
| where VisibleFromDomain != EnvelopeFromDomain
| project Timestamp,
Subject,
SenderFromAddress,
SenderMailFromAddress,
AuthenticationDetails,
NetworkMessageId
Narrow the results to SPF evidence
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
EmailEvents
| where Timestamp > ago(7d)
| extend VisibleFromDomain = tostring(split(SenderFromAddress, "@")[1])
| extend EnvelopeFromDomain = tostring(split(SenderMailFromAddress, "@")[1])
| where VisibleFromDomain != EnvelopeFromDomain
| where tostring(AuthenticationDetails) has "spf"
| project Timestamp,
SenderFromAddress,
SenderMailFromAddress,
AuthenticationDetails,
DeliveryAction,
DeliveryLocation

