Back
Idb300c7f8-dc5e-4fc6-879b-63f0013358ce
RulenamePROD (TM001.1) - GROUP - Added to Group Outside the Object Tier Level
DescriptionAdded an object to a member of a Tier Model group that is outside of the same Tier. Example a Tier 0 user added to a Tier 1 group.
SeverityHigh
TacticsPrivilegeEscalation
TechniquesT1078.002
Required data connectorsSecurityEvents
WindowsSecurityEvents
KindScheduled
Query frequency5m
Query period5m
Trigger threshold0
Trigger operatorgt
Source Urihttps://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Microsoft%20Active%20Directory%20Tier%20Model/Analytic%20Rules/TM001_GROUPAddedToGroupOutsideTheObjectTierLevel.yaml
Version1.0.0
Arm templateb300c7f8-dc5e-4fc6-879b-63f0013358ce.json
Deploy To Azure
SecurityEvent 
| where EventID == 5136
    and Activity has "modified"
    and (EventData matches regex @"(?i)OU=Tier 0 Accounts" 
         or EventData matches regex @"(?i)OU=Tier 1 Accounts" 
         or EventData matches regex @"(?i)OU=Tier 2 Accounts"
         or EventData matches regex @"(?i)OU=Tier 0 Service Accounts" 
         or EventData matches regex @"(?i)OU=Tier 1 Service Accounts" 
         or EventData matches regex @"(?i)OU=Tier 2 Service Accounts"
         or EventData matches regex @"(?i)OU=Tier 0 Groups"
         or EventData matches regex @"(?i)OU=Tier 1 Groups"
         or EventData matches regex @"(?i)OU=Tier 2 Groups"
         or EventData matches regex @"(?i)OU=Tier 0 PAW"
         or EventData matches regex @"(?i)OU=Tier 1 PAW"
         or EventData matches regex @"(?i)OU=Tier 2 PAW")
    and EventData has '"AttributeLDAPDisplayName">member'
    and EventData has 'OperationType">%%14674'
| extend GroupName_e = extract("<Data Name=\"ObjectDN\">([^<]+)</Data>", 1, EventData)
| extend GroupName = extract("(?i)CN=([^,]+)", 1, GroupName_e)
| where GroupName != "Protected Users"
| where GroupName != "Allowed RODC Password Replication Group"
| extend GroupTier_e = extract("<Data Name=\"ObjectDN\">([^<]+)</Data>", 1, EventData)
| extend GroupTier = extract("(?i)OU=(Tier [^ ]+)", 1, GroupTier_e)
| extend GroupTier = iff(isempty(GroupTier), "Outside Tier Model", GroupTier)
| extend ObjectName_e = extract("<Data Name=\"AttributeValue\">([^<]+)</Data>", 1, EventData)
| extend ObjectName = extract("(?i)CN=([^,]+)", 1, ObjectName_e)
| extend ObjectTier_e = extract("<Data Name=\"AttributeValue\">([^<]+)</Data>", 1, EventData)
| extend ObjectTier = extract("(?i)OU=(Tier [^ ]+)", 1, ObjectTier_e)
| extend ObjectTier = iff(isempty(ObjectTier), "Outside Tier Model", ObjectTier)
| extend Domain = extract("([^.]+\\.[^.]+)$", 1, Computer)
| extend ActivityType = extract("([a-zA-Z]+)\\.$", 1, Activity)
| extend OperationType = iff(EventData has 'OperationType">%%14674', "Added", tostring(OperationType))
| where GroupTier != ObjectTier
| project TimeGenerated 
        , ObjectName
        , ObjectTier
        , ObjectType = AccountType
        , GroupName
        , GroupTier
        , ActivityType
        , OperationType
        , Account
        , Domain
        , Computer
        , Channel
        , EventID
        , EventData
relevantTechniques:
- T1078.002
triggerThreshold: 0
id: b300c7f8-dc5e-4fc6-879b-63f0013358ce
eventGroupingSettings:
  aggregationKind: AlertPerResult
alertDetailsOverride:
  alertDisplayNameFormat: (TM001.1) A {{ObjectTier}} object was added to non-{{ObjectTier}} group {{GroupName}}
  alertDescriptionFormat: |
    Tier Model Alert TM001 - A {{ObjectTier}} object was added to non-{{ObjectTier}} group {{GroupName}}.

    Resolution - Remove the object from the group
queryPeriod: 5m
triggerOperator: gt
incidentConfiguration:
  createIncident: true
  groupingConfiguration:
    enabled: false
    reopenClosedIncident: false
    matchingMethod: Selected
    groupByCustomDetails:
    - ObjectName
    groupByEntities:
    - Account
    lookbackDuration: PT5M
