Microsoft Sentinel Analytic Rules
cloudbrothers.infoAzure Sentinel RepoToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

User Login from Different Countries within 3 hours

Back
Id2954d424-f786-4677-9ffc-c24c44c6e7d5
RulenameUser Login from Different Countries within 3 hours
DescriptionThis query searches for successful user logins to the Okta Console from different countries within 3 hours
SeverityHigh
TacticsInitialAccess
TechniquesT1078
Required data connectorsOktaSSO
KindScheduled
Query frequency3h
Query period3h
Trigger threshold0
Trigger operatorgt
Source Urihttps://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Okta Single Sign-On/Analytic Rules/LoginfromUsersfromDifferentCountrieswithin3hours.yaml
Version1.0.2
Arm template2954d424-f786-4677-9ffc-c24c44c6e7d5.json
Deploy To Azure
let timeframe = ago(3h);
let threshold = 2;
Okta_CL
| 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
| extend timestamp = StartTime, AccountCustomEntity = actor_alternateId_s
requiredDataConnectors:
- connectorId: OktaSSO
  dataTypes:
  - Okta_CL
triggerOperator: gt
queryFrequency: 3h
name: User Login from Different Countries within 3 hours
status: Available
queryPeriod: 3h
id: 2954d424-f786-4677-9ffc-c24c44c6e7d5
description: |
    'This query searches for successful user logins to the Okta Console from different countries within 3 hours'
severity: High
query: |
  let timeframe = ago(3h);
  let threshold = 2;
  Okta_CL
  | 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
  | extend timestamp = StartTime, AccountCustomEntity = actor_alternateId_s  
version: 1.0.2
kind: Scheduled
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Okta Single Sign-On/Analytic Rules/LoginfromUsersfromDifferentCountrieswithin3hours.yaml
entityMappings:
- entityType: Account
  fieldMappings:
  - identifier: FullName
    columnName: AccountCustomEntity
relevantTechniques:
- T1078
tactics:
- InitialAccess
triggerThreshold: 0
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "workspace": {
      "type": "String"
    }
  },
  "resources": [
    {
      "id": "[concat(resourceId('Microsoft.OperationalInsights/workspaces/providers', parameters('workspace'), 'Microsoft.SecurityInsights'),'/alertRules/2954d424-f786-4677-9ffc-c24c44c6e7d5')]",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/2954d424-f786-4677-9ffc-c24c44c6e7d5')]",
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules",
      "kind": "Scheduled",
      "apiVersion": "2022-11-01-preview",
      "properties": {
        "displayName": "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'\n",
        "severity": "High",
        "enabled": true,
        "query": "let timeframe = ago(3h);\nlet threshold = 2;\nOkta_CL\n| where column_ifexists('published_t', now()) >= timeframe\n| where eventType_s =~ \"user.session.start\"\n| where outcome_result_s =~ \"SUCCESS\"\n| summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated), NumOfCountries = dcount(column_ifexists('client_geographicalContext_country_s', int(null))) by actor_alternateId_s\n| where NumOfCountries >= threshold\n| extend timestamp = StartTime, AccountCustomEntity = actor_alternateId_s\n",
        "queryFrequency": "PT3H",
        "queryPeriod": "PT3H",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0,
        "suppressionDuration": "PT1H",
        "suppressionEnabled": false,
        "tactics": [
          "InitialAccess"
        ],
        "techniques": [
          "T1078"
        ],
        "alertRuleTemplateName": "2954d424-f786-4677-9ffc-c24c44c6e7d5",
        "customDetails": null,
        "entityMappings": [
          {
            "fieldMappings": [
              {
                "identifier": "FullName",
                "columnName": "AccountCustomEntity"
              }
            ],
            "entityType": "Account"
          }
        ],
        "templateVersion": "1.0.2",
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Okta Single Sign-On/Analytic Rules/LoginfromUsersfromDifferentCountrieswithin3hours.yaml",
        "status": "Available"
      }
    }
  ]
}