Detection rules › Kusto

Box - Inactive user login

Status
available
Severity
medium
Time window
14d
Source
github.com/Azure/Azure-Sentinel

'Detects user login after long inactivity period.'

MITRE ATT&CK coverage

TacticTechniques
Initial AccessT1078 Valid Accounts

Rule body kusto

id: edbf38d7-e170-4af2-ad50-1a05b374611b
name: Box - Inactive user login
description: |
  'Detects user login after long inactivity period.'
severity: Medium
status: Available
requiredDataConnectors:
  - connectorId: BoxDataConnector
    dataTypes:
      - BoxEvents_CL
queryFrequency: 1h
queryPeriod: 14d
triggerOperator: gt
triggerThreshold: 0
tactics:
  - InitialAccess
relevantTechniques:
  - T1078
query: |
  let lbperiod_start = 14d;
  let lbperiod_end = 7d;
  let lbtime = 1h;
  let active_users = BoxEvents
  | where EventEndTime between (ago(lbperiod_end) .. ago(lbtime))
  | where EventType =~ 'LOGIN'
  | summarize makeset(SourceName);
  let inactive_users = BoxEvents
  | where EventEndTime 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
entityMappings:
  - entityType: Account
    fieldMappings:
      - identifier: FullName
        columnName: AccountCustomEntity
version: 1.0.1
kind: Scheduled

Stages and Predicates

Parameters

let lbperiod_start = 14d;
let lbperiod_end = 7d;
let lbtime = 1h;

Let binding: active_users

let active_users = BoxEvents
| where EventEndTime between (ago(lbperiod_end) .. ago(lbtime))
| where EventType =~ 'LOGIN'
| summarize makeset(SourceName);

Derived from lbperiod_end, lbtime.

Let binding: inactive_users

let inactive_users = BoxEvents
| where EventEndTime between (ago(lbperiod_start) .. ago(lbperiod_end))
| where EventType =~ 'LOGIN'
| where SourceName !in (active_users)
| summarize makeset(SourceName);

Derived from lbperiod_start, lbperiod_end, active_users.

Stage 1: source

BoxEvents

Stage 2: where

| where EventType == 'LOGIN'

Stage 3: where

| where SourceName in (inactive_users)

References inactive_users (defined above).

Stage 4: extend

| extend AccountCustomEntity = SourceName

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
EventTypeeq
  • LOGIN transforms: cased
SourceNamein
  • inactive_users 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
AccountCustomEntityextend