Detection rules › Kusto

ApexOne - Device access permissions was changed

Status
available
Severity
medium
Time window
1h
Group by
DstUserName
Source
github.com/Azure/Azure-Sentinel

'Query shows device access permissions was changed.'

MITRE ATT&CK coverage

TacticTechniques
Privilege EscalationT1078 Valid Accounts

Rule body kusto

id: b463b952-67b8-11ec-90d6-0242ac120003
name: ApexOne - Device access permissions was changed
description: |
  'Query shows device access permissions was changed.'
severity: Medium
status: Available
requiredDataConnectors:
  - connectorId: CefAma
    dataTypes:
      - CommonSecurityLog
queryFrequency: 1h
queryPeriod: 1h
triggerOperator: gt
triggerThreshold: 0
tactics:
  - PrivilegeEscalation
relevantTechniques:
  - T1078
query: |
  let threshold = 1;
  TMApexOneEvent
  | where EventMessage has "Device access"
  | extend DeviceCustomNumber3 = coalesce(
                                    column_ifexists("FieldDeviceCustomNumber3", long(null)),
                                    DeviceCustomNumber3,
                                    long(null)
                                )
  | extend Permission = case(
                              DeviceCustomNumber3 == "0", "Modify", 
                              DeviceCustomNumber3 == "1", "Read and execute",
                              DeviceCustomNumber3 == "2", "Read",
                              DeviceCustomNumber3 == "3", "List device content only", 
                              DeviceCustomNumber3 == "4", "Block",
                              "unknown"
                        )
  | summarize Permissions = make_set(Permission) by DstUserName
  | extend PermissionCount = array_length(Permissions)
  | where PermissionCount > threshold
  | extend AccountCustomEntity = DstUserName
entityMappings:
  - entityType: Account
    fieldMappings:
      - identifier: Name
        columnName: AccountCustomEntity
version: 1.0.4
kind: Scheduled

Stages and Predicates

Parameters

let threshold = 1;

Stage 1: source

TMApexOneEvent

Stage 2: where

| where EventMessage has "Device access"

Stage 3: extend

| extend DeviceCustomNumber3 = coalesce(
                                  column_ifexists("FieldDeviceCustomNumber3", long(null)),
                                  DeviceCustomNumber3,
                                  long(null)
                              )

Stage 4: extend

| extend Permission = case(
                            DeviceCustomNumber3 == "0", "Modify", 
                            DeviceCustomNumber3 == "1", "Read and execute",
                            DeviceCustomNumber3 == "2", "Read",
                            DeviceCustomNumber3 == "3", "List device content only", 
                            DeviceCustomNumber3 == "4", "Block",
                            "unknown"
                      )
Permission =
ifDeviceCustomNumber3 == 0"Modify"
elifDeviceCustomNumber3 == 1"Read and execute"
elifDeviceCustomNumber3 == 2"Read"
elifDeviceCustomNumber3 == 3"List device content only"
elifDeviceCustomNumber3 == 4"Block"
else"unknown"

Stage 5: summarize

| summarize Permissions = make_set(Permission) by DstUserName

Stage 6: extend

| extend PermissionCount = array_length(Permissions)

Stage 7: where

| where PermissionCount > threshold

Stage 8: extend

| extend AccountCustomEntity = DstUserName

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
EventMessagematch
  • Device access transforms: term
PermissionCountgt
  • 1 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
DstUserNamesummarize
Permissionssummarize
PermissionCountextend
AccountCustomEntityextend