Azure Diagnostic settings removed from a resource
Id | 6e95aef3-a1e0-4063-8e74-cd59aa59f245 |
Rulename | Azure Diagnostic settings removed from a resource |
Description | This query looks for diagnostic settings that are removed from a resource. This could indicate an attacker or malicious internal trying to evade detection before malicious act is performed. If the diagnostic settings are being deleted as part of a parent resource deletion, the event is ignores. |
Severity | Medium |
Tactics | DefenseEvasion |
Techniques | T1562.008 |
Required data connectors | AzureActivity |
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/AzureActivity/AzDiagSettingsDeleted.yaml |
Version | 1.0.1 |
Arm template | 6e95aef3-a1e0-4063-8e74-cd59aa59f245.json |
AzureActivity
| where OperationNameValue == 'MICROSOFT.INSIGHTS/DIAGNOSTICSETTINGS/DELETE' and ActivityStatusValue == "Start"
| extend ParentResource_a = split(_ResourceId,"/")
| extend ParentResourceLength = array_length(ParentResource_a)-4
| extend ParentResourceSplit = array_split(ParentResource_a,ParentResourceLength)
| extend resource = strcat_array(ParentResourceSplit[0],"/")
| project Diagdelete = TimeGenerated, Caller, ResourceProviderValue, _ResourceId, SubscriptionId, ResourceGroup, OperationNameValue, ActivityStatusValue, ActivitySubstatusValue, Start=TimeGenerated, resource, CallerIpAddress
| join kind=leftanti ( AzureActivity
| where OperationNameValue != 'MICROSOFT.INSIGHTS/DIAGNOSTICSETTINGS/DELETE' and OperationNameValue endswith "/DELETE"
| where ActivityStatusValue == 'Start'
| project Caller, ResourceProviderValue, resource = tostring(parse_json(Properties).resource), SubscriptionId, ResourceGroup, OperationNameValue, ActivityStatusValue, ActivitySubstatusValue, Start=TimeGenerated) on $left.resource == $right.resource
| project Caller, ResourceProviderValue, resource, SubscriptionId, ResourceGroup, OperationNameValue, ActivityStatusValue, ActivitySubstatusValue, Start, CallerIpAddress
tactics:
- DefenseEvasion
severity: Medium
requiredDataConnectors:
- connectorId: AzureActivity
dataTypes:
- AzureActivity
triggerOperator: gt
query: |
AzureActivity
| where OperationNameValue == 'MICROSOFT.INSIGHTS/DIAGNOSTICSETTINGS/DELETE' and ActivityStatusValue == "Start"
| extend ParentResource_a = split(_ResourceId,"/")
| extend ParentResourceLength = array_length(ParentResource_a)-4
| extend ParentResourceSplit = array_split(ParentResource_a,ParentResourceLength)
| extend resource = strcat_array(ParentResourceSplit[0],"/")
| project Diagdelete = TimeGenerated, Caller, ResourceProviderValue, _ResourceId, SubscriptionId, ResourceGroup, OperationNameValue, ActivityStatusValue, ActivitySubstatusValue, Start=TimeGenerated, resource, CallerIpAddress
| join kind=leftanti ( AzureActivity
| where OperationNameValue != 'MICROSOFT.INSIGHTS/DIAGNOSTICSETTINGS/DELETE' and OperationNameValue endswith "/DELETE"
| where ActivityStatusValue == 'Start'
| project Caller, ResourceProviderValue, resource = tostring(parse_json(Properties).resource), SubscriptionId, ResourceGroup, OperationNameValue, ActivityStatusValue, ActivitySubstatusValue, Start=TimeGenerated) on $left.resource == $right.resource
| project Caller, ResourceProviderValue, resource, SubscriptionId, ResourceGroup, OperationNameValue, ActivityStatusValue, ActivitySubstatusValue, Start, CallerIpAddress
triggerThreshold: 0
name: Azure Diagnostic settings removed from a resource
kind: Scheduled
version: 1.0.1
relevantTechniques:
- T1562.008
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Detections/AzureActivity/AzDiagSettingsDeleted.yaml
description: |
'This query looks for diagnostic settings that are removed from a resource.
This could indicate an attacker or malicious internal trying to evade detection before malicious act is performed.
If the diagnostic settings are being deleted as part of a parent resource deletion, the event is ignores.'
entityMappings:
- entityType: Account
fieldMappings:
- identifier: Name
columnName: Caller
- entityType: IP
fieldMappings:
- identifier: Address
columnName: CallerIpAddress
queryFrequency: 1h
queryPeriod: 2h
metadata:
support:
tier: Community
categories:
domains:
- Security - Others
- Platform
source:
kind: Community
author:
name: KennethMLdk
id: 6e95aef3-a1e0-4063-8e74-cd59aa59f245
{
"$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/6e95aef3-a1e0-4063-8e74-cd59aa59f245')]",
"name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/6e95aef3-a1e0-4063-8e74-cd59aa59f245')]",
"type": "Microsoft.OperationalInsights/workspaces/providers/alertRules",
"kind": "Scheduled",
"apiVersion": "2022-11-01",
"properties": {
"displayName": "Azure Diagnostic settings removed from a resource",
"description": "'This query looks for diagnostic settings that are removed from a resource.\nThis could indicate an attacker or malicious internal trying to evade detection before malicious act is performed.\nIf the diagnostic settings are being deleted as part of a parent resource deletion, the event is ignores.'\n",
"severity": "Medium",
"enabled": true,
"query": "AzureActivity\n | where OperationNameValue == 'MICROSOFT.INSIGHTS/DIAGNOSTICSETTINGS/DELETE' and ActivityStatusValue == \"Start\"\n | extend ParentResource_a = split(_ResourceId,\"/\")\n | extend ParentResourceLength = array_length(ParentResource_a)-4\n | extend ParentResourceSplit = array_split(ParentResource_a,ParentResourceLength)\n | extend resource = strcat_array(ParentResourceSplit[0],\"/\")\n | project Diagdelete = TimeGenerated, Caller, ResourceProviderValue, _ResourceId, SubscriptionId, ResourceGroup, OperationNameValue, ActivityStatusValue, ActivitySubstatusValue, Start=TimeGenerated, resource, CallerIpAddress\n | join kind=leftanti ( AzureActivity\n | where OperationNameValue != 'MICROSOFT.INSIGHTS/DIAGNOSTICSETTINGS/DELETE' and OperationNameValue endswith \"/DELETE\"\n | where ActivityStatusValue == 'Start'\n | project Caller, ResourceProviderValue, resource = tostring(parse_json(Properties).resource), SubscriptionId, ResourceGroup, OperationNameValue, ActivityStatusValue, ActivitySubstatusValue, Start=TimeGenerated) on $left.resource == $right.resource\n | project Caller, ResourceProviderValue, resource, SubscriptionId, ResourceGroup, OperationNameValue, ActivityStatusValue, ActivitySubstatusValue, Start, CallerIpAddress\n",
"queryFrequency": "PT1H",
"queryPeriod": "PT2H",
"triggerOperator": "GreaterThan",
"triggerThreshold": 0,
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"tactics": [
"DefenseEvasion"
],
"techniques": [
"T1562.008"
],
"alertRuleTemplateName": "6e95aef3-a1e0-4063-8e74-cd59aa59f245",
"customDetails": null,
"entityMappings": [
{
"fieldMappings": [
{
"columnName": "Caller",
"identifier": "Name"
}
],
"entityType": "Account"
},
{
"fieldMappings": [
{
"columnName": "CallerIpAddress",
"identifier": "Address"
}
],
"entityType": "IP"
}
],
"OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Detections/AzureActivity/AzDiagSettingsDeleted.yaml",
"templateVersion": "1.0.1"
}
}
]
}