← Back to SOC feed Coverage →

Mailflow by directionality

kql MEDIUM Azure-Sentinel
T1566
EmailEvents
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-10T23:00:00Z · Confidence: medium

Hunt Hypothesis

Adversaries may use domain-based email directionality to exfiltrate data or establish command and control channels by leveraging compromised email accounts. SOC teams should proactively hunt for this behavior in Azure Sentinel to identify potential lateral movement or data exfiltration attempts hidden within email traffic.

KQL Query

EmailEvents 
| where Timestamp > ago(30d)
| extend domain = substring(RecipientEmailAddress, indexof(RecipientEmailAddress, "@")+1) 
| summarize total=count() by EmailDirection, domain, bin(Timestamp, 1d) 
| order by Timestamp asc

Analytic Rule Definition

id: 6b478186-da3b-4d71-beaa-aa5b42908499
name: Mailflow by directionality
description: |
  This query helps reviewing inbound / outbound / intra-org emails by domain per day
description-detailed: |
  This query helps reviewing inbound / outbound / intra-org emails by domain per day
requiredDataConnectors:
  - connectorId: MicrosoftThreatProtection
    dataTypes:
      - EmailEvents
tactics:
  - InitialAccess
relevantTechniques:
  - T1566
query: |
  EmailEvents 
  | where Timestamp > ago(30d)
  | extend domain = substring(RecipientEmailAddress, indexof(RecipientEmailAddress, "@")+1) 
  | summarize total=count() by EmailDirection, domain, bin(Timestamp, 1d) 
  | order by Timestamp asc
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/Mailflow/Mailflow by directionality.yaml