status: Available
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Microsoft%20Active%20Directory%20Tier%20Model/Analytic%20Rules/TM001_GROUPAddedToGroupOutsideTheObjectTierLevel.yaml
queryFrequency: 5m
requiredDataConnectors:
- dataTypes:
  - SecurityEvent
  connectorId: SecurityEvents
- dataTypes:
  - SecurityEvent
  connectorId: WindowsSecurityEvents
version: 1.0.0
tactics:
- PrivilegeEscalation
query: |
  SecurityEvent 
  | where EventID == 5136
      and Activity has "modified"
      and (EventData matches regex @"(?i)OU=Tier 0 Accounts" 
           or EventData matches regex @"(?i)OU=Tier 1 Accounts" 
           or EventData matches regex @"(?i)OU=Tier 2 Accounts"
           or EventData matches regex @"(?i)OU=Tier 0 Service Accounts" 
           or EventData matches regex @"(?i)OU=Tier 1 Service Accounts" 
           or EventData matches regex @"(?i)OU=Tier 2 Service Accounts"
           or EventData matches regex @"(?i)OU=Tier 0 Groups"
           or EventData matches regex @"(?i)OU=Tier 1 Groups"
           or EventData matches regex @"(?i)OU=Tier 2 Groups"
           or EventData matches regex @"(?i)OU=Tier 0 PAW"
           or EventData matches regex @"(?i)OU=Tier 1 PAW"
           or EventData matches regex @"(?i)OU=Tier 2 PAW")
      and EventData has '"AttributeLDAPDisplayName">member'
      and EventData has 'OperationType">%%14674'
  | extend GroupName_e = extract("<Data Name=\"ObjectDN\">([^<]+)</Data>", 1, EventData)
  | extend GroupName = extract("(?i)CN=([^,]+)", 1, GroupName_e)
  | where GroupName != "Protected Users"
  | where GroupName != "Allowed RODC Password Replication Group"
  | extend GroupTier_e = extract("<Data Name=\"ObjectDN\">([^<]+)</Data>", 1, EventData)
  | extend GroupTier = extract("(?i)OU=(Tier [^ ]+)", 1, GroupTier_e)
  | extend GroupTier = iff(isempty(GroupTier), "Outside Tier Model", GroupTier)
  | extend ObjectName_e = extract("<Data Name=\"AttributeValue\">([^<]+)</Data>", 1, EventData)
  | extend ObjectName = extract("(?i)CN=([^,]+)", 1, ObjectName_e)
  | extend ObjectTier_e = extract("<Data Name=\"AttributeValue\">([^<]+)</Data>", 1, EventData)
  | extend ObjectTier = extract("(?i)OU=(Tier [^ ]+)", 1, ObjectTier_e)
  | extend ObjectTier = iff(isempty(ObjectTier), "Outside Tier Model", ObjectTier)
  | extend Domain = extract("([^.]+\\.[^.]+)$", 1, Computer)
  | extend ActivityType = extract("([a-zA-Z]+)\\.$", 1, Activity)
  | extend OperationType = iff(EventData has 'OperationType">%%14674', "Added", tostring(OperationType))
  | where GroupTier != ObjectTier
  | project TimeGenerated 
          , ObjectName
          , ObjectTier
          , ObjectType = AccountType
          , GroupName
          , GroupTier
          , ActivityType
          , OperationType
          , Account
          , Domain
          , Computer
          , Channel
          , EventID
          , EventData
name: PROD (TM001.1) - GROUP - Added to Group Outside the Object Tier Level
severity: High
entityMappings:
- entityType: Account
  fieldMappings:
  - identifier: FullName
    columnName: ObjectName
- entityType: SecurityGroup
  fieldMappings:
  - identifier: DistinguishedName
    columnName: GroupName
- entityType: Account
  fieldMappings:
  - identifier: FullName
    columnName: Account
- entityType: Host
  fieldMappings:
  - identifier: HostName
    columnName: Computer
customDetails:
  Domain: Domain
  ActivityType: ActivityType
  OperationType: OperationType
  ObjectTier: ObjectTier
  EventID: EventID
  ObjectType: ObjectType
  ObjectName: ObjectName
  GroupName: GroupName
  Account: Account
  Channel: Channel
  EventData: EventData
  GroupTier: GroupTier
description: |
  Added an object to a member of a Tier Model group that is outside of the same Tier. Example a Tier 0 user added to a Tier 1 group.
