Malicious email delivery
Overview
Section titled “Overview”These alerts fire when Defender for Office 365 detects malicious content in email messages — either successfully removed after delivery (ZAP) or identified but not removed. Covers:
- Email messages containing malicious file removed after delivery — ZAP removed an attachment-based threat
- Email messages containing malicious URL removed after delivery — ZAP removed a URL-based threat
- Email messages from a campaign removed after delivery — ZAP removed messages linked to a known attack campaign
- Email messages removed after delivery — generic ZAP removal
- Messages containing malicious entity not removed after delivery — threat identified but ZAP failed or was not triggered
The critical distinction is removed vs. not removed. Successful ZAP means the threat was neutralized in the mailbox; failed removal means the user may still have access to the malicious content.
Key tables and columns
Section titled “Key tables and columns”| Table | Use | Key columns |
|---|---|---|
EmailEvents | Email delivery and post-delivery status | NetworkMessageId, RecipientEmailAddress, SenderFromAddress, Subject, DeliveryAction, DeliveryLocation, LatestDeliveryAction, LatestDeliveryLocation, EmailDirection, ConfidenceLevel |
EmailAttachmentInfo | Attachment details (file name, hash, type) | NetworkMessageId, FileName, FileSize, SHA256, RecipientEmailAddress |
EmailUrlInfo | URLs embedded in the email | NetworkMessageId, Url, UrlDomain |
EmailPostDeliveryEvents | Post-delivery actions (ZAP, admin removal) | NetworkMessageId, RecipientEmailAddress, DeliveryLocation, ActionType |
UrlClickEvents | User clicks on URLs in email | NetworkMessageId, Url, AccountUpn, ActionType, IsClickedThrough |
AlertEvidence | Pre-extracted entities from the alert | EntityType, EvidenceRole, NetworkMessageId, SHA256 |
Join spine: NetworkMessageId links all email tables. Start from EmailEvents, join to attachments, URLs, post-delivery, and clicks.
Investigation steps
Section titled “Investigation steps”These supplement the general triage-ladder in docs/investigation.md.
-
Pull alert evidence.
xdr incidents show <id> --expand alerts— extractNetworkMessageId, recipient(s), sender, subject, file hashes, URLs, and the delivery verdict. The evidence often contains the full threat assessment. -
Determine delivery status. This is the most important question — was the threat delivered to the inbox, or was it caught?
Terminal window xdr library run qry_email_delivery --param network_message_id=<network-message-id>LatestDeliveryActioncontainingZap(e.g.Zapped) = ZAP succeeded — this matches howqry_email_blast_radiuscounts ZAP success (countif(LatestDeliveryAction has 'Zap')).LatestDeliveryLocationofInboxorMailbox= user may have accessed the threat.
-
Assess blast radius. Did other users receive the same email?
Terminal window xdr library run qry_email_blast_radius --param sender=<sender> --param subject=<subject> --param start=<start> --param end=<end>If multiple recipients, check whether ZAP succeeded for all of them.
-
Examine the malicious content. For attachment-based threats:
Terminal window xdr library run qry_email_attachments --param network_message_id=<network-message-id>For URL-based threats:
Terminal window xdr library run qry_email_urls --param network_message_id=<network-message-id> -
Check for user interaction. Did any recipient click a malicious URL or open the attachment?
Terminal window xdr library run qry_url_clicks --param account_upn=<recipient-upn> --param start=<start> --param end=<end>IsClickedThrough=truemeans the user bypassed the warning page — this significantly increases risk. -
Scope the threat artifact. If you have a file hash, check if it landed on any endpoint:
Terminal window xdr library run qry_file_hash_scope --param sha256=<hash>For URLs, check
DeviceNetworkEventsorDeviceEventsfor connections to the malicious domain. -
Check for post-compromise activity. If a user clicked through or the attachment was opened:
- Check
DeviceProcessEventsfor suspicious process execution after the email delivery time. - Check
EntraIdSignInEventsfor anomalous sign-ins if the threat was credential phishing. - Check
CloudAppEventsfor inbox rule creation that might indicate account takeover.
- Check
Pivots
Section titled “Pivots”| From | To | Why |
|---|---|---|
NetworkMessageId → email details | EmailEvents + EmailAttachmentInfo + EmailUrlInfo | Full picture of what was delivered |
| Sender → other messages | EmailEvents by SenderFromAddress | Was this part of a broader campaign? |
| File hash → endpoints | qry_file_hash_scope library query | Did the attachment land on any device? |
| URL domain → clicks | UrlClickEvents by Url | Did anyone click through to the malicious site? |
| Recipient → post-delivery | EmailPostDeliveryEvents by NetworkMessageId | Was ZAP successful? |
| Recipient → sign-ins | EntraIdSignInEvents by AccountObjectId | Post-click credential compromise? |
Common false positives
Section titled “Common false positives”- EICAR test files. Security teams testing email filtering with EICAR test strings. Verify the sender is an internal security team member and the subject references a test.
- Marketing/newsletter emails with flagged URLs. Legitimate bulk email with tracking URLs that trigger URL reputation alerts. Check the sender domain and the URL destination.
- Repackaged legitimate software. Attachments flagged as PUA (potentially unwanted application) rather than malware. Check the specific threat name — PUA is lower risk than trojans or exploits.
- Auto-forwarded external mail. Mail forwarded from an external source that carries a flagged attachment. The threat may already have been neutralized at the external org.
Containment recommendations
Section titled “Containment recommendations”If the threat was delivered and user interaction is confirmed or suspected:
-
Purge the message from all mailboxes.
Suggest to the analyst: use Explorer in the Security portal to hard-delete the message by
NetworkMessageIdfrom all recipient mailboxes. -
If URL was clicked through:
Suggest: check the user’s device for compromise indicators. Consider
xdr device isolate <device_id> --comment "<reason>"if process execution was observed post-click. -
If credential phishing:
Suggest: reset the user’s password, revoke sessions, and monitor
EntraIdSignInEventsfor the next 24–48 hours. -
Block the sender/domain.
Suggest: add the sender domain or specific sender to the Tenant Allow/Block List if the campaign is ongoing.