All KQL queries

Password spray followed by a successful sign-in

Example entry. Finds IP addresses that failed against many accounts, then signed in to one of them.

Tables
SigninLogs
Tags
identity, entra-id, hunting
Updated
KQL
let lookback = 1d;
let userThreshold = 10;
SigninLogs
| where TimeGenerated > ago(lookback)
| where ResultType in ("50126", "50053")
| summarize Failures = count(), Users = dcount(UserPrincipalName) by IPAddress
| where Users >= userThreshold
| join kind=inner (
    SigninLogs
    | where TimeGenerated > ago(lookback)
    | where ResultType == "0"
    | project SuccessTime = TimeGenerated, UserPrincipalName, IPAddress, AppDisplayName
  ) on IPAddress
| project SuccessTime, IPAddress, UserPrincipalName, AppDisplayName, Failures, Users
| order by SuccessTime desc

This is a placeholder to show the format. Replace it with your own query, or delete the file.

What it does

Counts failed sign-ins per IP address across distinct accounts, keeps the addresses that touched at least userThreshold accounts, and joins them to any successful sign-in from the same address.

Tuning

union SigninLogs, AADNonInteractiveUserSignInLogs