Analytic rule catalog
User Login from Different Countries within 3 hours
Back
| Id | 2954d424-f786-4677-9ffc-c24c44c6e7d5 |
| Rulename | User Login from Different Countries within 3 hours |
| Description | This rule detects successful user logins to the Okta Console from different countries within 3 hours. This may indicate a compromised account or an account being used by multiple individuals in different locations. |
| Severity | High |
| Tactics | InitialAccess |
| Techniques | T1078.004 |
| Required data connectors | OktaSSO OktaSSOv2 |
| Kind | Scheduled |
| Query frequency | 3h |
| Query period | 3h |
| Trigger threshold | 0 |
| Trigger operator | gt |
| Source Uri | https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Okta%20Single%20Sign-On/Analytic%20Rules/LoginfromUsersfromDifferentCountrieswithin3hours.yaml |
| Version | 1.1.2 |
| Arm template | 2954d424-f786-4677-9ffc-c24c44c6e7d5.json |
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"
| where isnotempty(column_ifexists('client_geographicalContext_country_s', ''))
| summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated), NumOfCountries = dcount(tostring(column_ifexists('client_geographicalContext_country_s', ''))) by actor_alternateId_s
| where NumOfCountries >= threshold
| extend AccountName = tostring(split(actor_alternateId_s, "@")[0]), AccountUPNSuffix = tostring(split(actor_alternateId_s, "@")[1])
entityMappings:
- entityType: Account
fieldMappings:
- identifier: Name
columnName: AccountName
- identifier: UPNSuffix
columnName: AccountUPNSuffix
name: User Login from Different Countries within 3 hours
kind: Scheduled
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Okta%20Single%20Sign-On/Analytic%20Rules/LoginfromUsersfromDifferentCountrieswithin3hours.yaml
triggerOperator: gt
status: Available
queryPeriod: 3h
requiredDataConnectors:
- connectorId: OktaSSO
dataTypes:
- Okta_CL
- connectorId: OktaSSOv2
dataTypes:
- OktaSSO
tactics:
- InitialAccess
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"
| where isnotempty(column_ifexists('client_geographicalContext_country_s', ''))
| summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated), NumOfCountries = dcount(tostring(column_ifexists('client_geographicalContext_country_s', ''))) by actor_alternateId_s
| where NumOfCountries >= threshold
| extend AccountName = tostring(split(actor_alternateId_s, "@")[0]), AccountUPNSuffix = tostring(split(actor_alternateId_s, "@")[1])
description: |
This rule detects successful user logins to the Okta Console from different countries within 3 hours. This may indicate a compromised account or an account being used by multiple individuals in different locations.
severity: High
id: 2954d424-f786-4677-9ffc-c24c44c6e7d5
customDetails:
EndTime: EndTime
StartTime: StartTime
NumOfCountries: NumOfCountries
triggerThreshold: 0
queryFrequency: 3h
alertDetailsOverride:
alertDescriptionFormat: User {{actor_alternateId_s}} authenticated successfully from {{NumOfCountries}} countries within 3 hours.
alertDisplayNameFormat: User {{actor_alternateId_s}} logged in from {{NumOfCountries}} countries within 3 hours
version: 1.1.2
relevantTechniques:
- T1078.004
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"workspace": {
"type": "String"
}
},
"resources": [
{
"apiVersion": "2024-01-01-preview",
"id": "[concat(resourceId('Microsoft.OperationalInsights/workspaces/providers', parameters('workspace'), 'Microsoft.SecurityInsights'),'/alertRules/2954d424-f786-4677-9ffc-c24c44c6e7d5')]",
"kind": "Scheduled",
"name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/2954d424-f786-4677-9ffc-c24c44c6e7d5')]",
"properties": {
"alertDetailsOverride": {
"alertDescriptionFormat": "User {{actor_alternateId_s}} authenticated successfully from {{NumOfCountries}} countries within 3 hours.",
"alertDisplayNameFormat": "User {{actor_alternateId_s}} logged in from {{NumOfCountries}} countries within 3 hours"
},
"alertRuleTemplateName": "2954d424-f786-4677-9ffc-c24c44c6e7d5",
"customDetails": {
"EndTime": "EndTime",
"NumOfCountries": "NumOfCountries",
"StartTime": "StartTime"
},
"description": "This rule detects successful user logins to the Okta Console from different countries within 3 hours. This may indicate a compromised account or an account being used by multiple individuals in different locations.\n",
"displayName": "User Login from Different Countries within 3 hours",
"enabled": true,
"entityMappings": [
{
"entityType": "Account",
"fieldMappings": [
{
"columnName": "AccountName",
"identifier": "Name"
},
{
"columnName": "AccountUPNSuffix",
"identifier": "UPNSuffix"
}
]
}
],
"OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Okta%20Single%20Sign-On/Analytic%20Rules/LoginfromUsersfromDifferentCountrieswithin3hours.yaml",
"query": "let timeframe = ago(3h);\nlet threshold = 2;\nOktaSSO\n| where column_ifexists('published_t', now()) >= timeframe\n| where eventType_s =~ \"user.session.start\"\n| where outcome_result_s =~ \"SUCCESS\"\n| where isnotempty(column_ifexists('client_geographicalContext_country_s', ''))\n| summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated), NumOfCountries = dcount(tostring(column_ifexists('client_geographicalContext_country_s', ''))) by actor_alternateId_s\n| where NumOfCountries >= threshold\n| extend AccountName = tostring(split(actor_alternateId_s, \"@\")[0]), AccountUPNSuffix = tostring(split(actor_alternateId_s, \"@\")[1])\n",
"queryFrequency": "PT3H",
"queryPeriod": "PT3H",
"severity": "High",
"status": "Available",
"subTechniques": [
"T1078.004"
],
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"tactics": [
"InitialAccess"
],
"techniques": [
"T1078"
],
"templateVersion": "1.1.2",
"triggerOperator": "GreaterThan",
"triggerThreshold": 0
},
"type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
}
]
}