Created
August 7, 2019 01:51
-
-
Save seclib/7a47fb2699ee60d97d723eb040ddca00 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