Guest user account type changed to member


Description

Identifies Entra ID user accounts converted from Guest to Member type, which grants full member-level access and may indicate an attacker elevating a compromised guest account to persistent tenant access.

Query · kql

let timeframe = 1d;
AuditLogs
| where TimeGenerated >= ago(timeframe)
| where OperationName =~ "Update user"
| where Result =~ "success"
| mv-expand ModProp = TargetResources[0].modifiedProperties
| where tostring(ModProp.displayName) =~ "UserType"
| extend OldUserType = tostring(ModProp.oldValue)
| extend NewUserType = tostring(ModProp.newValue)
| where OldUserType has "Guest" and NewUserType has "Member"
| extend TargetUpn  = tostring(TargetResources[0].userPrincipalName)
| extend TargetId   = tostring(TargetResources[0].id)
| extend ActorUpn   = tostring(InitiatedBy.user.userPrincipalName)
| extend ActorApp   = tostring(InitiatedBy.app.displayName)
| extend Actor      = iff(isnotempty(ActorUpn), ActorUpn, ActorApp)
| extend ActorIp    = iff(
      isnotempty(tostring(InitiatedBy.user.ipAddress)),
      tostring(InitiatedBy.user.ipAddress),
      tostring(InitiatedBy.app.ipAddress))
| extend AccountName      = iff(TargetUpn has "@",
      tostring(split(TargetUpn, "@")[0]), TargetUpn)
| extend AccountUPNSuffix = iff(TargetUpn has "@",
      tostring(split(TargetUpn, "@")[1]), "")
| project
    TimeGenerated,
    TargetUpn,
    AccountName,
    AccountUPNSuffix,
    TargetId,
    OldUserType,
    NewUserType,
    Actor,
    ActorIp,
    CorrelationId
| sort by TimeGenerated desc
Raw source Guest user account type changed to member · KQL
Esc
Published by Azure/Azure-Sentinel ↗, licensed under MIT ↗. Reproduced here unmodified.
id: d7684f21-18c0-4597-b79f-1ae5f2c7ab86
name: Guest user account type changed to member
description: Identifies Entra ID user accounts converted from Guest to Member type, which grants full member-level access and may indicate an attacker elevating a compromised guest account to persistent tenant access.
requiredDataConnectors:
  - connectorId: AzureActiveDirectory
    dataTypes:
      - AuditLogs
tactics:
  - Persistence
relevantTechniques:
  - T1098
query: |
  let timeframe = 1d;
  AuditLogs
  | where TimeGenerated >= ago(timeframe)
  | where OperationName =~ "Update user"
  | where Result =~ "success"
  | mv-expand ModProp = TargetResources[0].modifiedProperties
  | where tostring(ModProp.displayName) =~ "UserType"
  | extend OldUserType = tostring(ModProp.oldValue)
  | extend NewUserType = tostring(ModProp.newValue)
  | where OldUserType has "Guest" and NewUserType has "Member"
  | extend TargetUpn  = tostring(TargetResources[0].userPrincipalName)
  | extend TargetId   = tostring(TargetResources[0].id)
  | extend ActorUpn   = tostring(InitiatedBy.user.userPrincipalName)
  | extend ActorApp   = tostring(InitiatedBy.app.displayName)
  | extend Actor      = iff(isnotempty(ActorUpn), ActorUpn, ActorApp)
  | extend ActorIp    = iff(
        isnotempty(tostring(InitiatedBy.user.ipAddress)),
        tostring(InitiatedBy.user.ipAddress),
        tostring(InitiatedBy.app.ipAddress))
  | extend AccountName      = iff(TargetUpn has "@",
        tostring(split(TargetUpn, "@")[0]), TargetUpn)
  | extend AccountUPNSuffix = iff(TargetUpn has "@",
        tostring(split(TargetUpn, "@")[1]), "")
  | project
      TimeGenerated,
      TargetUpn,
      AccountName,
      AccountUPNSuffix,
      TargetId,
      OldUserType,
      NewUserType,
      Actor,
      ActorIp,
      CorrelationId
  | sort by TimeGenerated desc
entityMappings:
  - entityType: Account
    fieldMappings:
      - identifier: FullName
        columnName: TargetUpn
      - identifier: Name
        columnName: AccountName
      - identifier: UPNSuffix
        columnName: AccountUPNSuffix
  - entityType: IP
    fieldMappings:
      - identifier: Address
        columnName: ActorIp
version: 1.0.0
metadata:
    source:
        kind: Community
    author:
        name: descambiado
    support:
        tier: Community
    categories:
        domains: [ "Security - Threat Protection", "Identity" ]

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.