Analytic rule catalog
Entra ID cross-tenant identity sync allowed
Back
| Id | 7ca69a51-4328-4104-8ceb-69d371e362f0 |
| Rulename | Entra ID cross-tenant identity sync allowed |
| Description | Identifies when cross-tenant identity synchronization from a partner tenant is allowed in Microsoft Entra ID, either by creating the setting with inbound sync allowed or by changing an existing one to allowed. When inbound sync is allowed, administrators of the partner tenant can create, update and delete B2B users in this tenant without anyone here creating them. An attacker with at least the Security Administrator role here could allow sync from a tenant they control and use it to push accounts in. Microsoft intends cross-tenant sync for tenants of the same organization, so a partner outside it is worth checking first. Turning sync off or deleting the setting does not alert, and the update record does not carry the partner tenant id, so take it from the create record or from the cross-tenant access settings. Ref: https://learn.microsoft.com/entra/identity/multi-tenant-organizations/cross-tenant-synchronization-overview |
| Severity | Medium |
| Tactics | InitialAccess Persistence DefenseEvasion |
| Techniques | T1199 T1136.003 T1484.002 |
| Required data connectors | AzureActiveDirectory |
| Kind | Scheduled |
| Query frequency | 1h |
| Query period | 2h |
| Trigger threshold | 0 |
| Trigger operator | gt |
| Source Uri | https://github.com/Azure/Azure-Sentinel/blob/master/Detections/AuditLogs/CrossTenantIdentitySyncAllowed.yaml |
| Version | 1.0.0 |
| Arm template | 7ca69a51-4328-4104-8ceb-69d371e362f0.json |
AuditLogs
| where TimeGenerated > ago(2h)
| where ingestion_time() > ago(1h)
| where OperationName in~ ("Create a partner cross-tenant identity sync setting", "Update a partner cross-tenant identity sync setting")
| where Result !~ "failure"
| extend InitiatingAppName = tostring(InitiatedBy.app.displayName)
| extend InitiatingUserPrincipalName = tostring(InitiatedBy.user.userPrincipalName)
| extend InitiatingAadUserId = tostring(InitiatedBy.user.id)
| extend InitiatingIPAddress = tostring(iff(isnotempty(InitiatedBy.user.ipAddress), InitiatedBy.user.ipAddress, InitiatedBy.app.ipAddress))
| extend InitiatingAccountName = tostring(split(InitiatingUserPrincipalName, "@")[0]), InitiatingAccountUPNSuffix = tostring(split(InitiatingUserPrincipalName, "@")[1])
| mv-apply Target = TargetResources on (
mv-expand Property = Target.modifiedProperties
| summarize PropertyBag = make_bag(bag_pack(tostring(Property.displayName), bag_pack("old", tostring(Property.oldValue), "new", tostring(Property.newValue))))
)
| extend PartnerTenantId = tostring(parse_json(tostring(PropertyBag.PartnerIdentifier.new))[0])
| extend DetailBefore = parse_json(tostring(parse_json(tostring(PropertyBag.PartnerPolicyDetail.old))[0].Detail))
| extend DetailAfter = parse_json(tostring(parse_json(tostring(PropertyBag.PartnerPolicyDetail.new))[0].Detail))
| extend SyncAllowedBefore = tostring(DetailBefore.UserSyncInbound.IsSyncAllowed)
| extend SyncAllowedAfter = tostring(DetailAfter.UserSyncInbound.IsSyncAllowed)
| where (SyncAllowedAfter =~ "true" and SyncAllowedBefore !~ "true") or (isempty(SyncAllowedAfter) and isnotempty(tostring(PropertyBag.PartnerPolicyDetail.new)))
| project-reorder TimeGenerated, OperationName, PartnerTenantId, SyncAllowedBefore, SyncAllowedAfter, InitiatingUserPrincipalName, InitiatingAppName, InitiatingIPAddress
metadata:
categories:
domains:
- Security - Threat Protection
- Identity
author:
name: descambiado
source:
kind: Community
support:
tier: Community
customDetails:
PartnerTenantId: PartnerTenantId
Operation: OperationName
SyncAllowedBefore: SyncAllowedBefore
SyncAllowedAfter: SyncAllowedAfter
InitiatingApp: InitiatingAppName
severity: Medium
requiredDataConnectors:
- connectorId: AzureActiveDirectory
dataTypes:
- AuditLogs
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Detections/AuditLogs/CrossTenantIdentitySyncAllowed.yaml
queryPeriod: 2h
queryFrequency: 1h
entityMappings:
- fieldMappings:
- identifier: FullName
columnName: InitiatingUserPrincipalName
- identifier: Name
columnName: InitiatingAccountName
- identifier: UPNSuffix
columnName: InitiatingAccountUPNSuffix
entityType: Account
- fieldMappings:
- identifier: AadUserId
columnName: InitiatingAadUserId
entityType: Account
- fieldMappings:
- identifier: Address
columnName: InitiatingIPAddress
entityType: IP
kind: Scheduled
relevantTechniques:
- T1199
- T1136.003
- T1484.002
triggerOperator: gt
status: InPreview
query: |
AuditLogs
| where TimeGenerated > ago(2h)
| where ingestion_time() > ago(1h)
| where OperationName in~ ("Create a partner cross-tenant identity sync setting", "Update a partner cross-tenant identity sync setting")
| where Result !~ "failure"
| extend InitiatingAppName = tostring(InitiatedBy.app.displayName)
| extend InitiatingUserPrincipalName = tostring(InitiatedBy.user.userPrincipalName)
| extend InitiatingAadUserId = tostring(InitiatedBy.user.id)
| extend InitiatingIPAddress = tostring(iff(isnotempty(InitiatedBy.user.ipAddress), InitiatedBy.user.ipAddress, InitiatedBy.app.ipAddress))
| extend InitiatingAccountName = tostring(split(InitiatingUserPrincipalName, "@")[0]), InitiatingAccountUPNSuffix = tostring(split(InitiatingUserPrincipalName, "@")[1])
| mv-apply Target = TargetResources on (
mv-expand Property = Target.modifiedProperties
| summarize PropertyBag = make_bag(bag_pack(tostring(Property.displayName), bag_pack("old", tostring(Property.oldValue), "new", tostring(Property.newValue))))
)
| extend PartnerTenantId = tostring(parse_json(tostring(PropertyBag.PartnerIdentifier.new))[0])
| extend DetailBefore = parse_json(tostring(parse_json(tostring(PropertyBag.PartnerPolicyDetail.old))[0].Detail))
| extend DetailAfter = parse_json(tostring(parse_json(tostring(PropertyBag.PartnerPolicyDetail.new))[0].Detail))
| extend SyncAllowedBefore = tostring(DetailBefore.UserSyncInbound.IsSyncAllowed)
| extend SyncAllowedAfter = tostring(DetailAfter.UserSyncInbound.IsSyncAllowed)
| where (SyncAllowedAfter =~ "true" and SyncAllowedBefore !~ "true") or (isempty(SyncAllowedAfter) and isnotempty(tostring(PropertyBag.PartnerPolicyDetail.new)))
| project-reorder TimeGenerated, OperationName, PartnerTenantId, SyncAllowedBefore, SyncAllowedAfter, InitiatingUserPrincipalName, InitiatingAppName, InitiatingIPAddress
eventGroupingSettings:
aggregationKind: AlertPerResult
name: Entra ID cross-tenant identity sync allowed
triggerThreshold: 0
version: 1.0.0
id: 7ca69a51-4328-4104-8ceb-69d371e362f0
description: |
Identifies when cross-tenant identity synchronization from a partner tenant is allowed in Microsoft Entra ID, either by creating the setting with inbound sync allowed or by changing an existing one to allowed.
When inbound sync is allowed, administrators of the partner tenant can create, update and delete B2B users in this tenant without anyone here creating them.
An attacker with at least the Security Administrator role here could allow sync from a tenant they control and use it to push accounts in.
Microsoft intends cross-tenant sync for tenants of the same organization, so a partner outside it is worth checking first.
Turning sync off or deleting the setting does not alert, and the update record does not carry the partner tenant id, so take it from the create record or from the cross-tenant access settings.
Ref: https://learn.microsoft.com/entra/identity/multi-tenant-organizations/cross-tenant-synchronization-overview
tactics:
- InitialAccess
- Persistence
- DefenseEvasion
{
"$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/7ca69a51-4328-4104-8ceb-69d371e362f0')]",
"kind": "Scheduled",
"name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/7ca69a51-4328-4104-8ceb-69d371e362f0')]",
"properties": {
"alertRuleTemplateName": "7ca69a51-4328-4104-8ceb-69d371e362f0",
"customDetails": {
"InitiatingApp": "InitiatingAppName",
"Operation": "OperationName",
"PartnerTenantId": "PartnerTenantId",
"SyncAllowedAfter": "SyncAllowedAfter",
"SyncAllowedBefore": "SyncAllowedBefore"
},
"description": "Identifies when cross-tenant identity synchronization from a partner tenant is allowed in Microsoft Entra ID, either by creating the setting with inbound sync allowed or by changing an existing one to allowed.\nWhen inbound sync is allowed, administrators of the partner tenant can create, update and delete B2B users in this tenant without anyone here creating them.\nAn attacker with at least the Security Administrator role here could allow sync from a tenant they control and use it to push accounts in.\nMicrosoft intends cross-tenant sync for tenants of the same organization, so a partner outside it is worth checking first.\nTurning sync off or deleting the setting does not alert, and the update record does not carry the partner tenant id, so take it from the create record or from the cross-tenant access settings.\nRef: https://learn.microsoft.com/entra/identity/multi-tenant-organizations/cross-tenant-synchronization-overview\n",
"displayName": "Entra ID cross-tenant identity sync allowed",
"enabled": true,
"entityMappings": [
{
"entityType": "Account",
"fieldMappings": [
{
"columnName": "InitiatingUserPrincipalName",
"identifier": "FullName"
},
{
"columnName": "InitiatingAccountName",
"identifier": "Name"
},
{
"columnName": "InitiatingAccountUPNSuffix",
"identifier": "UPNSuffix"
}
]
},
{
"entityType": "Account",
"fieldMappings": [
{
"columnName": "InitiatingAadUserId",
"identifier": "AadUserId"
}
]
},
{
"entityType": "IP",
"fieldMappings": [
{
"columnName": "InitiatingIPAddress",
"identifier": "Address"
}
]
}
],
"eventGroupingSettings": {
"aggregationKind": "AlertPerResult"
},
"OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Detections/AuditLogs/CrossTenantIdentitySyncAllowed.yaml",
"query": "AuditLogs\n| where TimeGenerated > ago(2h)\n| where ingestion_time() > ago(1h)\n| where OperationName in~ (\"Create a partner cross-tenant identity sync setting\", \"Update a partner cross-tenant identity sync setting\")\n| where Result !~ \"failure\"\n| extend InitiatingAppName = tostring(InitiatedBy.app.displayName)\n| extend InitiatingUserPrincipalName = tostring(InitiatedBy.user.userPrincipalName)\n| extend InitiatingAadUserId = tostring(InitiatedBy.user.id)\n| extend InitiatingIPAddress = tostring(iff(isnotempty(InitiatedBy.user.ipAddress), InitiatedBy.user.ipAddress, InitiatedBy.app.ipAddress))\n| extend InitiatingAccountName = tostring(split(InitiatingUserPrincipalName, \"@\")[0]), InitiatingAccountUPNSuffix = tostring(split(InitiatingUserPrincipalName, \"@\")[1])\n| mv-apply Target = TargetResources on (\n mv-expand Property = Target.modifiedProperties\n | summarize PropertyBag = make_bag(bag_pack(tostring(Property.displayName), bag_pack(\"old\", tostring(Property.oldValue), \"new\", tostring(Property.newValue))))\n )\n| extend PartnerTenantId = tostring(parse_json(tostring(PropertyBag.PartnerIdentifier.new))[0])\n| extend DetailBefore = parse_json(tostring(parse_json(tostring(PropertyBag.PartnerPolicyDetail.old))[0].Detail))\n| extend DetailAfter = parse_json(tostring(parse_json(tostring(PropertyBag.PartnerPolicyDetail.new))[0].Detail))\n| extend SyncAllowedBefore = tostring(DetailBefore.UserSyncInbound.IsSyncAllowed)\n| extend SyncAllowedAfter = tostring(DetailAfter.UserSyncInbound.IsSyncAllowed)\n| where (SyncAllowedAfter =~ \"true\" and SyncAllowedBefore !~ \"true\") or (isempty(SyncAllowedAfter) and isnotempty(tostring(PropertyBag.PartnerPolicyDetail.new)))\n| project-reorder TimeGenerated, OperationName, PartnerTenantId, SyncAllowedBefore, SyncAllowedAfter, InitiatingUserPrincipalName, InitiatingAppName, InitiatingIPAddress\n",
"queryFrequency": "PT1H",
"queryPeriod": "PT2H",
"severity": "Medium",
"status": "InPreview",
"subTechniques": [
"T1136.003",
"T1484.002"
],
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"tactics": [
"DefenseEvasion",
"InitialAccess",
"Persistence"
],
"techniques": [
"T1136",
"T1199",
"T1484"
],
"templateVersion": "1.0.0",
"triggerOperator": "GreaterThan",
"triggerThreshold": 0
},
"type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
}
]
}