Created
May 7, 2019 16:58
-
-
Save JohnLaTwC/5eb27b85960f830b6f557fa6ccc43be5 to your computer and use it in GitHub Desktop.
Azure Sentinel Password spray query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let valid_logons = (OfficeActivity | |
| where TimeGenerated > ago(30d) | |
| where Operation == 'UserLoggedIn' | |
| summarize by ClientIP); | |
let only_invalid_logons = (OfficeActivity | |
| where TimeGenerated > ago(30d) | |
| where Operation == 'UserLoginFailed' | |
| summarize by ClientIP) | |
| join kind=anti (valid_logons) on ClientIP; | |
OfficeActivity | |
| where TimeGenerated > ago(30d) | |
| join kind=inner (only_invalid_logons) on ClientIP | |
| extend UserAgent=tostring(parse_json(ExtendedProperties)[0].Value) | |
| where (UserAgent matches regex 'Microsoft Office/\\d+\\.\\d+ \\(Windows NT \\d+\\.\\d+; Microsoft Outlook \\d+\\.\\d+\\.\\d+; Pro\\)' | |
or UserAgent == 'CBAInPROD' | |
or UserAgent matches regex '^[\\w\\.\\d\\-\\_]{4,15}\\/[\\.\\w\\d\\-\\_]{4,30}$') | |
| summarize by ClientIP, UserAgent |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Could this also be used to query in the M365 Security Center Advanced Hunting?