← Back to SOC feed Coverage →

Malware Detections by Threat Classification

kql MEDIUM Azure-Sentinel
T1566
EmailEvents
backdoorhuntingmicrosoftofficialransomware
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-09-03T11:00:00Z · Confidence: medium

Hunt Hypothesis

This hypothesis targets adversaries leveraging phishing campaigns to deliver malware payloads, such as ransomware or remote access trojans, via inbound email attachments or links. Proactively hunting for these detections allows the SOC to identify compromised endpoints and emerging threat trends early, enabling rapid containment before lateral movement or data exfiltration occurs within the Azure environment.

KQL Query

EmailEvents
| where Timestamp > ago(30d)
| where OrgLevelPolicy != "Phishing simulation" and OrgLevelPolicy != "SecOps Mailbox"
| extend Key = strcat(NetworkMessageId, "-", RecipientEmailAddress)
| summarize arg_max(Timestamp, *) by Key
| where ThreatTypes has "Malware" and ThreatClassification has_any("Adware","Downloader","HackTool","Ransomware","Remote access trojan","Spyware")
| summarize Count = count() by ThreatClassification
| sort by Count desc
| render piechart

Analytic Rule Definition

id: c4776c7c-a8f4-4643-82db-134b771584b6
name: Malware Detections by Threat Classification
description: |
  This query summarises inbound email malware detections grouped by the malware threat classification (for example Adware, Downloader, HackTool, Ransomware, Remote access trojan, Spyware).
description-detailed: |
  This query summarises inbound email malware detections in Microsoft Defender for Office 365 grouped by the malware threat classification (for example Adware, Downloader, HackTool, Ransomware, Remote access trojan, Spyware).
  Messages are de-duplicated to the latest record per NetworkMessageId and recipient, and deliveries to the SecOps mailbox and by the phishing simulation system are excluded.
requiredDataConnectors:
- connectorId: MicrosoftThreatProtection
  dataTypes:
  - EmailEvents
tactics:
  - InitialAccess
relevantTechniques:
  - T1566
query: |
  EmailEvents
  | where Timestamp > ago(30d)
  | where OrgLevelPolicy != "Phishing simulation" and OrgLevelPolicy != "SecOps Mailbox"
  | extend Key = strcat(NetworkMessageId, "-", RecipientEmailAddress)
  | summarize arg_max(Timestamp, *) by Key
  | where ThreatTypes has "Malware" and ThreatClassification has_any("Adware","Downloader","HackTool","Ransomware","Remote access trojan","Spyware")
  | summarize Count = count() by ThreatClassification
  | sort by Count desc
  | render piechart
version: 1.0.0

Required Data Sources

Sentinel TableNotes
EmailEventsEnsure 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/Malware Detections by Threat Classification.yaml