Lesson 44 — The Attachment Reached the Inbox
The email had already been delivered.
Sitting inside the user's inbox was an attachment named Invoice_September.zip.
The user was not sure whether they had opened it.
Agent Foskett had two separate questions to answer:
What exactly arrived in the email?
And did that attachment ever become activity on the endpoint?
The attachment was delivered
Identify the attachment, preserve its hash, determine who received it and then look for evidence that the file reached or executed on a device.
Case briefing
Investigation objective
Trace a suspicious attachment from email delivery through attachment telemetry and into endpoint file and process evidence without assuming that delivery, download and execution are the same event.
Investigator's rule
Keep delivery, file appearance and execution separate. Each stage requires its own evidence.
Stage 1 — confirm the email and delivery
EmailEvents
| where Timestamp > ago(7d)
| where Subject =~ "Outstanding Invoice — September"
| project Timestamp,
NetworkMessageId,
SenderFromAddress,
SenderFromDomain,
RecipientEmailAddress,
Subject,
DeliveryAction,
DeliveryLocation
| order by Timestamp desc
Delivery establishes exposure
If the message reached the inbox, the recipient had the opportunity to interact with it. That matters, but it still does not establish what happened to the attachment afterwards.
Preserve the NetworkMessageId
Use the message identifier to move from the email record into attachment telemetry without relying only on the subject or sender.
Stage 2 — identify the attachment
let MessageId = "<NETWORK-MESSAGE-ID>";
EmailAttachmentInfo
| where NetworkMessageId == MessageId
| project Timestamp,
NetworkMessageId,
FileName,
FileType,
SHA256,
ThreatTypes,
DetectionMethods
The filename is not the identity
Invoice_September.zip is useful context, but filenames are easy to change. A cryptographic hash provides a much stronger pivot when it is available.
Record what detection saw
Threat and detection fields can provide useful context, but the analyst should still correlate the attachment with delivery and endpoint evidence before describing what happened.
Stage 3 — separate the stages of attachment activity
| Stage | What the evidence would establish |
|---|---|
| Email delivery | The message and attachment reached the recipient's mailbox. |
| File appearance | A matching file or related extracted file appeared on an endpoint. |
| File execution | A process event shows a file actually ran. |
| Child activity | The executed file initiated additional processes or commands. |
| Network activity | A process contacted remote infrastructure after execution. |
Do not skip a stage
“Attachment delivered” should never silently become “malware executed” in the incident notes. The evidence chain must show the transition.
User memory is supporting context
The user's recollection can help define the search window, but endpoint telemetry should determine whether the file actually appeared or executed.
Stage 4 — hunt for the attachment hash on endpoints
let AttachmentHash = "<SHA256>";
DeviceFileEvents
| where Timestamp > ago(7d)
| where SHA256 == AttachmentHash
| project Timestamp,
DeviceName,
FileName,
FolderPath,
SHA256,
ActionType,
InitiatingProcessFileName
| order by Timestamp asc
A hash match creates a bridge
If the same SHA256 appears in email attachment telemetry and endpoint file telemetry, the SOC has a strong correlation between the delivered attachment and a file observed on a device.
No match is still a result
If the attachment hash never appears in available endpoint telemetry, record that finding carefully. It may reduce evidence of endpoint interaction, but it does not prove the user never accessed the attachment.
Stage 5 — account for archives and extracted files
Archives change the pivot
A ZIP attachment may be only the container. Once extracted, the investigation must follow newly created files by time, path, filename and initiating activity rather than expecting the archive hash to identify every child file.
Build around the file-creation time
If the archive appears on the endpoint, inspect nearby DeviceFileEvents for additional files created shortly afterwards.
Stage 6 — inspect nearby file activity
let FileTime = datetime(2026-09-01 11:18:42);
DeviceFileEvents
| where Timestamp between (FileTime - 2m .. FileTime + 10m)
| where DeviceName =~ "WS-FIN-021"
| project Timestamp,
FileName,
FolderPath,
SHA256,
ActionType,
InitiatingProcessFileName
| order by Timestamp asc
Look for extraction patterns
Several new files appearing within seconds of the archive can reveal that the attachment was opened or extracted even when the original container itself was never executed.
Preserve new hashes
Any suspicious extracted executable, script or document becomes a new investigation entity with its own hash and endpoint history.
Stage 7 — determine whether a suspicious file executed
let StartTime = datetime(2026-09-01 11:18:42);
DeviceProcessEvents
| where Timestamp between (StartTime .. StartTime + 15m)
| where DeviceName =~ "WS-FIN-021"
| project Timestamp,
FileName,
FolderPath,
SHA256,
ProcessCommandLine,
InitiatingProcessFileName,
InitiatingProcessCommandLine
| order by Timestamp asc
Execution changes the incident
Once a suspicious extracted file is observed as a process, the investigation has crossed from email exposure into endpoint execution and should follow the process tree and resulting activity.
Ask what launched it
The initiating process can help explain whether the file was launched through Explorer, an Office application, a script host, a browser or another process.
Stage 8 — check what the process did next
let ExecutionTime = datetime(2026-09-01 11:20:03);
DeviceNetworkEvents
| where Timestamp between (ExecutionTime .. ExecutionTime + 15m)
| where DeviceName =~ "WS-FIN-021"
| project Timestamp,
InitiatingProcessFileName,
InitiatingProcessSHA256,
RemoteUrl,
RemoteIP,
RemotePort,
ActionType
| order by Timestamp asc
Follow behaviour, not just the file
Execution is important, but the next question is what the process did: child processes, network connections, persistence or other suspicious behaviour may determine the true impact.
Keep the timeline connected
The strongest investigation shows the sequence from mailbox delivery to attachment identity, endpoint appearance, extraction, execution and subsequent behaviour.
Stage 9 — build the attachment timeline
Stage 10 — write the investigation finding
Lesson 44 key takeaways
- Delivery, download, extraction and execution are different investigation stages.
- Use the NetworkMessageId to correlate the message with attachment telemetry.
- Use EmailAttachmentInfo to identify filename, file type and SHA256 where available.
- A filename is context; a hash is a stronger technical pivot.
- Use DeviceFileEvents to look for the attachment on endpoints.
- Archive attachments may create new files with completely different hashes.
- Inspect nearby file events to identify extraction activity.
- Use DeviceProcessEvents to establish execution rather than assuming it.
- Follow executed files into subsequent process and network behaviour.
- Write conclusions that distinguish each stage the evidence actually proves.
Module 5 — Email & Phishing: From Message to Compromise
Lesson 44 traced an attachment from mailbox delivery into endpoint activity. Lesson 45 introduces a different trap: the message passed authentication, but the evidence still says it deserves investigation.
Continue your SOC Analyst training
🔎 SOC Analyst Academy — Module 5: Email & Phishing: From Message to Compromise
Investigating suspicious email attachments in Microsoft Defender XDR
Lesson 44 of the Agent Foskett SOC Analyst Academy teaches SOC analysts how to correlate EmailEvents and EmailAttachmentInfo with DeviceFileEvents, DeviceProcessEvents and DeviceNetworkEvents to trace an attachment from mailbox delivery into endpoint activity.
Trace phishing attachment delivery and execution with KQL
Learn how to preserve attachment hashes, identify files on endpoints, investigate archive extraction, establish process execution and follow post-execution network activity using Microsoft Defender XDR Advanced Hunting.
