Detection rules › Kusto Query Language

User login from different countries within 3 hours (Uses Authentication Normalization)

Author
Ofer Shezaf
Source
upstream

'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'

MITRE ATT&CK coverage

TacticTechniques
Initial AccessT1078 Valid Accounts
PersistenceT1078 Valid Accounts
Privilege EscalationT1078 Valid Accounts
Defense EvasionT1078 Valid Accounts

Event coverage

ProviderEvent IDTitle
Security-Auditing4624An account was successfully logged on.
Security-Auditing4625An account failed to log on.
Security-Auditing4634An account was logged off.

Stages and Predicates

Stage 1: source

imAuthentication

Stage 2: where

TimeGenerated gt "timeframe"

Stage 3: where

and
  EventResult eq "Success"
  EventType eq "Logon"

Stage 4: where

SrcGeoCountry is_not_null

Stage 5: summarize

Stage 6: where

NumOfCountries ge "threshold"

Stage 7: where

not
  TargetUserType in ["Application", "Machine", "Other", "Service", "ServicePrincipal", "System"]

Stage 8: extend

Exclusions

Top-level NOT(...) conjuncts — predicates this rule actively suppresses.

StageFieldKindExcluded values
1TargetUserTypeinApplication, Machine, Other, Service, ServicePrincipal, System

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
EventResulteq
  • Success
EventTypeeq
  • Logon
NumOfCountriesge
  • threshold
TimeGeneratedgt
  • timeframe