Hunts & Detections

Source dated

Microsoft documents ARTEX abuse across multiple threat groups

Original query

Microsoft Sentinel ยท KQL

Correlates cloud application credential changes with directory role or app permission assignments.

Telemetry AuditLogs

KQL

// Credential changes and role assignments made by the same identity within an hour
AuditLogs
| where Result =~ "success"
| where OperationName in ("Add service principal credentials", "Add member to role",
    "Add app role assignment to service principal")
    or OperationName contains "Certificates and secrets management"
| extend Stage = iff(OperationName has_any ("credentials", "Certificates"), "Credential",
    "Role")
| extend ActorUpn = tostring(InitiatedBy.user.userPrincipalName),
    ActorServicePrincipalId = tostring(InitiatedBy.app.servicePrincipalId),
    ActorAppId = tostring(InitiatedBy.app.appId),
    TargetName = tostring(TargetResources[0].displayName)
| extend Actor = coalesce(ActorUpn, ActorServicePrincipalId, ActorAppId)
| summarize Stages = make_set(Stage), Operations = make_set(OperationName),
    Targets = make_set(TargetName, 20), FirstSeen = min(TimeGenerated),
    LastSeen = max(TimeGenerated)
    by Actor, ActorAppId, bin(TimeGenerated, 1h)
| where array_length(Stages) == 2
| order by FirstSeen desc