Zscaler - Unexpected ZPA session duration
Id | e07846e0-43ad-11ec-81d3-0242ac130003 |
Rulename | Zscaler - Unexpected ZPA session duration |
Description | Detects Unexpected ZPA session duration. |
Severity | Medium |
Tactics | InitialAccess |
Techniques | T1078 T1133 |
Required data connectors | CustomLogsAma ZscalerPrivateAccess |
Kind | Scheduled |
Query frequency | 1h |
Query period | 24h |
Trigger threshold | 0 |
Trigger operator | gt |
Source Uri | https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Zscaler Private Access (ZPA)/Analytic Rules/ZscalerZPAUnexpectedSessionDuration.yaml |
Version | 1.0.1 |
Arm template | e07846e0-43ad-11ec-81d3-0242ac130003.json |
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
relevantTechniques:
- T1078
- T1133
name: Zscaler - Unexpected ZPA session duration
requiredDataConnectors:
- dataTypes:
- ZPAEvent
connectorId: ZscalerPrivateAccess
- datatypes:
- ZPA_CL
connectorId: CustomLogsAma
entityMappings:
- fieldMappings:
- identifier: Name
columnName: AccountCustomEntity
entityType: Account
- fieldMappings:
- identifier: Address
columnName: IPCustomEntity
entityType: IP
triggerThreshold: 0
id: e07846e0-43ad-11ec-81d3-0242ac130003
tactics:
- InitialAccess
version: 1.0.1
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Zscaler Private Access (ZPA)/Analytic Rules/ZscalerZPAUnexpectedSessionDuration.yaml
queryPeriod: 24h
kind: Scheduled
queryFrequency: 1h
severity: Medium
status: Available
description: |
'Detects Unexpected ZPA session duration.'
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
triggerOperator: gt
{
"$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/e07846e0-43ad-11ec-81d3-0242ac130003')]",
"kind": "Scheduled",
"name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/e07846e0-43ad-11ec-81d3-0242ac130003')]",
"properties": {
"alertRuleTemplateName": "e07846e0-43ad-11ec-81d3-0242ac130003",
"customDetails": null,
"description": "'Detects Unexpected ZPA session duration.'\n",
"displayName": "Zscaler - Unexpected ZPA session duration",
"enabled": true,
"entityMappings": [
{
"entityType": "Account",
"fieldMappings": [
{
"columnName": "AccountCustomEntity",
"identifier": "Name"
}
]
},
{
"entityType": "IP",
"fieldMappings": [
{
"columnName": "IPCustomEntity",
"identifier": "Address"
}
]
}
],
"OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Zscaler Private Access (ZPA)/Analytic Rules/ZscalerZPAUnexpectedSessionDuration.yaml",
"query": "let dt_lookBack = 24h;\nlet time_treshhold = timespan(08:00:00);\nlet open_sessions =\nZPAEvent\n| where TimeGenerated > ago(dt_lookBack)\n| where DvcAction == 'open'\n| summarize timestampstart = min(TimeGenerated) by DstUserName, SrcIpAddr, NetworkSessionId\n| sort by timestampstart asc;\nlet closed_sessions =\nZPAEvent\n| where TimeGenerated > ago(dt_lookBack)\n| where DvcAction == 'close'\n| summarize timestampend = max(TimeGenerated) by DstUserName, SrcIpAddr, NetworkSessionId\n| sort by timestampend asc;\nopen_sessions\n| join (closed_sessions) on DstUserName, SrcIpAddr, NetworkSessionId\n| extend duration = timestampend - timestampstart\n| where duration > time_treshhold\n| where DstUserName !has \"ZPA LSS\"\n| sort by timestampstart asc\n| extend IPCustomEntity = SrcIpAddr, AccountCustomEntity = DstUserName\n",
"queryFrequency": "PT1H",
"queryPeriod": "PT24H",
"severity": "Medium",
"status": "Available",
"subTechniques": [],
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"tactics": [
"InitialAccess"
],
"techniques": [
"T1078",
"T1133"
],
"templateVersion": "1.0.1",
"triggerOperator": "GreaterThan",
"triggerThreshold": 0
},
"type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
}
]
}