Free Reference

M365 and Entra ID Detection Reference

KQL that detects 30 Microsoft 365 and Entra ID attack techniques, from a phished session to a mailbox forwarding rule, with the log each reads and the false positives to expect, plus 4 correlations that join them.

What this is

Microsoft 365 and Entra ID are attacked through their own features: a phished session, a consented application, an inbox rule, an authenticator registered by the wrong person. Each leaves a record in a log you already collect. This reference gives a detection for each of 30 techniques and 4 correlations that join them, the table each reads, and what will fool it.

Every query here ran on practice data without error, and every column it names is in Microsoft's schema for its table. Practice data does not hold every attack, so some return nothing there. Thresholds and baseline windows are starting points for your own tenant.

The reference, in four parts

This hub pulls together four detailed references into one working order. Read them as a sequence: understand the attack surface, hunt for activity, write the detection, engineer it as a repeatable discipline.

Coverage map

Each card links to its detection below. Only techniques this page has a query for are on the map.

Initial access
Credential access
Persistence and privilege
Collection and exfiltration
Evasion and discovery
Impact and fraud
Correlation detections

Initial access

The intrusion starts with a message or a credential. These detections read delivered mail and the sign-ins of the applications that hold credentials of their own.

T1566.001The delivered lure
ATT&CK T1566.001 Spearphishing Attachment; T1566.002 Spearphishing Link
Source: EmailEvents (Defender XDR)

Most first messages in a mail intrusion come from a sender domain the organization has never received mail from. The rule lists delivered mail from domains first seen in the detection window. Keep links out of the condition: a lure can carry an attachment, a QR code, or only text that asks for a reply.

let baseline = EmailEvents | where Timestamp between (ago(30d) .. ago(21d)) | where EmailDirection == "Inbound" | distinct SenderFromDomain; EmailEvents | where Timestamp > ago(21d) | where EmailDirection == "Inbound" and DeliveryAction == "Delivered" | join kind=leftanti baseline on SenderFromDomain | summarize Emails = count(), Recipients = make_set(RecipientEmailAddress), First = min(Timestamp) by SenderFromDomain
What fools it: new suppliers and newsletters appear every week. Rank what the rule returns by DMARC result and by lookalikes of your own domain to decide what to read first.
T1078.004A service principal signing in from a new address
ATT&CK T1078.004 Cloud Accounts
Source: AADServicePrincipalSignInLogs

Applications sign in as service principals from a small, stable set of addresses. A sign-in from an address the principal has never used is the first sign that its credential is in someone else's hands.

let baseline = AADServicePrincipalSignInLogs | where TimeGenerated between (ago(30d) .. ago(21d)) | distinct ServicePrincipalName, IPAddress; AADServicePrincipalSignInLogs | where TimeGenerated > ago(21d) | join kind=leftanti baseline on ServicePrincipalName, IPAddress | summarize SignIns = count(), First = min(TimeGenerated) by ServicePrincipalName, IPAddress | sort by First asc
What fools it: vendor applications move between cloud regions and change address, so check who owns a new address before treating it as hostile.

Credential access

In a cloud-first tenant the attacker wants a valid session: a phished cookie, a sprayed password, an approved prompt, a consented application, or a forged token.

Schema note. In Defender XDR advanced hunting, EntraIdSignInEvents replaced AADSignInEventsBeta on October 19, 2026, and Microsoft migrated queries on the old table automatically. Defender XDR tables (CloudAppEvents, EmailEvents, UrlClickEvents, EntraIdSignInEvents) filter on Timestamp; the Sentinel tables filter on TimeGenerated.
T1557Adversary-in-the-middle phishing
ATT&CK T1557 Adversary-in-the-Middle; T1539 Steal Web Session Cookie
Source: SigninLogs

An adversary-in-the-middle page relays the real sign-in, MFA included, and keeps the session cookie it gets back. The attacker never needs the password or the second factor again. Entra ID Protection marks many of these sign-ins with risk detections of their own; hunt for them directly rather than waiting for an alert.

SigninLogs | where TimeGenerated > ago(30d) | where RiskLevelDuringSignIn in ("high", "medium") or RiskEventTypes_V2 has_any ("adversaryInTheMiddle", "anomalousToken", "tokenIssuerAnomaly") | project TimeGenerated, UserPrincipalName, IPAddress, AppDisplayName, RiskLevelDuringSignIn, RiskEventTypes_V2, ConditionalAccessStatus | sort by TimeGenerated desc
What fools it: VPN egress, corporate proxies and travel produce medium-risk sign-ins. Risk alone is a hunt lead; the phishing click to risky sign-in correlation below is the alert.
T1550.004A stolen session replayed
ATT&CK T1550.004 Web Session Cookie
Source: AADNonInteractiveUserSignInLogs, SigninLogs

