Detection rules › Kusto

User Session Impersonation(Okta)

Status
available
Severity
medium
Time window
6h
Source
github.com/Azure/Azure-Sentinel

A user has started a session impersonation, gaining access with the impersonated users permissions. This typically signifies Okta admin access and should only happen if anticipated and requested.

MITRE ATT&CK coverage

Event coverage

Rules detecting the same action

Other rules on this platform that filter on the same API call or operation.

Rule body kusto

id: 35846296-4052-4de2-8098-beb6bb5f2203
name: User Session Impersonation(Okta)
description: |
    'A user has started a session impersonation, gaining access with the impersonated users permissions. This typically signifies Okta admin access and should only happen if anticipated and requested.'
severity: Medium
status: Available
requiredDataConnectors:
  - connectorId: OktaSSO
    dataTypes:
      - Okta_CL
  - connectorId: OktaSSOv2
    dataTypes:
      - OktaSSO
queryFrequency: 6h
queryPeriod: 6h
triggerOperator: gt
triggerThreshold: 0
tactics:
  - PrivilegeEscalation
relevantTechniques:
  - T1134
  - T1134.003
query: |
  OktaSSO
  | where eventType_s == "user.session.impersonation.initiate" and outcome_result_s == "SUCCESS"
  // Expand the JSON array in 'target_s' field to extract detailed information about the event
  | mv-expand parsed_json = todynamic(target_s) // Unpack and understand the details from the 'target_s' JSON array
  // Enhance visibility by extending columns with extracted details for better analysis
  | extend TargetUser_id = tostring(parsed_json.id), 
           TargetUser_type = tostring(parsed_json.type), 
           TargetUser_alternateId = tostring(parsed_json.alternateId), 
           TargetUser_displayName = tostring(parsed_json.displayName), 
           Target_detailEntry = tostring(parsed_json.detailEntry) 
  // Project event details to gain insights into the security context, including actor and target user information
  | project TimeGenerated, actor_alternateId_s, actor_displayName_s, TargetUser_alternateId, 
                 TargetUser_displayName, TargetUser_type, TargetUser_id, 
                 eventType_s, outcome_result_s
entityMappings:
  - entityType: Account
    fieldMappings:
      - identifier: Name
        columnName: actor_alternateId_s
      - identifier: DisplayName
        columnName: actor_displayName_s
version: 1.1.0
kind: Scheduled

Stages and Predicates

Stage 1: source

OktaSSO

Stage 2: where

| where eventType_s == "user.session.impersonation.initiate" and outcome_result_s == "SUCCESS"

Stage 3: mv-expand

| mv-expand parsed_json = todynamic(target_s)

Stage 4: extend

| extend TargetUser_id = tostring(parsed_json.id), 
         TargetUser_type = tostring(parsed_json.type), 
         TargetUser_alternateId = tostring(parsed_json.alternateId), 
         TargetUser_displayName = tostring(parsed_json.displayName), 
         Target_detailEntry = tostring(parsed_json.detailEntry)

Stage 5: project

| project TimeGenerated, actor_alternateId_s, actor_displayName_s, TargetUser_alternateId, 
               TargetUser_displayName, TargetUser_type, TargetUser_id, 
               eventType_s, outcome_result_s

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
eventType_seq
  • user.session.impersonation.initiate transforms: cased
outcome_result_seq
  • SUCCESS transforms: cased

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.

FieldSource
TargetUser_alternateIdproject
TargetUser_displayNameproject
TargetUser_idproject
TargetUser_typeproject
TimeGeneratedproject
actor_alternateId_sproject
actor_displayName_sproject
eventType_sproject
outcome_result_sproject