Hunt legacy authentication sign-ins (KQL)
Legacy authentication protocols — IMAP4, POP3, SMTP, MAPI, Exchange ActiveSync and the catch-all "Other clients" — do not support modern MFA, so attackers favour them to use stolen credentials without a second factor. This SigninLogs query returns successful sign-ins whose ClientAppUsed is a legacy client, grouped per user.
Use it to find accounts and applications still relying on legacy auth so you can scope a conditional-access block, and to triage whether a compromised credential is being used over one of these protocols right now.
The query
SigninLogs
| where TimeGenerated > ago(24h)
| where ResultType == "0"
| where ClientAppUsed in (
"Other clients", "IMAP4", "POP3", "SMTP", "MAPI",
"Exchange ActiveSync", "Exchange Web Services",
"Authenticated SMTP", "Autodiscover")
| summarize
SignIns = count(),
Apps = make_set(ClientAppUsed),
IPs = make_set(IPAddress, 50),
Resources = make_set(AppDisplayName, 20)
by UserPrincipalName
| sort by SignIns descLine-by-line explanation
| where ResultType == "0"Successful legacy sign-ins are the priority; a failure over legacy auth is far less interesting than one that worked.
| where ClientAppUsed in ("Other clients", "IMAP4", ...)ClientAppUsed records the client protocol. These values are the legacy clients that cannot enforce modern MFA.
by UserPrincipalNameCollapses to one row per account with the protocols and source IPs seen, so you can quickly judge whether the usage is expected.
Required tables and columns
ClientAppUsedThe client/protocol used; legacy values here cannot satisfy modern MFA.ResultTypeResult code; 0 means the legacy sign-in succeeded.UserPrincipalNameThe account signing in over a legacy protocol.AppDisplayNameThe resource/application reached over the legacy client.
MITRE ATT&CK mapping
Tuning and false positives
- Allow-list service accounts and appliances that legitimately require SMTP or EWS until they can be migrated.
- Compare against your conditional-access legacy-auth block policy; sign-ins appearing here mean the policy is missing a scope.
Limitations
- "Other clients" is a broad bucket that can include non-legacy traffic; confirm the protocol from the sign-in details before acting.
- Covers interactive sign-ins only; some legacy flows appear in AADNonInteractiveUserSignInLogs instead.
Related queries
References
Last reviewed 2026-11-18.