The replayed cookie shows mostly as token use in the non-interactive sign-in log, from an address the user never signs in from interactively. The rule compares the two logs per user and address.

let usual = SigninLogs | where TimeGenerated > ago(30d) and ResultType == 0 | summarize SignIns = count() by UserPrincipalName, IPAddress | where SignIns >= 5; AADNonInteractiveUserSignInLogs | where TimeGenerated > ago(14d) and ResultType == 0 | where UserPrincipalName !contains "#EXT#" | join kind=leftanti usual on UserPrincipalName, IPAddress | summarize Tokens = count(), First = min(TimeGenerated), Last = max(TimeGenerated) by UserPrincipalName, IPAddress | sort by First asc
What fools it: guest accounts (their UPN contains #EXT#) authenticate at their home tenant, so their tokens look new in yours; the query drops them. Users roaming between mobile carriers produce new addresses too. Contain a confirmed replay by revoking the user's sessions, then reset the password.
T1110.003Password spray, and the success that follows
ATT&CK T1110.003 Password Spraying
Source: SigninLogs

A spray tries one or two common passwords against many accounts from one address, so each account sees too few failures to trip a per-account rule. Count distinct accounts failing with error 50126 (invalid username or password) per address and hour, and alert on what matters: a success from an address that was spraying. A spray spread over many addresses passes under any per-address count; group by application instead to hunt it.

let spraying = SigninLogs | where TimeGenerated > ago(30d) and ResultType == 50126 | summarize Accounts = dcount(UserPrincipalName) by IPAddress, Hour = bin(TimeGenerated, 1h) | where Accounts >= 5; SigninLogs | where TimeGenerated > ago(30d) and ResultType == 0 | join kind=inner spraying on IPAddress | where TimeGenerated between (Hour .. (Hour + 3h)) | project TimeGenerated, UserPrincipalName, IPAddress, Accounts, AuthenticationRequirement
What fools it: corporate egress and VPN concentrators put many users behind one address. Measure the busiest hour your own egress produces before setting the account threshold. Credential stuffing (T1110.004) shows the same fan-out with many distinct passwords from breach lists.
T1621MFA fatigue
ATT&CK T1621 Multi-Factor Authentication Request Generation
Source: SigninLogs

An attacker who already has the password sends MFA prompts until the user approves one. The prompts appear as error 500121 (strong authentication failed) and 50074 (strong authentication required); the approval is a success from the same address minutes later. The rule looks for both.

let prompted = SigninLogs | where TimeGenerated > ago(30d) | where ResultType in (500121, 50074) | summarize Prompts = count(), LastPrompt = max(TimeGenerated) by UserPrincipalName, IPAddress, bin(TimeGenerated, 10m) | where Prompts >= 5; SigninLogs | where TimeGenerated > ago(30d) and ResultType == 0 | join kind=inner prompted on UserPrincipalName, IPAddress | where TimeGenerated between (LastPrompt .. (LastPrompt + 30m)) | project TimeGenerated, UserPrincipalName, IPAddress, Prompts
What fools it: a user with a broken authenticator or a stale device can produce repeated prompts on their own. The success from the same address after the burst separates the attack. Number matching in Microsoft Authenticator stops most of this at the source.
T1606.002Forged SAML tokens (Golden SAML)
ATT&CK T1606.002 SAML Tokens
Source: SecurityEvent (AD FS auditing)

An attacker who extracts the AD FS token-signing certificate can forge SAML tokens for any user with any claims, and those tokens are valid. There is no single signature for it. On the AD FS side, watch token issuance for volume from accounts that do not normally request tokens.

SecurityEvent | where TimeGenerated > ago(30d) | where EventSourceName == "AD FS Auditing" // 1200 to 1202: AD FS token and credential validation audits | where EventID in (1200, 1201, 1202) | summarize Tokens = count() by Account, Computer, bin(TimeGenerated, 1h) | where Tokens > 50 | sort by Tokens desc

On the cloud side the forged sign-ins arrive at Entra ID as federated sign-ins. A federated sign-in from an unusual address or user agent for a privileged account, or a token asserting a role the account does not hold, is the second pattern to hunt. The DKM read below is the theft itself.

What fools it: busy relying-party applications and service accounts request tokens at volume every day. Baseline the hourly count per account first; AD FS auditing must be enabled on the farm for these events to exist.
T1649Reading the AD FS key container
ATT&CK T1649 Steal or Forge Authentication Certificates
Source: SecurityEvent

AD FS encrypts its token-signing certificate with a key stored in Active Directory (the DKM container). Reading that container is how the certificate is stolen. With auditing on the container, event 4662 records who read it.

SecurityEvent | where TimeGenerated > ago(30d) | where EventID == 4662 // an operation on an AD object | where ObjectName has "CN=ADFS" or Properties has "DKM" | where AccountType == "User" | project TimeGenerated, Account, ObjectName, AccessMask | sort by TimeGenerated desc
What fools it: the AD FS service account reads the key at service start. Exclude it and look at any other principal reading the container.

Persistence and privilege

Once in, the attacker makes the access survive a password reset: a method, a device, a credential on an application, a weakened policy, a federated domain, a role. Most of these are routine administrative events, which is why they hide; the detections separate the attacker's version.

T1556.006An authentication method registered in a suspect session
ATT&CK T1556.006 Multi-Factor Authentication
Source: AuditLogs, SigninLogs

With a session in hand, an attacker registers an authenticator of their own so they can pass MFA later without the victim. Registration alone is ordinary onboarding. The rule lists each registration with the addresses the account signed in from in the hour before it, so a registration made from the attacker's address stands out.

AuditLogs | where TimeGenerated > ago(30d) | where OperationName == "User registered security info" | extend Account = tostring(parse_json(TargetResources)[0].userPrincipalName) | project Registered = TimeGenerated, Account | join kind=inner (SigninLogs | where TimeGenerated > ago(30d) and ResultType == 0 | project SignIn = TimeGenerated, Account = UserPrincipalName, IPAddress) on Account | where SignIn between ((Registered - 1h) .. Registered) | summarize Addresses = make_set(IPAddress) by Account, Registered
What fools it: new starters and phone replacements register methods every week. Compare the addresses with your own egress, or with the replay and prompt detections above, before alerting.
T1098.005A device registered to satisfy Conditional Access
ATT&CK T1098.005 Device Registration
Source: AuditLogs, SigninLogs

Conditional Access that requires a registered or compliant device is only as strong as device registration. An attacker who registers a device of their own turns the control into one they pass. Registration alone is onboarding; the pattern is a sign-in from an unmanaged platform followed within hours by a new device for the same user.

let newDevices = AuditLogs | where TimeGenerated > ago(30d) | where OperationName in ("Add device", "Add registered owner to device") | extend Actor = tostring(parse_json(InitiatedBy).user.userPrincipalName) | where isnotempty(Actor) | project DeviceTime = TimeGenerated, Actor, DeviceName = tostring(parse_json(TargetResources)[0].displayName); SigninLogs | where TimeGenerated > ago(30d) and ResultType == 0 | extend DeviceOS = tostring(DeviceDetail.operatingSystem), Managed = tostring(DeviceDetail.isManaged) | where Managed != "true" | project SignInTime = TimeGenerated, Actor = UserPrincipalName, DeviceOS, IPAddress | join kind=inner newDevices on Actor | where DeviceTime between (SignInTime .. (SignInTime + 2h)) | project SignInTime, DeviceTime, Actor, DeviceOS, DeviceName, IPAddress
What fools it: enrollment and BYOD registration happen every day, often from an unmanaged device by design. Exclude your enrollment accounts and compare the address with the user's usual ones.
T1098.001A credential added to an application
ATT&CK T1098.001 Additional Cloud Credentials
Source: AuditLogs

An application or service principal holds its own credentials. An attacker who adds a secret or certificate to one gets a way back in that authenticates as the application, with every permission it was granted, and survives any user password reset. It is a single audit event, and the actor is what matters: an account that has never managed applications adding a credential.

let admin_ops = dynamic(["Add service principal credentials", "Update application – Certificates and secrets management"]); let known = AuditLogs | where TimeGenerated between (ago(60d) .. ago(14d)) | where OperationName in (admin_ops) | extend Actor = tostring(parse_json(InitiatedBy).user.userPrincipalName) | distinct Actor; AuditLogs | where TimeGenerated > ago(14d) | where OperationName in (admin_ops) | extend Actor = tostring(parse_json(InitiatedBy).user.userPrincipalName), App = tostring(parse_json(TargetResources)[0].displayName) | where Actor !in (known) | project TimeGenerated, Actor, OperationName, App
What fools it: developers and pipelines rotate secrets. Rotation by automation appears once as a new actor; add it to the baseline. A credential on an application that holds Graph application permissions is the one to read first.
T1556.009Conditional Access changed by an unexpected actor
ATT&CK T1556.009 Conditional Access Policies
Source: AuditLogs

An attacker with a privileged account does not bypass Conditional Access, they edit it: a policy disabled, switched to report-only, or given an exclusion. The change is logged with its old and new values, and the highest-fidelity version flags a change made by someone who does not normally touch policy.

let known = AuditLogs | where TimeGenerated between (ago(60d) .. ago(14d)) | where OperationName has "conditional access policy" | extend Actor = tostring(parse_json(InitiatedBy).user.userPrincipalName) | distinct Actor; AuditLogs | where TimeGenerated > ago(14d) | where OperationName in~ ("Add conditional access policy", "Update conditional access policy", "Delete conditional access policy") | extend Actor = tostring(parse_json(InitiatedBy).user.userPrincipalName), Target = parse_json(TargetResources)[0] | where Actor !in (known) | project TimeGenerated, Actor, OperationName, Policy = tostring(Target.displayName), NewValue = tostring(Target.modifiedProperties[0].newValue)
What fools it: a new identity administrator fires this the first time they edit policy. Policy changes are rare and high impact enough that reviewing every new actor is a defensible cost.
T1556.007A domain federated to another identity provider
ATT&CK T1556.007 Hybrid Identity; T1484.002 Trust Modification
Source: AuditLogs

An attacker who can configure domain authentication federates a domain to an identity provider they control and can then issue valid tokens for any user in it. The steps are audit events, and in order they read as the backdoor being built: an unverified domain added, verified, then set to federated.

AuditLogs | where TimeGenerated > ago(30d) | where OperationName in ("Set domain authentication", "Set federation settings on domain", "Add unverified domain", "Verify domain") | extend Actor = tostring(parse_json(InitiatedBy).user.userPrincipalName), ActorIP = tostring(parse_json(InitiatedBy).user.ipAddress), Domain = tostring(parse_json(TargetResources)[0].displayName) | project TimeGenerated, OperationName, Domain, Actor, ActorIP, Result | sort by Domain asc, TimeGenerated asc

The federation settings themselves are not in the event. Read them with Get-MgDomainFederationConfiguration and check the issuer URI and signing certificate.

What fools it: federation changes happen in identity migrations and acquisitions, and they are planned. Any domain authentication change should match a change record.
T1098.003A privileged directory role granted
ATT&CK T1098.003 Additional Cloud Roles
Source: AuditLogs

The clearest escalation in Entra ID is a member added to a tier-zero role: Global Administrator, Privileged Role Administrator, Application Administrator, Privileged Authentication Administrator. The role name is a modified property of the event; read it by name, because its position in the list is not fixed.

AuditLogs | where TimeGenerated > ago(30d) | where OperationName in ("Add member to role", "Add eligible member to role") | extend Target = parse_json(TargetResources)[0], Actor = tostring(parse_json(InitiatedBy).user.userPrincipalName) | mv-expand Prop = Target.modifiedProperties | where tostring(Prop.displayName) == "Role.DisplayName" | extend Role = tostring(Prop.newValue) | where Role has_any ("Global Administrator", "Privileged Role Administrator", "Application Administrator", "Privileged Authentication Administrator") | project TimeGenerated, Actor, OperationName, Role, Member = tostring(Target.userPrincipalName)
What fools it: onboarding and PIM produce these. Where PIM is in use, a permanent assignment made outside it is the stronger signal than an eligible one.

Collection and exfiltration

Read the mail, take the files, move the data out. Mailbox and SharePoint auditing must be on in Microsoft Purview for most of these events to exist; confirm that before trusting an empty result.

T1114.003Mail forwarded outside the organization
ATT&CK T1114.003 Email Forwarding Rule
Source: CloudAppEvents (Defender XDR)

An attacker in a mailbox forwards its mail to an outside address and keeps reading it without signing in again. Forwarding can be set by an inbox rule or on the mailbox itself with Set-Mailbox, so watch both. Exclude your own domains so only external forwarding surfaces.

CloudAppEvents | where Timestamp > ago(30d) | where Application == "Microsoft Exchange Online" | where ActionType in ("New-InboxRule", "Set-InboxRule", "Set-Mailbox", "UpdateInboxRules") | extend Raw = tostring(RawEventData) | where Raw has_any ("ForwardTo", "ForwardAsAttachmentTo", "RedirectTo", "ForwardingSmtpAddress", "DeliverToMailboxAndForward") | where Raw !has "yourdomain.com" // set to your own domains | project Timestamp, AccountDisplayName, AccountObjectId, ActionType, IPAddress, CountryCode, Isp, Raw

Rank what remains by whether the internet provider or country the rule came from is one the user has used before. A rule created from a provider new to the user is the high-confidence case.

What fools it: users forward to personal accounts and set up delegate flows. The built-in alert fires on every rule. Filter to external targets, and read first any rule that also hides mail.
T1564.008Rules that hide mail
ATT&CK T1564.008 Email Hiding Rules
Source: CloudAppEvents (Defender XDR)

Some malicious rules exist to hide mail rather than forward it: replies to the attacker, security notices and bounces are moved to a folder nobody reads, such as RSS Feeds or Conversation History, marked read, or deleted.

CloudAppEvents | where Timestamp > ago(30d) | where Application == "Microsoft Exchange Online" | where ActionType in ("New-InboxRule", "Set-InboxRule") | extend Raw = tostring(RawEventData) | where Raw has "DeleteMessage" or (Raw has_any ("MoveToFolder", "MarkAsRead") and Raw has_any ("RSS", "Conversation History", "Archive")) | project Timestamp, AccountDisplayName, IPAddress, ActionType, Raw
What fools it: users file newsletters into folders. A rule that deletes, or that matches on words such as invoice, payment or security, created from an unusual session, is the pattern.
T1098.002Mailbox access granted to another account
ATT&CK T1098.002 Additional Email Delegate Permissions
Source: CloudAppEvents (Defender XDR)

Instead of forwarding, the attacker grants an account they control full access or send-as rights on the victim's mailbox and reads it directly. No mail leaves the tenant, and the grant is an Exchange permission change.

CloudAppEvents | where Timestamp > ago(30d) | where Application == "Microsoft Exchange Online" | where ActionType in ("Add-MailboxPermission", "Add-RecipientPermission", "Add-MailboxFolderPermission") | extend Raw = tostring(RawEventData) | where Raw has_any ("FullAccess", "SendAs", "SendOnBehalf", "Owner") | project Timestamp, Actor = AccountDisplayName, ActionType, IPAddress, Raw
What fools it: shared mailboxes, assistants and migration tools receive these grants. Baseline the legitimate delegations; a grant soon after a risky sign-in for the mailbox owner is the one to read.
T1114.002Mailbox reads from a new address
ATT&CK T1114.002 Remote Email Collection
Source: OfficeActivity

MailItemsAccessed records mail being read, with the client address. Reads from an address the user has never read from are the signal. Build the baseline from a window that ends before the activity you are hunting, or the attacker's own reads become part of what is usual.

let baseline = OfficeActivity | where TimeGenerated between (ago(30d) .. ago(21d)) | where Operation == "MailItemsAccessed" | distinct UserId, ClientIP; OfficeActivity | where TimeGenerated > ago(21d) and Operation == "MailItemsAccessed" | join kind=leftanti baseline on UserId, ClientIP | summarize Reads = count(), First = min(TimeGenerated), Last = max(TimeGenerated) by UserId, ClientIP | sort by First asc
What fools it: new devices, travel and carrier changes produce new addresses. MailItemsAccessed must be audited for the mailbox; confirm it is before reading an empty result as clean.
T1213.002Bulk downloads from SharePoint and OneDrive
ATT&CK T1213.002 Sharepoint; T1530 Data from Cloud Storage
Source: CloudAppEvents (Defender XDR)

Collection from SharePoint and OneDrive is a burst: many files in an hour, where a person downloads a handful. The rule counts distinct files per account, address and hour.

let threshold = 50; CloudAppEvents | where Timestamp > ago(30d) | where ActionType in ("FileDownloaded", "FileSyncDownloadedFull") | where Application in ("Microsoft SharePoint Online", "Microsoft OneDrive for Business") | summarize Files = dcount(ObjectName), Sample = make_set(ObjectName, 15) by AccountDisplayName, IPAddress, bin(Timestamp, 1h) | where Files > threshold | sort by Files desc
What fools it: sync clients, backup and a departing employee archiving their files all download in bulk. Start the threshold high and lower it; a burst from an unfamiliar address, or of files named for payroll or credentials, comes first.
T1213.005Teams messages read at volume
ATT&CK T1213.005 Messaging Applications
Source: CloudAppEvents (Defender XDR)

Teams holds as much as the mailbox, and a stolen token reads it through Microsoft Graph. Message reads at a rate no person scrolls, through an application the user does not normally use, are the fingerprint of a script.

CloudAppEvents | where Timestamp > ago(30d) | where ActionType == "MessagesListed" | summarize Reads = count() by AccountDisplayName, OAuthAppId, bin(Timestamp, 1h) | where Reads > 50 | sort by Reads desc
What fools it: compliance and backup tools read Teams at volume through known applications. Baseline their application IDs and alert on any other.
T1550.001Application-only Graph calls from outside your estate
ATT&CK T1550.001 Application Access Token
Source: MicrosoftGraphActivityLogs, IdentityInfo

An application using its own credentials calls Microsoft Graph with no signed-in user, so the record carries no UserId. MicrosoftGraphActivityLogs records each call with the client address, the URI and the response size. App-only calls from outside your own address ranges, joined to IdentityInfo to name the mailboxes touched, show which applications read what.

// Replace 203.0.113. (a documentation range) with your own egress MicrosoftGraphActivityLogs | where TimeGenerated > ago(30d) | where isempty(UserId) and not(IPAddress startswith "203.0.113.") | extend Target = extract(@"/users/([0-9a-f-]{36})/", 1, RequestUri) | join kind=leftouter (IdentityInfo | summarize by Target = AccountObjectId, Mailbox = AccountUPN) on Target | summarize Calls = count(), Mailboxes = dcount(Mailbox), KB = round(sum(ResponseSizeBytes) / 1024.0, 0) by AppId, IPAddress
What fools it: SaaS vendors call Graph from their own clouds. Record each application's expected addresses from its publisher and exclude them by AppId and address together.
T1567.004A flow that ships data out
ATT&CK T1567.004 Exfiltration Over Webhook
Source: CloudAppEvents (Defender XDR)

Rather than download files, an attacker builds a Power Automate flow that copies mail or files to an outside endpoint on every new item. Nothing interactive happens after it is created. Power Automate audits flow creation and edits with the connectors the flow uses.

CloudAppEvents | where Timestamp > ago(30d) | where Application == "Microsoft Power Automate" | where ActionType contains "flow" | extend Connectors = tostring(RawEventData.FlowConnectorNames) | project Timestamp, AccountDisplayName, ActionType, Connectors, IPAddress | sort by Timestamp desc
What fools it: flows are common in most tenants. A flow created soon after a risky sign-in, by a user who does not automate, that uses an HTTP or consumer storage connector, is the one to read.

Evasion and discovery

An attacker who blinds the audit log blinds every other detection here, so treat tampering with it as the highest priority on the page. Discovery is quieter and earlier.

T1685.002The unified audit log turned off
ATT&CK T1685.002 Disable or Modify Cloud Log
Source: OfficeActivity

The Microsoft 365 unified audit log is behind most of the detections on this page. An account holding the Audit Logs role in Exchange Online can turn it off with one command, and the change is itself audited. If you see it and did not authorize it, assume compromise.

OfficeActivity | where TimeGenerated > ago(30d) | where Operation == "Set-AdminAuditLogConfig" | extend Params = tostring(Parameters) | where Params has "UnifiedAuditLogIngestionEnabled" and Params has "False" | project TimeGenerated, UserId, ClientIP, Operation, Params | sort by TimeGenerated desc
What fools it: almost nothing. Turning off the audit log should always map to a change record. Alert at high severity, and export the history you still have before investigating.
T1070.008Mail deleted to cover the intrusion
ATT&CK T1070.008 Clear Mailbox Data
Source: CloudAppEvents (Defender XDR)

After sending an internal phish or a payment request from the mailbox, the attacker deletes it: hard deletes in Sent Items, a purge of Deleted Items. Exchange audits each delete.

CloudAppEvents | where Timestamp > ago(30d) | where Application == "Microsoft Exchange Online" | where ActionType in ("HardDelete", "SoftDelete", "MoveToDeletedItems") | summarize Deletes = count() by AccountDisplayName, ActionType, bin(Timestamp, 1h) | where Deletes > 20 | sort by Deletes desc
What fools it: people delete mail all day, so volume alone means nothing. A burst of hard deletes soon after the account sent mail it does not usually send is the pattern.
T1087.004The directory enumerated
ATT&CK T1087.004 Cloud Account
Source: MicrosoftGraphActivityLogs

With access in hand, an attacker lists users, groups, roles and applications to find the next target. Through Microsoft Graph that is a run of read requests against the directory endpoints, far more than a person makes.

MicrosoftGraphActivityLogs | where TimeGenerated > ago(30d) and RequestMethod == "GET" | where RequestUri matches regex @"/(v1\.0|beta)/(users|groups|directoryRoles|servicePrincipals)" | summarize Requests = count(), Endpoints = dcount(RequestUri) by UserId, AppId, IPAddress, bin(TimeGenerated, 1h) | where Requests > 100 | sort by Requests desc
What fools it: admin portals, reporting and identity governance tools read the directory at volume. Baseline them by AppId; a user doing it for the first time, from a new address, is the lead.

Impact and fraud

For many intrusions this is the objective: use the mailbox to move money or reach more people, and slow the response while doing it.

T1534The compromised account phishes its colleagues
ATT&CK T1534 Internal Spearphishing
Source: EmailEvents (Defender XDR)

Once inside a mailbox, the attacker phishes other employees from it. The mail comes from a trusted internal sender, so it carries a colleague's credibility. Look for internal mail Defender flagged, and for one sender reaching many internal recipients at once.

EmailEvents | where Timestamp > ago(30d) | where EmailDirection == "Intra-org" | where ThreatTypes has_any ("Phish", "Malware") | summarize Recipients = dcount(RecipientEmailAddress), Subjects = make_set(Subject, 10) by SenderFromAddress, bin(Timestamp, 1h) | where Recipients > 5 | sort by Recipients desc
What fools it: internal mass mail from a manager or an all-hands notice reaches many people. Filter on the threat verdict, and read first a sender who does not normally write to many people.
T1657Sending as the victim
ATT&CK T1657 Financial Theft
Source: OfficeActivity

The payoff of most mailbox compromises is a message sent as the victim: a change of bank details to a supplier, or a payment request. Rules on message content fail because the attacker writes the way the victim writes. A send from an address the account has never sent from catches the session instead.

let baseline = OfficeActivity | where TimeGenerated between (ago(30d) .. ago(23d)) | where Operation == "Send" | distinct UserId, ClientIP; OfficeActivity | where TimeGenerated > ago(23d) and Operation == "Send" | join kind=leftanti baseline on UserId, ClientIP | summarize Sends = count(), First = min(TimeGenerated), Last = max(TimeGenerated) by UserId, ClientIP
What fools it: new devices and travel produce new addresses. Exclude your own ranges, then treat what remains as a lead for the other detections on the same account, especially the sign-in to rule correlation.
T1531The legitimate user locked out
ATT&CK T1531 Account Access Removal
Source: AuditLogs

To slow the response, an attacker resets the victim's password, revokes their sessions or disables the account, while keeping a live token of their own. In Entra ID that is an account change made by someone other than the account.

AuditLogs | where TimeGenerated > ago(30d) | where OperationName in ("Reset user password", "Disable account", "Revoke user sessions") | extend Actor = tostring(parse_json(InitiatedBy).user.userPrincipalName), Account = tostring(parse_json(TargetResources)[0].userPrincipalName) | where isnotempty(Actor) and Actor != Account | project TimeGenerated, Actor, Account, OperationName | sort by TimeGenerated desc
What fools it: help desk resets and account management produce these all day. Baseline your account-management identities and read the rest, and any action on a privileged account.
T1137.005Rules that run something
ATT&CK T1137.005 Outlook Rules
Source: CloudAppEvents (Defender XDR)

Outlook rules can start an application or run a script when mail arrives, and they persist in the mailbox through a password reset. The actions are rare in current tenants, so any rule that carries one deserves a look.

CloudAppEvents | where Timestamp > ago(30d) | where Application == "Microsoft Exchange Online" | where ActionType in ("New-InboxRule", "Set-InboxRule", "UpdateInboxRules") | extend Raw = tostring(RawEventData) | where Raw has_any ("StartApplication", "RunScript") | project Timestamp, AccountDisplayName, IPAddress, ActionType, Raw
What fools it: very little: rules that only organize mail never match. A match is worth reading in full.

Correlation detections

Single-technique rules catch single techniques. These join two events from the same account in a short window, and the alerts they produce are close to actionable on arrival.

CHAINPhishing click, then a risky sign-in
ATT&CK T1566.002 Spearphishing Link; T1557 Adversary-in-the-Middle; T1078.004 Cloud Accounts
Source: UrlClickEvents, EntraIdSignInEvents (Defender XDR)

The adversary-in-the-middle chain is a click on a phishing link, then a session from a new place using the stolen cookie. Users click links and travel every day; joined within an hour, the two are the attack.

let window = 1h; let clicks = UrlClickEvents | where Timestamp > ago(30d) | where ThreatTypes has "Phish" or IsClickedThrough == true | project ClickTime = Timestamp, AccountUpn, Url; EntraIdSignInEvents | where Timestamp > ago(30d) | where RiskLevelDuringSignIn >= 50 // 50 medium, 100 high | project SignInTime = Timestamp, AccountUpn, IPAddress, Country, RiskLevelDuringSignIn | join kind=inner clicks on AccountUpn | where SignInTime between (ClickTime .. (ClickTime + window)) | project AccountUpn, ClickTime, Url, SignInTime, IPAddress, Country
Why it beats the parts: a risky sign-in alone drowns in VPN and travel noise, and a click alone says nothing happened yet. Tighten the window to cut coincidence; widen it to your token lifetimes.
CHAINNew-address sign-in, then a hiding or forwarding rule
ATT&CK T1078.004 Cloud Accounts; T1564.008 Email Hiding Rules
Source: SigninLogs, AADNonInteractiveUserSignInLogs, OfficeActivity

Mail compromise has a recognizable staging step: a sign-in from an address the user does not normally use, then within a day a rule that hides or forwards mail on the same account. It fires before the fraudulent message goes out. OfficeActivity records the UPN in UserId, so the join is on the account, not a display name.

let usual = SigninLogs | where TimeGenerated > ago(30d) and ResultType == 0 | summarize SignIns = count() by UserPrincipalName, IPAddress | where SignIns >= 5; let new_address = union SigninLogs, AADNonInteractiveUserSignInLogs | where TimeGenerated > ago(30d) and ResultType == 0 | join kind=leftanti usual on UserPrincipalName, IPAddress | summarize SignIn = min(TimeGenerated) by UserPrincipalName, IPAddress; OfficeActivity | where TimeGenerated > ago(30d) | where Operation in ("New-InboxRule", "Set-InboxRule", "Set-Mailbox") | extend Params = tostring(Parameters) | where Params has_any ("RSS", "Conversation History", "DeleteMessage", "ForwardTo", "RedirectTo", "ForwardingSmtpAddress") | project RuleTime = TimeGenerated, UserPrincipalName = UserId, Operation, RuleIP = ClientIP | join kind=inner new_address on UserPrincipalName | where RuleTime between (SignIn .. (SignIn + 24h)) | project UserPrincipalName, IPAddress, SignIn, RuleTime, RuleIP, Operation
Why it beats the parts: inbox-rule alerts are noisy because people make rules. Gating the rule on a new-address sign-in for the same account cuts the volume to the cases that matter and hands the analyst the address of the compromise.
CHAINRisky sign-in, then a privileged change
ATT&CK T1078.004 Cloud Accounts; T1098.003 Additional Cloud Roles
Source: SigninLogs, AuditLogs

A taken-over administrator account gives itself away by speed: a risky sign-in followed within two hours by a role grant, a Conditional Access change, a credential added to an application, or a federation change. Administrators do these things from their usual places.

let risky = SigninLogs | where TimeGenerated > ago(30d) | where RiskLevelDuringSignIn in ("high", "medium") | project RiskTime = TimeGenerated, UserPrincipalName, IPAddress, Country = tostring(LocationDetails.countryOrRegion); AuditLogs | where TimeGenerated > ago(30d) | where OperationName in~ ("Add member to role", "Add conditional access policy", "Update conditional access policy", "Add service principal credentials", "Set domain authentication") | extend Actor = parse_json(InitiatedBy).user | project ActionTime = TimeGenerated, OperationName, UserPrincipalName = tostring(Actor.userPrincipalName) | join kind=inner risky on UserPrincipalName | where ActionTime between (RiskTime .. (RiskTime + 2h)) | project UserPrincipalName, RiskTime, IPAddress, Country, ActionTime, OperationName
Why it beats the parts: each change is worth watching and each is routine on its own. Gating them on a risky sign-in isolates the one made from a compromised session, which is the one to answer within the hour.
Build the chain from your own detections. Gate a noisy signal on a confirming one from the same account in a short window. Each detection here is a hunt lead on its own; joined to another, it becomes an alert an analyst can act on.

Run these detections in a working SOC

This reference shows you the detections. Microsoft SOC Detection and Response teaches you to run them in your own tenant: investigating the incidents they raise, and keeping the detections, automation and data behind them working.

Read the first module free →

Weekly security engineering insights

Detection techniques, architecture patterns, and operational judgment, every Tuesday.

No spam. Unsubscribe anytime.