← Back to SOC feed Coverage →

Automated Remediation Delivery to Action Latency

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-09-03T23:00:00Z · Confidence: medium

Hunt Hypothesis

This hypothesis targets potential delays in Microsoft Defender for Office 365’s automated remediation of phishing messages, which could allow malicious emails to remain in user inboxes longer than intended and increase the likelihood of successful exploitation. Proactively hunting for elevated action latency helps the SOC identify configuration gaps or performance bottlenecks that adversaries might leverage to bypass automated defenses and achieve initial access via Spearphishing Attachment or Link.

KQL Query

let deliveries = EmailEvents
  | where Timestamp > ago(30d)
  | where DeliveryAction == "Delivered"
  | extend MsgKey = strcat(NetworkMessageId, "-", RecipientEmailAddress)
  | summarize FirstDelivery = min(Timestamp) by MsgKey, Threat = tostring(ThreatTypes);
let remediations = EmailPostDeliveryEvents
  | where Timestamp > ago(30d)
  | where ActionType == "Automated Remediation"
  | extend MsgKey = strcat(NetworkMessageId, "-", RecipientEmailAddress)
  | summarize FirstRemediation = min(Timestamp) by MsgKey;
deliveries
| join kind=inner remediations on MsgKey
| extend DelayMinutes = datetime_diff("minute", FirstRemediation, FirstDelivery)
| where DelayMinutes >= 0
| summarize ['Avg (min)'] = avg(DelayMinutes), ['P80 (min)'] = percentile(DelayMinutes, 80), ['P90 (min)'] = percentile(DelayMinutes, 90), ['P99 (min)'] = percentile(DelayMinutes, 99), CountEmails = count() by bin(FirstRemediation, 1d)
| render timechart

Analytic Rule Definition

id: 094266b5-c2ef-4818-8558-cfacdb267d23
name: Automated Remediation Delivery to Action Latency
description: |
  This query measures how long after delivery Microsoft Defender for Office 365 automated remediation acts on a message, reported as daily average and percentiles, using the EmailEvents and EmailPostDeliveryEvents tables.
description-detailed: |
  The delay between a threat email being delivered and automated remediation removing it is a key Security Operations metric. This query joins delivered emails to their automated remediation events and reports the daily average, P80, P90 and P99 delay in minutes, so SOC teams can track and improve time-to-remediation.
  Query is also included as part of the Defender for Office 365 solution in Sentinel: https://techcommunity.microsoft.com/blog/microsoftdefenderforoffice365blog/part-2-build-custom-email-security-reports-and-dashboards-with-workbooks-in-micr/4411303
requiredDataConnectors:
- connectorId: MicrosoftThreatProtection
  dataTypes:
  - EmailEvents
  - EmailPostDeliveryEvents
tactics:
  - InitialAccess
relevantTechniques:
  - T1566
query: |
  let deliveries = EmailEvents
    | where Timestamp > ago(30d)
    | where DeliveryAction == "Delivered"
    | extend MsgKey = strcat(NetworkMessageId, "-", RecipientEmailAddress)
    | summarize FirstDelivery = min(Timestamp) by MsgKey, Threat = tostring(ThreatTypes);
  let remediations = EmailPostDeliveryEvents
    | where Timestamp > ago(30d)
    | where ActionType == "Automated Remediation"
    | extend MsgKey = strcat(NetworkMessageId, "-", RecipientEmailAddress)
    | summarize FirstRemediation = min(Timestamp) by MsgKey;
  deliveries
  | join kind=inner remediations on MsgKey
  | extend DelayMinutes = datetime_diff("minute", FirstRemediation, FirstDelivery)
  | where DelayMinutes >= 0
  | summarize ['Avg (min)'] = avg(DelayMinutes), ['P80 (min)'] = percentile(DelayMinutes, 80), ['P90 (min)'] = percentile(DelayMinutes, 90), ['P99 (min)'] = percentile(DelayMinutes, 99), CountEmails = count() by bin(FirstRemediation, 1d)
  | render timechart
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/Remediation/Automated Remediation Delivery to Action Latency.yaml