Correlating EmailEvents with DeviceNetworkEvents in Microsoft Defender XDR.
The phishing email had been delivered.
The attachment was opened.
A suspicious process launched.
But Agent Foskett knew one final question remained.
Did the compromised device communicate with anything on the internet?
To uncover the next stage of the attack, he correlated EmailEvents with DeviceNetworkEvents.
Lesson overview
Learn how to correlate EmailEvents with DeviceNetworkEvents to identify outbound connections after phishing email delivery, attachment execution or suspicious endpoint activity.
Why email and network correlation matters
The fields used in this lesson
Step 1 — Review recent email deliveries
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
EmailEvents
| where Timestamp > ago(24h)
| project Timestamp,
RecipientEmailAddress,
SenderFromAddress,
Subject,
NetworkMessageId
| order by Timestamp desc
Step 2 — Review outbound network activity
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
DeviceNetworkEvents
| where Timestamp > ago(24h)
| project Timestamp,
DeviceName,
AccountUpn,
RemoteUrl,
RemoteIP,
InitiatingProcessFileName
| order by Timestamp desc
Step 3 — Correlate email and network activity by user and time
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
EmailEvents
| join kind=inner (
DeviceNetworkEvents
) on $left.RecipientEmailAddress == $right.AccountUpn
| where Timestamp1 between (Timestamp .. Timestamp + 30m)
| project EmailTime = Timestamp,
NetworkTime = Timestamp1,
RecipientEmailAddress,
DeviceName,
Subject,
RemoteUrl,
RemoteIP,
InitiatingProcessFileName
| order by NetworkTime asc
Step 4 — Hunt for suspicious initiating processes
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
DeviceNetworkEvents
| where InitiatingProcessFileName in~ (
"powershell.exe",
"cmd.exe",
"wscript.exe",
"cscript.exe",
"mshta.exe"
)
| project Timestamp,
DeviceName,
AccountUpn,
InitiatingProcessFileName,
RemoteUrl,
RemoteIP
Step 5 — Summarise destinations contacted after email delivery
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
EmailEvents
| join kind=inner (
DeviceNetworkEvents
) on $left.RecipientEmailAddress == $right.AccountUpn
| where Timestamp1 between (Timestamp .. Timestamp + 1h)
| summarize Connections = count(),
Devices = dcount(DeviceName),
Users = dcount(RecipientEmailAddress)
by RemoteUrl,
RemoteIP
| order by Connections desc
Step 6 — Build the investigation timeline
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
EmailEvents
| join kind=inner (
DeviceNetworkEvents
) on $left.RecipientEmailAddress == $right.AccountUpn
| where Timestamp1 between (Timestamp .. Timestamp + 1h)
| project EmailTime = Timestamp,
NetworkTime = Timestamp1,
RecipientEmailAddress,
DeviceName,
Subject,
InitiatingProcessFileName,
RemoteUrl,
RemoteIP
| order by EmailTime asc, NetworkTime asc
How to read the results
Common investigation uses
Common mistakes
What you learned
Related Agent Foskett Academy lessons
Coming next
Final thought
Correlating EmailEvents with DeviceNetworkEvents in Microsoft Defender XDR
Agent Foskett Academy Lesson 79 teaches defenders how to correlate EmailEvents with DeviceNetworkEvents during Microsoft Defender XDR phishing investigations.
Learn email and network correlation in Defender XDR
This lesson explains how EmailEvents, DeviceNetworkEvents, RecipientEmailAddress, AccountUpn, DeviceName, RemoteUrl, RemoteIP and InitiatingProcessFileName help defenders follow a phishing attack from email delivery to outbound endpoint communication.
