← Back to SOC feed Coverage →

logon-attempts-after-malicious-email

kql MEDIUM Azure-Sentinel
EmailEventsIdentityLogonEvents
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-07T23:00:00Z · Confidence: medium

Hunt Hypothesis

Adversaries may be attempting to compromise user accounts by logging on shortly after receiving malicious emails to exfiltrate data or establish persistence. SOC teams should proactively hunt for this behavior in Azure Sentinel to identify potential credential theft or lateral movement tactics early.

KQL Query

//Find logons that occurred right after malicious email was received
let MaliciousEmail=EmailEvents
| where ThreatTypes has_cs "Malware" 
| project TimeEmail = Timestamp, Subject, SenderFromAddress, AccountName = tostring(split(RecipientEmailAddress, "@")[0]);
MaliciousEmail
| join (
IdentityLogonEvents
| project LogonTime = Timestamp, AccountName, DeviceName
) on AccountName 
| where (LogonTime - TimeEmail) between (0min.. 30min)
| take 10

Analytic Rule Definition

id: 44a5c680-d2ac-4bed-8210-c3aafea47308
name: logon-attempts-after-malicious-email
description: |
  This query finds the 10 latest logons performed by email recipients within 30 minutes after they received known malicious emails. You can use this query to check whether the accounts of the email recipients have been compromised.
requiredDataConnectors:
- connectorId: MicrosoftThreatProtection
  dataTypes:
  - EmailEvents
  - IdentityLogonEvents
tactics:
- Credential Access
query: |
  //Find logons that occurred right after malicious email was received
  let MaliciousEmail=EmailEvents
  | where ThreatTypes has_cs "Malware" 
  | project TimeEmail = Timestamp, Subject, SenderFromAddress, AccountName = tostring(split(RecipientEmailAddress, "@")[0]);
  MaliciousEmail
  | join (
  IdentityLogonEvents
  | project LogonTime = Timestamp, AccountName, DeviceName
  ) on AccountName 
  | where (LogonTime - TimeEmail) between (0min.. 30min)
  | take 10

Required Data Sources

Sentinel TableNotes
EmailEventsEnsure this data connector is enabled
IdentityLogonEventsEnsure 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/Credential Access/logon-attempts-after-malicious-email.yaml