Detection of Malware C2 IPs in DNS Events
Id | 22cc1dff-14ad-481d-97e1-0602895e429e |
Rulename | Detection of Malware C2 IPs in DNS Events |
Description | Identifies a match in DnsEvents from Recorded Future Actively Communicating C&C Server Risklist. |
Severity | Medium |
Tactics | CommandAndControl |
Techniques | T1071 |
Required data connectors | ASimDnsActivityLogs DNS |
Kind | Scheduled |
Query frequency | 1h |
Query period | 1d |
Trigger threshold | 0 |
Trigger operator | gt |
Source Uri | https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Recorded Future/Analytic Rules/RecordedFutureIPMalwareC2inDNSEvents.yaml |
Version | 1.0.3 |
Arm template | 22cc1dff-14ad-481d-97e1-0602895e429e.json |
// Identifies a match in DnsEvent from the Recorded Future C2 Malware Detection IPs (Actively Communicating C&C Server RiskList)
let dt_lookBack = 1h;
let ioc_lookBack = 1d;
ThreatIntelligenceIndicator
// Picking up only Recorded Future IOC's that are pertinent to the use case (Malware C2 Detection)
| where Description == "Recorded Future - IP - Actively Communicating C&C Server"
| where TimeGenerated >= ago(ioc_lookBack) and ExpirationDateTime > now()
| where Active == true
| join (
DnsEvents | where TimeGenerated >= ago(dt_lookBack)
| where SubType =~ "LookupQuery" and isnotempty(IPAddresses)
| extend SingleIP = split(IPAddresses, ",")
| mvexpand SingleIP
| extend SingleIP = tostring(SingleIP)
// renaming time column so it is clear the log this came from
| extend DNS_TimeGenerated = TimeGenerated
)
on $left.NetworkIP == $right.SingleIP
| where DNS_TimeGenerated >= TimeGenerated and DNS_TimeGenerated < ExpirationDateTime
| summarize LatestIndicatorTime = arg_max(TimeGenerated, *) by IndicatorId
| project LatestIndicatorTime, ActivityGroupNames, IndicatorId, ThreatType, Url, ExpirationDateTime, ConfidenceScore, DNS_TimeGenerated, Computer, EventId, SubType, ClientIP, Name, IPAddresses, NetworkIP, Description, AdditionalInformation
| extend HostName = tostring(split(Computer, ".")[0]), DomainIndex = toint(indexof(Computer, '.'))
| extend HostNameDomain = iff(DomainIndex != -1, substring(Computer, DomainIndex + 1), Computer)
relevantTechniques:
- T1071
name: Detection of Malware C2 IPs in DNS Events
requiredDataConnectors:
- dataTypes:
- DnsEvents
connectorId: DNS
- dataTypes:
- DnsEvents
connectorId: ASimDnsActivityLogs
entityMappings:
- fieldMappings:
- identifier: FullName
columnName: Computer
- identifier: HostName
columnName: HostName
- identifier: DnsDomain
columnName: HostNameDomain
entityType: Host
- fieldMappings:
- identifier: Address
columnName: ClientIP
entityType: IP
- fieldMappings:
- identifier: Url
columnName: Url
entityType: URL
- fieldMappings:
- identifier: Address
columnName: NetworkIP
entityType: IP
triggerThreshold: 0
id: 22cc1dff-14ad-481d-97e1-0602895e429e
tactics:
- CommandAndControl
version: 1.0.3
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Recorded Future/Analytic Rules/RecordedFutureIPMalwareC2inDNSEvents.yaml
queryPeriod: 1d
kind: Scheduled
queryFrequency: 1h
severity: Medium
status: Available
description: |
'Identifies a match in DnsEvents from Recorded Future Actively Communicating C&C Server Risklist.'
query: |
// Identifies a match in DnsEvent from the Recorded Future C2 Malware Detection IPs (Actively Communicating C&C Server RiskList)
let dt_lookBack = 1h;
let ioc_lookBack = 1d;
ThreatIntelligenceIndicator
// Picking up only Recorded Future IOC's that are pertinent to the use case (Malware C2 Detection)
| where Description == "Recorded Future - IP - Actively Communicating C&C Server"
| where TimeGenerated >= ago(ioc_lookBack) and ExpirationDateTime > now()
| where Active == true
| join (
DnsEvents | where TimeGenerated >= ago(dt_lookBack)
| where SubType =~ "LookupQuery" and isnotempty(IPAddresses)
| extend SingleIP = split(IPAddresses, ",")
| mvexpand SingleIP
| extend SingleIP = tostring(SingleIP)
// renaming time column so it is clear the log this came from
| extend DNS_TimeGenerated = TimeGenerated
)
on $left.NetworkIP == $right.SingleIP
| where DNS_TimeGenerated >= TimeGenerated and DNS_TimeGenerated < ExpirationDateTime
| summarize LatestIndicatorTime = arg_max(TimeGenerated, *) by IndicatorId
| project LatestIndicatorTime, ActivityGroupNames, IndicatorId, ThreatType, Url, ExpirationDateTime, ConfidenceScore, DNS_TimeGenerated, Computer, EventId, SubType, ClientIP, Name, IPAddresses, NetworkIP, Description, AdditionalInformation
| extend HostName = tostring(split(Computer, ".")[0]), DomainIndex = toint(indexof(Computer, '.'))
| extend HostNameDomain = iff(DomainIndex != -1, substring(Computer, DomainIndex + 1), Computer)
triggerOperator: gt
{
"$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/22cc1dff-14ad-481d-97e1-0602895e429e')]",
"kind": "Scheduled",
"name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/22cc1dff-14ad-481d-97e1-0602895e429e')]",
"properties": {
"alertRuleTemplateName": "22cc1dff-14ad-481d-97e1-0602895e429e",
"customDetails": null,
"description": "'Identifies a match in DnsEvents from Recorded Future Actively Communicating C&C Server Risklist.'\n",
"displayName": "Detection of Malware C2 IPs in DNS Events",
"enabled": true,
"entityMappings": [
{
"entityType": "Host",
"fieldMappings": [
{
"columnName": "Computer",
"identifier": "FullName"
},
{
"columnName": "HostName",
"identifier": "HostName"
},
{
"columnName": "HostNameDomain",
"identifier": "DnsDomain"
}
]
},
{
"entityType": "IP",
"fieldMappings": [
{
"columnName": "ClientIP",
"identifier": "Address"
}
]
},
{
"entityType": "URL",
"fieldMappings": [
{
"columnName": "Url",
"identifier": "Url"
}
]
},
{
"entityType": "IP",
"fieldMappings": [
{
"columnName": "NetworkIP",
"identifier": "Address"
}
]
}
],
"OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Recorded Future/Analytic Rules/RecordedFutureIPMalwareC2inDNSEvents.yaml",
"query": "// Identifies a match in DnsEvent from the Recorded Future C2 Malware Detection IPs (Actively Communicating C&C Server RiskList)\nlet dt_lookBack = 1h;\nlet ioc_lookBack = 1d;\nThreatIntelligenceIndicator\n// Picking up only Recorded Future IOC's that are pertinent to the use case (Malware C2 Detection)\n| where Description == \"Recorded Future - IP - Actively Communicating C&C Server\"\n| where TimeGenerated >= ago(ioc_lookBack) and ExpirationDateTime > now()\n| where Active == true\n| join (\n DnsEvents | where TimeGenerated >= ago(dt_lookBack)\n | where SubType =~ \"LookupQuery\" and isnotempty(IPAddresses)\n | extend SingleIP = split(IPAddresses, \",\")\n | mvexpand SingleIP\n | extend SingleIP = tostring(SingleIP)\n // renaming time column so it is clear the log this came from\n | extend DNS_TimeGenerated = TimeGenerated\n )\non $left.NetworkIP == $right.SingleIP\n| where DNS_TimeGenerated >= TimeGenerated and DNS_TimeGenerated < ExpirationDateTime\n| summarize LatestIndicatorTime = arg_max(TimeGenerated, *) by IndicatorId\n| project LatestIndicatorTime, ActivityGroupNames, IndicatorId, ThreatType, Url, ExpirationDateTime, ConfidenceScore, DNS_TimeGenerated, Computer, EventId, SubType, ClientIP, Name, IPAddresses, NetworkIP, Description, AdditionalInformation\n| extend HostName = tostring(split(Computer, \".\")[0]), DomainIndex = toint(indexof(Computer, '.'))\n| extend HostNameDomain = iff(DomainIndex != -1, substring(Computer, DomainIndex + 1), Computer)\n",
"queryFrequency": "PT1H",
"queryPeriod": "P1D",
"severity": "Medium",
"status": "Available",
"subTechniques": [],
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"tactics": [
"CommandAndControl"
],
"techniques": [
"T1071"
],
"templateVersion": "1.0.3",
"triggerOperator": "GreaterThan",
"triggerThreshold": 0
},
"type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
}
]
}