Detection rules › Kusto

BTP - Trust and authorization Identity Provider monitor

Status
available
Severity
medium
Time window
15m
Source
github.com/Azure/Azure-Sentinel

Identifies CRUD operations on Identity Provider settings within a sub account.

MITRE ATT&CK coverage

Rule body kusto

id: 62357c23-ecdc-4edc-9349-8338063af1ef
kind: Scheduled
name: BTP - Trust and authorization Identity Provider monitor
description: Identifies CRUD operations on Identity Provider settings within a sub
  account.
severity: Medium
status: Available
requiredDataConnectors:
  - connectorId: SAPBTPAuditEvents
    dataTypes:
      - SAPBTPAuditLog_CL
queryFrequency: 15m
queryPeriod: 15m
triggerOperator: gt
triggerThreshold: 0
tactics:
  - CredentialAccess
  - PrivilegeEscalation
relevantTechniques:
  - T1606
  - T1556
  - T1134
query: |
  SAPBTPAuditLog_CL
  | where isnotnull(Message.object)
  | extend Object = Message.object, Attributes = Message.attributes
  | where Object.type == "IdentityProvider"
  | extend CrudType = tostring(parse_json(tostring(Object.id)).crudType)
  | mv-expand Attributes
  | extend MessageText = case(
                             CrudType == "CREATE",
                             "An identity provider was created",
                             CrudType == "UPDATE",
                             "An identity provider was updated",
                             CrudType == "DELETE",
                             "An identity provider was deleted",
                             "Unclassified CRUD operation encountered"
                         )
  | extend NewAttributes = parse_json(replace_regex(tostring(Attributes.new), "\\r", ""))
  | extend OldAttributes = parse_json(replace_regex(tostring(Attributes.old), "\\r", ""))
  | extend IdentityProviderName = case(
                                      CrudType == "CREATE" or CrudType == "UPDATE",
                                      NewAttributes.name,
                                      CrudType == "DELETE",
                                      OldAttributes.name,
                                      "Unknown"
                                  )
  | project
      UpdatedOn,
      UserName,
      MessageText,
      IdentityProviderName,
      Tenant,
      SpaceId,
      CloudApp = "SAP BTP"
  | extend AccountName = split(UserName, "@")[0], UPNSuffix = split(UserName, "@")[1]
eventGroupingSettings:
  aggregationKind: SingleAlert
entityMappings:
  - entityType: Account
    fieldMappings:
      - identifier: Name
        columnName: AccountName
      - identifier: UPNSuffix
        columnName: UPNSuffix
  - entityType: CloudApplication
    fieldMappings:
      - identifier: Name
        columnName: CloudApp
alertDetailsOverride:
  alertDisplayNameFormat: 'SAP BTP: {{MessageText}}'
  alertDescriptionFormat: '{{MessageText}} by {{UserName}}. Identity provider name:
    {{IdentityProviderName}}'
version: 3.0.5

Stages and Predicates

Stage 1: source

SAPBTPAuditLog_CL

Stage 2: where

| where isnotnull(Message.object)

Stage 3: extend

| extend Object = Message.object, Attributes = Message.attributes

Stage 4: where

| where Object.type == "IdentityProvider"

Stage 5: extend

| extend CrudType = tostring(parse_json(tostring(Object.id)).crudType)

Stage 6: mv-expand

| mv-expand Attributes

Stage 7: extend (4 consecutive steps)

| extend MessageText = case(
                           CrudType == "CREATE",
                           "An identity provider was created",
                           CrudType == "UPDATE",
                           "An identity provider was updated",
                           CrudType == "DELETE",
                           "An identity provider was deleted",
                           "Unclassified CRUD operation encountered"
                       )
| extend NewAttributes = parse_json(replace_regex(tostring(Attributes.new), "\\r", ""))
| extend OldAttributes = parse_json(replace_regex(tostring(Attributes.old), "\\r", ""))
| extend IdentityProviderName = case(
                                    CrudType == "CREATE" or CrudType == "UPDATE",
                                    NewAttributes.name,
                                    CrudType == "DELETE",
                                    OldAttributes.name,
                                    "Unknown"
                                )
MessageText =
ifCrudType == "CREATE""An identity provider was created"
elifCrudType == "UPDATE""An identity provider was updated"
elifCrudType == "DELETE""An identity provider was deleted"
else"Unclassified CRUD operation encountered"

Stage 8: project

| project
    UpdatedOn,
    UserName,
    MessageText,
    IdentityProviderName,
    Tenant,
    SpaceId,
    CloudApp = "SAP BTP"

Stage 9: extend

| extend AccountName = split(UserName, "@")[0], UPNSuffix = split(UserName, "@")[1]

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
objectis_not_null
  • (no value, null check)
typeeq
  • IdentityProvider 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
CloudAppproject
IdentityProviderNameproject
MessageTextproject
SpaceIdproject
Tenantproject
UpdatedOnproject
UserNameproject
AccountNameextend
UPNSuffixextend