Detect DNS queries reporting multiple errors from different clients - Static threshold based (ASIM DNS Solution)
Id | 5b8344eb-fa28-4ac3-bcff-bc19d5d63089 |
Rulename | Detect DNS queries reporting multiple errors from different clients - Static threshold based (ASIM DNS Solution) |
Description | This rule creates an alert when multiple clients report errors for the same DNS query. This helps in identifying possible similar C2 communications originating from different clients.\n\nIt utilizes ASIM normalization and is applied to any source that supports the ASIM DNS schema. |
Severity | Medium |
Tactics | CommandAndControl |
Techniques | T1568 T1573 T1008 |
Required data connectors | AIVectraStream ASimDnsActivityLogs AzureFirewall CiscoUmbrellaDataConnector Corelight DNS GCPDNSDataConnector InfobloxNIOS ISCBind NXLogDnsLogs WindowsForwardedEvents Zscaler |
Kind | Scheduled |
Query frequency | 1h |
Query period | 1h |
Trigger threshold | 0 |
Trigger operator | gt |
Source Uri | https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/DNS Essentials/Analytic Rules/MultipleErrorsReportedForSameDNSQueryStaticThresholdBased.yaml |
Version | 1.0.0 |
Arm template | 5b8344eb-fa28-4ac3-bcff-bc19d5d63089.json |
let lookback=1h;
let threshold = materialize (_GetWatchlist('DNS_Solution_Monitoring_Configuration')
| where wl_RuleName == 'Multiple errors reported for same DNSQuery' and wl_Type == 'Detection'
| project toint(wl_Threshold));
let errors = dynamic(['NXDOMAIN', 'SERVFAIL', 'REFUSED']);
_Im_Dns(starttime=ago(lookback))
| where EventResultDetails has_any (errors)
| summarize SrcIPs = make_set(SrcIpAddr, 100) by DnsQuery, bin(TimeGenerated, 10min)
| where array_length(SrcIPs) >= toscalar(threshold)
| extend TotalIPs = array_length(SrcIPs),IPCountthreshold = toscalar(threshold)
queryFrequency: 1h
alertDetailsOverride:
alertDisplayNameFormat: "[Static threshold] Multiple errors for the same DNS query has been detected - '{{DnsQuery}}'"
alertDescriptionFormat: |-
Multiple errors were detected on different clients for the same DNS query. These unsuccessful responses can be an indication of C2 communication.
Threshold for total clients reporting errors: '{{IPCountthreshold}}'
Current count of clients reporting errors for this DNS query: '{{TotalIPs}}'
Clients requesting this DNSQuery include:
'{{SrcIPs}}'
triggerOperator: gt
tactics:
- CommandAndControl
description: |
'This rule creates an alert when multiple clients report errors for the same DNS query. This helps in identifying possible similar C2 communications originating from different clients.\n\nIt utilizes [ASIM](https://aka.ms/AboutASIM) normalization and is applied to any source that supports the ASIM DNS schema.'
eventGroupingSettings:
aggregationKind: AlertPerResult
status: Available
relevantTechniques:
- T1568
- T1573
- T1008
name: Detect DNS queries reporting multiple errors from different clients - Static threshold based (ASIM DNS Solution)
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/DNS Essentials/Analytic Rules/MultipleErrorsReportedForSameDNSQueryStaticThresholdBased.yaml
severity: Medium
triggerThreshold: 0
version: 1.0.0
entityMappings:
- entityType: DNS
fieldMappings:
- identifier: DomainName
columnName: DnsQuery
tags:
- Schema: ASimDns
SchemaVersion: 0.1.6
customDetails:
TotalIPs: TotalIPs
SrcIPs: SrcIPs
IPCountthreshold: IPCountthreshold
id: 5b8344eb-fa28-4ac3-bcff-bc19d5d63089
requiredDataConnectors:
- connectorId: ASimDnsActivityLogs
dataTypes:
- ASimDnsActivityLogs
- connectorId: GCPDNSDataConnector
dataTypes:
- GCP_DNS_CL
- connectorId: AzureFirewall
dataTypes:
- AzureDiagnostics
- connectorId: CiscoUmbrellaDataConnector
dataTypes:
- Cisco_Umbrella_proxy_CL
- connectorId: Corelight
dataTypes:
- Corelight_CL
- connectorId: InfobloxNIOS
dataTypes:
- Syslog
- connectorId: NXLogDnsLogs
dataTypes:
- NXLog_DNS_Server_CL
- connectorId: DNS
dataTypes:
- DnsEvents
- connectorId: AIVectraStream
dataTypes:
- VectraStream_CL
- connectorId: WindowsForwardedEvents
dataTypes:
- WindowsEvents
- connectorId: Zscaler
dataTypes:
- CommonSecurityLog
- connectorId: ISCBind
dataTypes:
- Syslog
kind: Scheduled
query: |
let lookback=1h;
let threshold = materialize (_GetWatchlist('DNS_Solution_Monitoring_Configuration')
| where wl_RuleName == 'Multiple errors reported for same DNSQuery' and wl_Type == 'Detection'
| project toint(wl_Threshold));
let errors = dynamic(['NXDOMAIN', 'SERVFAIL', 'REFUSED']);
_Im_Dns(starttime=ago(lookback))
| where EventResultDetails has_any (errors)
| summarize SrcIPs = make_set(SrcIpAddr, 100) by DnsQuery, bin(TimeGenerated, 10min)
| where array_length(SrcIPs) >= toscalar(threshold)
| extend TotalIPs = array_length(SrcIPs),IPCountthreshold = toscalar(threshold)
queryPeriod: 1h
{
"$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/5b8344eb-fa28-4ac3-bcff-bc19d5d63089')]",
"name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/5b8344eb-fa28-4ac3-bcff-bc19d5d63089')]",
"type": "Microsoft.OperationalInsights/workspaces/providers/alertRules",
"kind": "Scheduled",
"apiVersion": "2022-11-01",
"properties": {
"displayName": "Detect DNS queries reporting multiple errors from different clients - Static threshold based (ASIM DNS Solution)",
"description": "'This rule creates an alert when multiple clients report errors for the same DNS query. This helps in identifying possible similar C2 communications originating from different clients.\\n\\nIt utilizes [ASIM](https://aka.ms/AboutASIM) normalization and is applied to any source that supports the ASIM DNS schema.'\n",
"severity": "Medium",
"enabled": true,
"query": "let lookback=1h;\nlet threshold = materialize (_GetWatchlist('DNS_Solution_Monitoring_Configuration')\n | where wl_RuleName == 'Multiple errors reported for same DNSQuery' and wl_Type == 'Detection'\n | project toint(wl_Threshold));\nlet errors = dynamic(['NXDOMAIN', 'SERVFAIL', 'REFUSED']);\n_Im_Dns(starttime=ago(lookback))\n | where EventResultDetails has_any (errors)\n | summarize SrcIPs = make_set(SrcIpAddr, 100) by DnsQuery, bin(TimeGenerated, 10min)\n | where array_length(SrcIPs) >= toscalar(threshold)\n | extend TotalIPs = array_length(SrcIPs),IPCountthreshold = toscalar(threshold)\n",
"queryFrequency": "PT1H",
"queryPeriod": "PT1H",
"triggerOperator": "GreaterThan",
"triggerThreshold": 0,
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"tactics": [
"CommandAndControl"
],
"techniques": [
"T1568",
"T1573",
"T1008"
],
"alertRuleTemplateName": "5b8344eb-fa28-4ac3-bcff-bc19d5d63089",
"eventGroupingSettings": {
"aggregationKind": "AlertPerResult"
},
"alertDetailsOverride": {
"alertDisplayNameFormat": "[Static threshold] Multiple errors for the same DNS query has been detected - '{{DnsQuery}}'",
"alertDescriptionFormat": "Multiple errors were detected on different clients for the same DNS query. These unsuccessful responses can be an indication of C2 communication. \n\nThreshold for total clients reporting errors: '{{IPCountthreshold}}'\n\nCurrent count of clients reporting errors for this DNS query: '{{TotalIPs}}'\n\nClients requesting this DNSQuery include:\n\n'{{SrcIPs}}'"
},
"customDetails": {
"TotalIPs": "TotalIPs",
"SrcIPs": "SrcIPs",
"IPCountthreshold": "IPCountthreshold"
},
"entityMappings": [
{
"entityType": "DNS",
"fieldMappings": [
{
"identifier": "DomainName",
"columnName": "DnsQuery"
}
]
}
],
"status": "Available",
"templateVersion": "1.0.0",
"tags": [
{
"Schema": "ASimDns",
"SchemaVersion": "0.1.6"
}
],
"OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/DNS Essentials/Analytic Rules/MultipleErrorsReportedForSameDNSQueryStaticThresholdBased.yaml"
}
}
]
}