User login from different countries within 3 hours Uses Authentication Normalization
| Id | 09ec8fa2-b25f-4696-bfae-05a7b85d7b9e |
| Rulename | User login from different countries within 3 hours (Uses Authentication Normalization) |
| Description | This query searches for successful user logins from different countries within 3 hours. To use this analytics rule, make sure you have deployed the ASIM normalization parsers |
| Severity | High |
| Tactics | InitialAccess |
| Techniques | T1078 |
| Kind | Scheduled |
| Query frequency | 3h |
| Query period | 3h |
| Trigger threshold | 0 |
| Trigger operator | gt |
| Source Uri | https://github.com/Azure/Azure-Sentinel/blob/master/Detections/ASimAuthentication/imAuthSigninsMultipleCountries.yaml |
| Version | 1.2.5 |
| Arm template | 09ec8fa2-b25f-4696-bfae-05a7b85d7b9e.json |
let timeframe = ago(3h);
let threshold = 2;
imAuthentication
| where TimeGenerated > timeframe
| where EventType == 'Logon'
and EventResult == 'Success'
| where isnotempty(SrcGeoCountry)
| summarize
StartTime = min(TimeGenerated)
, EndTime = max(TimeGenerated)
, Vendors = make_set(EventVendor, 128)
, Products = make_set(EventProduct, 128)
, NumOfCountries = dcount(SrcGeoCountry)
, Countries = make_set(SrcGeoCountry, 128)
by TargetUserId, TargetUsername, TargetUserType
| where NumOfCountries >= threshold
| where TargetUserType !in ("Application", "Service", "System", "Other", "Machine", "ServicePrincipal")
| extend
Name = iif(
TargetUsername contains "@"
, tostring(split(TargetUsername, '@', 0)[0])
, TargetUsername
),
UPNSuffix = iif(
TargetUsername contains "@"
, tostring(split(TargetUsername, '@', 1)[0])
, ""
)
tactics:
- InitialAccess
query: |
let timeframe = ago(3h);
let threshold = 2;
imAuthentication
| where TimeGenerated > timeframe
| where EventType == 'Logon'
and EventResult == 'Success'
| where isnotempty(SrcGeoCountry)
| summarize
StartTime = min(TimeGenerated)
, EndTime = max(TimeGenerated)
, Vendors = make_set(EventVendor, 128)
, Products = make_set(EventProduct, 128)
, NumOfCountries = dcount(SrcGeoCountry)
, Countries = make_set(SrcGeoCountry, 128)
by TargetUserId, TargetUsername, TargetUserType
| where NumOfCountries >= threshold
| where TargetUserType !in ("Application", "Service", "System", "Other", "Machine", "ServicePrincipal")
| extend
Name = iif(
TargetUsername contains "@"
, tostring(split(TargetUsername, '@', 0)[0])
, TargetUsername
),
UPNSuffix = iif(
TargetUsername contains "@"
, tostring(split(TargetUsername, '@', 1)[0])
, ""
)
triggerOperator: gt
version: 1.2.5
tags:
- Id: 2954d424-f786-4677-9ffc-c24c44c6e7d5
version: 1.0.0
- Schema: ASIMAuthentication
SchemaVersion: 0.1.0
triggerThreshold: 0
kind: Scheduled
name: User login from different countries within 3 hours (Uses Authentication Normalization)
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Detections/ASimAuthentication/imAuthSigninsMultipleCountries.yaml
id: 09ec8fa2-b25f-4696-bfae-05a7b85d7b9e
queryFrequency: 3h
queryPeriod: 3h
metadata:
support:
tier: Community
source:
kind: Community
author:
name: Ofer Shezaf
categories:
domains:
- Security - Network
requiredDataConnectors: []
description: |
'This query searches for successful user logins from different countries within 3 hours.
To use this analytics rule, make sure you have deployed the [ASIM normalization parsers](https://aka.ms/ASimAuthentication)'
relevantTechniques:
- T1078
entityMappings:
- fieldMappings:
- columnName: TargetUserName
identifier: FullName
- columnName: Name
identifier: Name
- columnName: UPNSuffix
identifier: UPNSuffix
entityType: Account
severity: High