Detection rules › Kusto
User Login from Different Countries within 3 hours
This query searches for successful user logins to the Okta Console from different countries within 3 hours.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Initial Access | T1078.004 Valid Accounts: Cloud Accounts |
Event coverage
| Provider | Event |
|---|---|
| Okta-user | user.session.start |
Rules detecting the same action
Other rules on this platform that filter on the same API call or operation.
- Failed Logins from Unknown or Invalid User (Kusto)
- First Occurrence of Okta User Session Started via Proxy (Elastic)
- High-Risk Admin Activity (Kusto)
- Multiple Okta Sessions Detected for a Single User (Elastic)
- Multiple Okta User Authentication Events with Same Device Token Hash (Elastic)
- New Device/Location sign-in along with critical operation (Kusto)
- Okta AiTM Session Cookie Replay (Elastic)
- Okta Login Signal (Panther)
Rule body kusto
id: 2954d424-f786-4677-9ffc-c24c44c6e7d5
name: User Login from Different Countries within 3 hours
description: |
'This query searches for successful user logins to the Okta Console from different countries within 3 hours.'
severity: High
status: Available
requiredDataConnectors:
- connectorId: OktaSSO
dataTypes:
- Okta_CL
- connectorId: OktaSSOv2
dataTypes:
- OktaSSO
queryFrequency: 3h
queryPeriod: 3h
triggerOperator: gt
triggerThreshold: 0
tactics:
- InitialAccess
relevantTechniques:
- T1078.004
query: |
let timeframe = ago(3h);
let threshold = 2;
OktaSSO
| where column_ifexists('published_t', now()) >= timeframe
| where eventType_s =~ "user.session.start"
| where outcome_result_s =~ "SUCCESS"
| summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated), NumOfCountries = dcount(column_ifexists('client_geographicalContext_country_s', int(null))) by actor_alternateId_s
| where NumOfCountries >= threshold
entityMappings:
- entityType: Account
fieldMappings:
- identifier: FullName
columnName: actor_alternateId_s
version: 1.1.1
kind: Scheduled
Stages and Predicates
Parameters
let timeframe = ago(3h);
let threshold = 2;
Stage 1: source
OktaSSO
Stage 2: where
| where column_ifexists('published_t', now()) >= timeframe
Stage 3: where
| where eventType_s =~ "user.session.start"
Stage 4: where
| where outcome_result_s =~ "SUCCESS"
Stage 5: summarize
| summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated), NumOfCountries = dcount(column_ifexists('client_geographicalContext_country_s', int(null))) by actor_alternateId_s
Stage 6: where
| where NumOfCountries >= threshold
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.
| Field | Kind | Values |
|---|---|---|
NumOfCountries | ge |
|
eventType_s | eq |
|
outcome_result_s | eq |
|
published_t | ge |
|
Output fields
Fields the rule emits when it matches. Chronicle authors list these in the outcome block; they appear on the detection and $risk_score drives alerting. Sentinel / Defender XDR rules build them up through project / summarize / extend stages. Sentinel maps these into alert fields via entityMappings and customDetails; Defender XDR custom detections surface them as alert fields directly.
| Field | Source |
|---|---|
EndTime | summarize |
NumOfCountries | summarize |
StartTime | summarize |
actor_alternateId_s | summarize |