kind: Scheduled
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "workspace": {
      "type": "String"
    }
  },
  "resources": [
    {
      "apiVersion": "2024-01-01-preview",
      "id": "[concat(resourceId('Microsoft.OperationalInsights/workspaces/providers', parameters('workspace'), 'Microsoft.SecurityInsights'),'/alertRules/b300c7f8-dc5e-4fc6-879b-63f0013358ce')]",
      "kind": "Scheduled",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/b300c7f8-dc5e-4fc6-879b-63f0013358ce')]",
      "properties": {
        "alertDetailsOverride": {
          "alertDescriptionFormat": "Tier Model Alert TM001 - A {{ObjectTier}} object was added to non-{{ObjectTier}} group {{GroupName}}.\n\nResolution - Remove the object from the group\n",
          "alertDisplayNameFormat": "(TM001.1) A {{ObjectTier}} object was added to non-{{ObjectTier}} group {{GroupName}}"
        },
        "alertRuleTemplateName": "b300c7f8-dc5e-4fc6-879b-63f0013358ce",
        "customDetails": {
          "Account": "Account",
          "ActivityType": "ActivityType",
          "Channel": "Channel",
          "Domain": "Domain",
          "EventData": "EventData",
          "EventID": "EventID",
          "GroupName": "GroupName",
          "GroupTier": "GroupTier",
          "ObjectName": "ObjectName",
          "ObjectTier": "ObjectTier",
          "ObjectType": "ObjectType",
          "OperationType": "OperationType"
        },
        "description": "Added an object to a member of a Tier Model group that is outside of the same Tier. Example a Tier 0 user added to a Tier 1 group.\n",
        "displayName": "PROD (TM001.1) - GROUP - Added to Group Outside the Object Tier Level",
        "enabled": true,
        "entityMappings": [
          {
            "entityType": "Account",
            "fieldMappings": [
              {
                "columnName": "ObjectName",
                "identifier": "FullName"
              }
            ]
          },
          {
            "entityType": "SecurityGroup",
            "fieldMappings": [
              {
                "columnName": "GroupName",
                "identifier": "DistinguishedName"
              }
            ]
          },
          {
            "entityType": "Account",
            "fieldMappings": [
              {
                "columnName": "Account",
                "identifier": "FullName"
              }
            ]
          },
          {
            "entityType": "Host",
            "fieldMappings": [
              {
                "columnName": "Computer",
                "identifier": "HostName"
              }
            ]
          }
        ],
        "eventGroupingSettings": {
          "aggregationKind": "AlertPerResult"
        },
        "incidentConfiguration": {
          "createIncident": true,
          "groupingConfiguration": {
            "enabled": false,
            "groupByCustomDetails": [
              "ObjectName"
            ],
            "groupByEntities": [
              "Account"
            ],
            "lookbackDuration": "PT5M",
            "matchingMethod": "Selected",
            "reopenClosedIncident": false
          }
        },
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Microsoft%20Active%20Directory%20Tier%20Model/Analytic%20Rules/TM001_GROUPAddedToGroupOutsideTheObjectTierLevel.yaml",
        "query": "SecurityEvent \n| where EventID == 5136\n    and Activity has \"modified\"\n    and (EventData matches regex @\"(?i)OU=Tier 0 Accounts\" \n         or EventData matches regex @\"(?i)OU=Tier 1 Accounts\" \n         or EventData matches regex @\"(?i)OU=Tier 2 Accounts\"\n         or EventData matches regex @\"(?i)OU=Tier 0 Service Accounts\" \n         or EventData matches regex @\"(?i)OU=Tier 1 Service Accounts\" \n         or EventData matches regex @\"(?i)OU=Tier 2 Service Accounts\"\n         or EventData matches regex @\"(?i)OU=Tier 0 Groups\"\n         or EventData matches regex @\"(?i)OU=Tier 1 Groups\"\n         or EventData matches regex @\"(?i)OU=Tier 2 Groups\"\n         or EventData matches regex @\"(?i)OU=Tier 0 PAW\"\n         or EventData matches regex @\"(?i)OU=Tier 1 PAW\"\n         or EventData matches regex @\"(?i)OU=Tier 2 PAW\")\n    and EventData has '\"AttributeLDAPDisplayName\">member'\n    and EventData has 'OperationType\">14674', \"Added\", tostring(OperationType))\n| where GroupTier != ObjectTier\n| project TimeGenerated \n        , ObjectName\n        , ObjectTier\n        , ObjectType = AccountType\n        , GroupName\n        , GroupTier\n        , ActivityType\n        , OperationType\n        , Account\n        , Domain\n        , Computer\n        , Channel\n        , EventID\n        , EventData\n",
        "queryFrequency": "PT5M",
        "queryPeriod": "PT5M",
        "severity": "High",
        "status": "Available",
        "subTechniques": [
          "T1078.002"
        ],
        "suppressionDuration": "PT1H",
        "suppressionEnabled": false,
        "tactics": [
          "PrivilegeEscalation"
        ],
        "techniques": [
          "T1078"
        ],
        "templateVersion": "1.0.0",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}