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

Zscaler - Unexpected ZPA session duration

Back
Ide07846e0-43ad-11ec-81d3-0242ac130003
RulenameZscaler - Unexpected ZPA session duration
DescriptionDetects Unexpected ZPA session duration.
SeverityMedium
TacticsInitialAccess
TechniquesT1078
T1133
Required data connectorsCustomLogsAma
KindScheduled
Query frequency1h
Query period24h
Trigger threshold0
Trigger operatorgt
Source Urihttps://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Zscaler Private Access (ZPA)/Analytic Rules/ZscalerZPAUnexpectedSessionDuration.yaml
Version1.0.2
Arm templatee07846e0-43ad-11ec-81d3-0242ac130003.json
Deploy To Azure
let dt_lookBack = 24h;
let time_treshhold = timespan(08:00:00);
let open_sessions =
ZPAEvent
| where TimeGenerated > ago(dt_lookBack)
| where DvcAction == 'open'
| summarize timestampstart = min(TimeGenerated) by DstUserName, SrcIpAddr, NetworkSessionId
| sort by timestampstart asc;
let closed_sessions =
ZPAEvent
| where TimeGenerated > ago(dt_lookBack)
| where DvcAction == 'close'
| summarize timestampend = max(TimeGenerated) by DstUserName, SrcIpAddr, NetworkSessionId
| sort by timestampend asc;
open_sessions
| join (closed_sessions) on DstUserName, SrcIpAddr, NetworkSessionId
| extend duration = timestampend - timestampstart
| where duration > time_treshhold
| where DstUserName !has "ZPA LSS"
| sort by timestampstart asc
| extend IPCustomEntity = SrcIpAddr, AccountCustomEntity = DstUserName
queryPeriod: 24h
query: |
  let dt_lookBack = 24h;
  let time_treshhold = timespan(08:00:00);
  let open_sessions =
  ZPAEvent
  | where TimeGenerated > ago(dt_lookBack)
  | where DvcAction == 'open'
  | summarize timestampstart = min(TimeGenerated) by DstUserName, SrcIpAddr, NetworkSessionId
  | sort by timestampstart asc;
  let closed_sessions =
  ZPAEvent
  | where TimeGenerated > ago(dt_lookBack)
  | where DvcAction == 'close'
  | summarize timestampend = max(TimeGenerated) by DstUserName, SrcIpAddr, NetworkSessionId
  | sort by timestampend asc;
  open_sessions
  | join (closed_sessions) on DstUserName, SrcIpAddr, NetworkSessionId
  | extend duration = timestampend - timestampstart
  | where duration > time_treshhold
  | where DstUserName !has "ZPA LSS"
  | sort by timestampstart asc
  | extend IPCustomEntity = SrcIpAddr, AccountCustomEntity = DstUserName  
name: Zscaler - Unexpected ZPA session duration
entityMappings:
- fieldMappings:
  - columnName: AccountCustomEntity
    identifier: Name
  entityType: Account
- fieldMappings:
  - columnName: IPCustomEntity
    identifier: Address
  entityType: IP
queryFrequency: 1h
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Zscaler Private Access (ZPA)/Analytic Rules/ZscalerZPAUnexpectedSessionDuration.yaml
requiredDataConnectors:
- connectorId: CustomLogsAma
  datatypes:
  - ZPA_CL
description: |
    'Detects Unexpected ZPA session duration.'
kind: Scheduled
version: 1.0.2
status: Available
severity: Medium
relevantTechniques:
- T1078
- T1133
triggerOperator: gt
triggerThreshold: 0
tactics:
- InitialAccess
id: e07846e0-43ad-11ec-81d3-0242ac130003