let lbperiod_start = 14d;
let lbperiod_end = 7d;
let lbtime = 1h;
let active_users = BoxEvents
| where TimeGenerated between (ago(lbperiod_end) .. ago(lbtime))
| where EventType =~ 'LOGIN'
| summarize makeset(SourceName);
let inactive_users = BoxEvents
| where TimeGenerated between (ago(lbperiod_start) .. ago(lbperiod_end))
| where EventType =~ 'LOGIN'
| where SourceName !in (active_users)
| summarize makeset(SourceName);
BoxEvents
| where EventType == 'LOGIN'
| where SourceName in (inactive_users)
| extend AccountCustomEntity = SourceName
queryFrequency: 1h
queryPeriod: 14d
tactics:
- InitialAccess
version: 1.0.0
query: |
let lbperiod_start = 14d;
let lbperiod_end = 7d;
let lbtime = 1h;
let active_users = BoxEvents
| where TimeGenerated between (ago(lbperiod_end) .. ago(lbtime))
| where EventType =~ 'LOGIN'
| summarize makeset(SourceName);
let inactive_users = BoxEvents
| where TimeGenerated between (ago(lbperiod_start) .. ago(lbperiod_end))
| where EventType =~ 'LOGIN'
| where SourceName !in (active_users)
| summarize makeset(SourceName);
BoxEvents
| where EventType == 'LOGIN'
| where SourceName in (inactive_users)
| extend AccountCustomEntity = SourceName
name: Box - Inactive user login
triggerOperator: gt
entityMappings:
- fieldMappings:
- columnName: AccountCustomEntity
identifier: FullName
entityType: Account
id: edbf38d7-e170-4af2-ad50-1a05b374611b
status: Available
severity: Medium
requiredDataConnectors:
- dataTypes:
- BoxEvents_CL
connectorId: BoxDataConnector
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Box/Analytic Rules/BoxInactiveUserLogin.yaml
description: |
'Detects user login after long inactivity period.'
kind: Scheduled
relevantTechniques:
- T1078
triggerThreshold: 0
{
"$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/edbf38d7-e170-4af2-ad50-1a05b374611b')]",
"kind": "Scheduled",
"name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/edbf38d7-e170-4af2-ad50-1a05b374611b')]",
"properties": {
"alertRuleTemplateName": "edbf38d7-e170-4af2-ad50-1a05b374611b",
"customDetails": null,
"description": "'Detects user login after long inactivity period.'\n",
"displayName": "Box - Inactive user login",
"enabled": true,
"entityMappings": [
{
"entityType": "Account",
"fieldMappings": [
{
"columnName": "AccountCustomEntity",
"identifier": "FullName"
}
]
}
],
"OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Box/Analytic Rules/BoxInactiveUserLogin.yaml",
"query": "let lbperiod_start = 14d;\nlet lbperiod_end = 7d;\nlet lbtime = 1h;\nlet active_users = BoxEvents\n| where TimeGenerated between (ago(lbperiod_end) .. ago(lbtime))\n| where EventType =~ 'LOGIN'\n| summarize makeset(SourceName);\nlet inactive_users = BoxEvents\n| where TimeGenerated between (ago(lbperiod_start) .. ago(lbperiod_end))\n| where EventType =~ 'LOGIN'\n| where SourceName !in (active_users)\n| summarize makeset(SourceName);\nBoxEvents\n| where EventType == 'LOGIN'\n| where SourceName in (inactive_users)\n| extend AccountCustomEntity = SourceName\n",
"queryFrequency": "PT1H",
"queryPeriod": "P14D",
"severity": "Medium",
"status": "Available",
"subTechniques": [],
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"tactics": [
"InitialAccess"
],
"techniques": [
"T1078"
],
"templateVersion": "1.0.0",
"triggerOperator": "GreaterThan",
"triggerThreshold": 0
},
"type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
}
]
}