Skip to content
high severityMicrosoft Defender XDR

Find phishing emails delivered to inboxes (KQL)

Defender for Office 365 sometimes assigns a phishing or malware verdict to a message that was still delivered — because the verdict arrived late, a rule overrode filtering, or detection improved after delivery. Those messages are the ones sitting in users' inboxes right now. This EmailEvents query returns messages with a Phish or Malware threat type whose DeliveryAction is Delivered and whose DeliveryLocation is the inbox or junk folder.

Use it to drive zero-hour auto-purge follow-up and to find recipients who may already have interacted with the message.

The query

EmailEvents
| where Timestamp > ago(24h)
| where ThreatTypes has_any ("Phish", "Malware")
| where DeliveryAction == "Delivered"
| where DeliveryLocation in ("Inbox/folder", "Junk folder")
| project Timestamp, SenderFromAddress, RecipientEmailAddress, Subject,
          ThreatTypes, DetectionMethods, DeliveryAction, DeliveryLocation, NetworkMessageId
| sort by Timestamp desc

Line-by-line explanation

  • | where ThreatTypes has_any ("Phish", "Malware")

    Keeps messages Defender later judged to be phishing or malware.

  • | where DeliveryAction == "Delivered"

    Filters to messages that actually reached the recipient, not ones blocked or replaced.

  • | where DeliveryLocation in ("Inbox/folder", "Junk folder")

    Narrows to the inbox and junk folder, where a user can still open the message, rather than quarantine.

Required tables and columns

  • ThreatTypesVerdict assigned to the message, such as Phish or Malware.
  • DeliveryActionWhat happened to the message; Delivered means it reached the mailbox.
  • DeliveryLocationWhere it landed (Inbox/folder, Junk folder, Quarantine, etc.).
  • NetworkMessageIdUnique message id to pivot into EmailUrlInfo, EmailAttachmentInfo and UrlClickEvents.

MITRE ATT&CK mapping

Tuning and false positives

  • Join NetworkMessageId to UrlClickEvents to see whether any recipient clicked a link in the delivered message.
  • Separate Phish and Malware into distinct severities, and treat Malware delivered to the inbox as critical.

Limitations

  • DeliveryLocation reflects placement at processing time; a user may have since moved or deleted the message.
  • Threats detected only after a mailbox rule moved the mail may show a different location; widen the filter if you suspect rule interference.

References

Last reviewed 2026-11-18.