Investigating EmailAttachmentInfo in Microsoft Defender XDR
EmailAttachmentInfo records attachment details for emails processed by Microsoft Defender for Office 365.
It helps defenders answer a key investigation question: what file was attached, what was its hash, and where else did it appear?
In this lesson, you'll learn how to investigate filenames, hashes, suspicious extensions and email-delivered payloads using EmailAttachmentInfo.
Lesson overview
Learn how EmailAttachmentInfo helps defenders investigate attachments, file hashes and suspicious email-delivered payloads.
Why EmailAttachmentInfo matters
Investigation scenario
Step 1 — Review recent attachment activity
- 1
- 2
- 3
- 4
- 5
- 6
- 7
EmailAttachmentInfo | where Timestamp > ago(7d) | project Timestamp, NetworkMessageId, SenderFromAddress, RecipientEmailAddress, FileName, FileType, SHA256, SHA1, ThreatTypes | order by Timestamp desc
Step 2 — Find common attachment names and hashes
- 1
- 2
- 3
- 4
- 5
- 6
- 7
EmailAttachmentInfo | where Timestamp > ago(30d) | summarize Messages = dcount(NetworkMessageId), Recipients = dcount(RecipientEmailAddress) by FileName, FileType, SHA256 | top 50 by Messages desc
Step 3 — Hunt for suspicious attachment extensions
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
EmailAttachmentInfo | where Timestamp > ago(14d) | where FileName has_any (".iso", ".img", ".lnk", ".js", ".vbs", ".hta", ".scr", ".exe", ".zip") | project Timestamp, SenderFromAddress, RecipientEmailAddress, FileName, FileType, SHA256, ThreatTypes, NetworkMessageId | order by Timestamp desc
Step 4 — Investigate one email message
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
let TargetMessageId = "replace-with-network-message-id"; EmailAttachmentInfo | where NetworkMessageId == TargetMessageId | project Timestamp, SenderFromAddress, RecipientEmailAddress, FileName, FileType, SHA256, SHA1, ThreatTypes | order by Timestamp asc
Step 5 — Join attachments back to EmailEvents
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
EmailAttachmentInfo | where Timestamp > ago(7d) | join kind=leftouter ( EmailEvents | where Timestamp > ago(7d) | project NetworkMessageId, Subject, DeliveryAction, ThreatTypes, EmailDirection ) on NetworkMessageId | project Timestamp, SenderFromAddress, RecipientEmailAddress, Subject, DeliveryAction, FileName, FileType, SHA256, ThreatTypes | order by Timestamp desc
Step 6 — Pivot from email attachment to endpoint file activity
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
let AttachmentHashes = EmailAttachmentInfo | where Timestamp > ago(7d) | where isnotempty(SHA256) | distinct SHA256; DeviceFileEvents | where Timestamp > ago(7d) | where SHA256 in (AttachmentHashes) | project Timestamp, DeviceName, ActionType, FileName, FolderPath, SHA256, InitiatingProcessFileName, InitiatingProcessAccountName | order by Timestamp desc
