Hunts & Detections

Source dated

Microsoft documents ARTEX abuse across multiple threat groups

Original query

Microsoft Defender XDR ยท KQL

Looks for service-principal sign-in patterns and reported user agents. The table requires Entra ID P2.

Telemetry EntraIdSpnSignInEvents

KQL

// Service principal sign-ins for several applications from one IP address
EntraIdSpnSignInEvents
| where IsManagedIdentity == false
| summarize ServicePrincipals = dcount(ServicePrincipalId),
    SucceededFor = dcountif(ServicePrincipalId, ErrorCode == 0),
    FailedSignIns = countif(ErrorCode != 0),
    InvalidOrExpiredSecret = countif(ErrorCode in (7000215, 7000222)),
    ArtexUserAgent = countif(UserAgent has_any ("artex", "norma")),
    Applications = make_set(ServicePrincipalName, 20),
    Resources = make_set(ResourceDisplayName, 20), UserAgents = make_set(UserAgent, 10),
    FirstSeen = min(Timestamp), LastSeen = max(Timestamp)
    by IPAddress, bin(Timestamp, 1h)
| where (ServicePrincipals >= 3 and SucceededFor >= 1 and FailedSignIns >= 1)
    or ArtexUserAgent > 0
| order by ServicePrincipals desc