Conditional Access Policy Modified by New User
Id | 25a7f951-54b7-4cf5-9862-ebc04306c590 |
Rulename | Conditional Access Policy Modified by New User |
Description | Detects a Conditional Access Policy being modified by a user who has not modified a policy in the last 14 days. A threat actor may try to modify policies to weaken the security controls in place. Investigate any change to ensure they are approved. Ref: https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-infrastructure#conditional-access |
Severity | Medium |
Tactics | DefenseEvasion |
Techniques | T1078.004 |
Required data connectors | AzureActiveDirectory |
Kind | Scheduled |
Query frequency | 1d |
Query period | 14d |
Trigger threshold | 0 |
Trigger operator | gt |
Source Uri | https://github.com/Azure/Azure-Sentinel/blob/master/Detections/AuditLogs/ConditionalAccessPolicyModifiedbyNewUser.yaml |
Version | 1.0.2 |
Arm template | 25a7f951-54b7-4cf5-9862-ebc04306c590.json |
let known_users = (AuditLogs
| where TimeGenerated between(ago(14d)..ago(1d))
| where OperationName has "conditional access policy"
| where Result =~ "success"
| extend userPrincipalName = tostring(parse_json(tostring(InitiatedBy.user)).userPrincipalName)
| summarize by userPrincipalName);
AuditLogs
| where TimeGenerated > ago(1d)
| where OperationName has "conditional access policy"
| where Result =~ "success"
| extend userPrincipalName = tostring(parse_json(tostring(InitiatedBy.user)).userPrincipalName)
| extend CAPolicyName = tostring(TargetResources[0].displayName)
| extend ipAddress = tostring(parse_json(tostring(InitiatedBy.user)).ipAddress)
| where userPrincipalName !in (known_users)
| extend NewPolicyValues = TargetResources[0].modifiedProperties[0].newValue
| extend OldPolicyValues = TargetResources[0].modifiedProperties[0].oldValue
| project-reorder TimeGenerated, OperationName, CAPolicyName, userPrincipalName, ipAddress, NewPolicyValues, OldPolicyValues
id: 25a7f951-54b7-4cf5-9862-ebc04306c590
queryFrequency: 1d
version: 1.0.2
requiredDataConnectors:
- connectorId: AzureActiveDirectory
dataTypes:
- AuditLogs
entityMappings:
- fieldMappings:
- columnName: userPrincipalName
identifier: FullName
entityType: Account
- fieldMappings:
- columnName: ipAddress
identifier: Address
entityType: IP
kind: Scheduled
queryPeriod: 14d
severity: Medium
query: |
let known_users = (AuditLogs
| where TimeGenerated between(ago(14d)..ago(1d))
| where OperationName has "conditional access policy"
| where Result =~ "success"
| extend userPrincipalName = tostring(parse_json(tostring(InitiatedBy.user)).userPrincipalName)
| summarize by userPrincipalName);
AuditLogs
| where TimeGenerated > ago(1d)
| where OperationName has "conditional access policy"
| where Result =~ "success"
| extend userPrincipalName = tostring(parse_json(tostring(InitiatedBy.user)).userPrincipalName)
| extend CAPolicyName = tostring(TargetResources[0].displayName)
| extend ipAddress = tostring(parse_json(tostring(InitiatedBy.user)).ipAddress)
| where userPrincipalName !in (known_users)
| extend NewPolicyValues = TargetResources[0].modifiedProperties[0].newValue
| extend OldPolicyValues = TargetResources[0].modifiedProperties[0].oldValue
| project-reorder TimeGenerated, OperationName, CAPolicyName, userPrincipalName, ipAddress, NewPolicyValues, OldPolicyValues
metadata:
categories:
domains:
- Security - Others
author:
name: Pete Bryan
support:
tier: Community
source:
kind: Community
triggerOperator: gt
tags:
- AADSecOpsGuide
description: |
'Detects a Conditional Access Policy being modified by a user who has not modified a policy in the last 14 days.
A threat actor may try to modify policies to weaken the security controls in place.
Investigate any change to ensure they are approved.
Ref: https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-infrastructure#conditional-access'
triggerThreshold: 0
name: Conditional Access Policy Modified by New User
relevantTechniques:
- T1078.004
tactics:
- DefenseEvasion
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Detections/AuditLogs/ConditionalAccessPolicyModifiedbyNewUser.yaml
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"workspace": {
"type": "String"
}
},
"resources": [
{
"id": "[concat(resourceId('Microsoft.OperationalInsights/workspaces/providers', parameters('workspace'), 'Microsoft.SecurityInsights'),'/alertRules/25a7f951-54b7-4cf5-9862-ebc04306c590')]",
"name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/25a7f951-54b7-4cf5-9862-ebc04306c590')]",
"type": "Microsoft.OperationalInsights/workspaces/providers/alertRules",
"kind": "Scheduled",
"apiVersion": "2022-11-01",
"properties": {
"displayName": "Conditional Access Policy Modified by New User",
"description": "'Detects a Conditional Access Policy being modified by a user who has not modified a policy in the last 14 days.\n A threat actor may try to modify policies to weaken the security controls in place.\n Investigate any change to ensure they are approved.\n Ref: https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-infrastructure#conditional-access'\n",
"severity": "Medium",
"enabled": true,
"query": "let known_users = (AuditLogs\n | where TimeGenerated between(ago(14d)..ago(1d))\n | where OperationName has \"conditional access policy\"\n | where Result =~ \"success\"\n | extend userPrincipalName = tostring(parse_json(tostring(InitiatedBy.user)).userPrincipalName)\n | summarize by userPrincipalName);\n AuditLogs\n | where TimeGenerated > ago(1d)\n | where OperationName has \"conditional access policy\"\n | where Result =~ \"success\"\n | extend userPrincipalName = tostring(parse_json(tostring(InitiatedBy.user)).userPrincipalName)\n | extend CAPolicyName = tostring(TargetResources[0].displayName)\n | extend ipAddress = tostring(parse_json(tostring(InitiatedBy.user)).ipAddress)\n | where userPrincipalName !in (known_users)\n | extend NewPolicyValues = TargetResources[0].modifiedProperties[0].newValue\n | extend OldPolicyValues = TargetResources[0].modifiedProperties[0].oldValue\n | project-reorder TimeGenerated, OperationName, CAPolicyName, userPrincipalName, ipAddress, NewPolicyValues, OldPolicyValues\n",
"queryFrequency": "P1D",
"queryPeriod": "P14D",
"triggerOperator": "GreaterThan",
"triggerThreshold": 0,
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"tactics": [
"DefenseEvasion"
],
"techniques": [
"T1078.004"
],
"alertRuleTemplateName": "25a7f951-54b7-4cf5-9862-ebc04306c590",
"customDetails": null,
"entityMappings": [
{
"entityType": "Account",
"fieldMappings": [
{
"identifier": "FullName",
"columnName": "userPrincipalName"
}
]
},
{
"entityType": "IP",
"fieldMappings": [
{
"identifier": "Address",
"columnName": "ipAddress"
}
]
}
],
"tags": [
"AADSecOpsGuide"
],
"OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Detections/AuditLogs/ConditionalAccessPolicyModifiedbyNewUser.yaml",
"templateVersion": "1.0.2"
}
}
]
}