← Back to SOC feed Coverage →

Email containing malware accessed on a unmanaged device

kql MEDIUM Azure-Sentinel
T1204
CloudAppEvents
huntingmicrosoftofficial
This rule was pulled from an open-source repository and enriched with AI. Validate in a test environment before deploying to production.
View original rule at Azure-Sentinel →
Retrieved: 2026-05-11T11:00:00Z · Confidence: medium

Hunt Hypothesis

Adversaries may use unmanaged devices to access and execute malware embedded in emails, leveraging these devices to bypass traditional endpoint protections. SOC teams should proactively hunt for this behavior in Azure Sentinel to identify potential lateral movement and exfiltration attempts from unmanaged devices.

KQL Query

EmailPostDeliveryEvents
| where ActionType == "Malware ZAP"
| project NetworkMessageId,InternetMessageId,ActionType,ThreatTypes,DetectionMethods,ZAPReportId=ReportId,ZAPTimestamp=Timestamp
| join (CloudAppEvents | where ActionType == "MailItemsAccessed"
| extend RawEvent=parse_json(RawEventData)
| mv-expand RawEvent.Folders
| mv-expand RawEvent_Folders.FolderItems
| project SessionId=tostring(RawEvent.SessionId),InternetMessageId=tostring(parse_json(RawEvent_Folders_FolderItems).InternetMessageId),ActionTimestamp=Timestamp,ActionReportId=ReportId
) on InternetMessageId
| where isnotempty(SessionId)
| join (AADSignInEventsBeta | where isempty(DeviceName) | distinct AccountUpn,SessionId) on SessionId
| project AccountUpn,NetworkMessageId,InternetMessageId,ActionType,ThreatTypes,DetectionMethods,SessionId,ReportId=ActionReportId,Timestamp=ActionTimestamp

Analytic Rule Definition

id: 439f817c-845c-4dda-a8d9-5c1f6831cee9
name: Email containing malware accessed on a unmanaged device
description: |
  In this query, we are looking for emails containing malware accessed on a unmanaged device
description-detailed: |
  In this query, we are looking for emails containing malware accessed on a unmanaged device by MDE. The query using multiple data sources across Defender XDR including Defender for Office 365
requiredDataConnectors:
- connectorId: MicrosoftThreatProtection
  dataTypes:
   - EmailPostDeliveryEvents
   - CloudAppEvents
   - AADSignInEventsBeta
tactics:
  - Execution
relevantTechniques:
  - T1204
query: |
  EmailPostDeliveryEvents
  | where ActionType == "Malware ZAP"
  | project NetworkMessageId,InternetMessageId,ActionType,ThreatTypes,DetectionMethods,ZAPReportId=ReportId,ZAPTimestamp=Timestamp
  | join (CloudAppEvents | where ActionType == "MailItemsAccessed"
  | extend RawEvent=parse_json(RawEventData)
  | mv-expand RawEvent.Folders
  | mv-expand RawEvent_Folders.FolderItems
  | project SessionId=tostring(RawEvent.SessionId),InternetMessageId=tostring(parse_json(RawEvent_Folders_FolderItems).InternetMessageId),ActionTimestamp=Timestamp,ActionReportId=ReportId
  ) on InternetMessageId
  | where isnotempty(SessionId)
  | join (AADSignInEventsBeta | where isempty(DeviceName) | distinct AccountUpn,SessionId) on SessionId
  | project AccountUpn,NetworkMessageId,InternetMessageId,ActionType,ThreatTypes,DetectionMethods,SessionId,ReportId=ActionReportId,Timestamp=ActionTimestamp
version: 1.0.0

Required Data Sources

Sentinel TableNotes
CloudAppEventsEnsure this data connector is enabled

MITRE ATT&CK Context

References

False Positive Guidance

Original source: https://github.com/Azure/Azure-Sentinel/blob/main/Hunting Queries/Microsoft 365 Defender/Email and Collaboration Queries/Malware/Email containing malware accessed on a unmanaged device.yaml