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 |
Required data connectors | 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.0 |
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
| extend TI_ipEntity = NetworkIP
| 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.TI_ipEntity == $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, TI_ipEntity, Computer, EventId, SubType, ClientIP, Name, IPAddresses, NetworkIP, Description, AdditionalInformation
| extend timestamp = DNS_TimeGenerated, IPCustomEntity = ClientIP, HostCustomEntity = Computer, URLCustomEntity = Url
kind: Scheduled
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Recorded Future/Analytic Rules/RecordedFutureIPMalwareC2inDNSEvents.yaml
severity: Medium
name: Detection of Malware C2 IPs in DNS Events
entityMappings:
- entityType: Host
fieldMappings:
- columnName: HostCustomEntity
identifier: FullName
- entityType: IP
fieldMappings:
- columnName: IPCustomEntity
identifier: Address
- entityType: URL
fieldMappings:
- columnName: URLCustomEntity
identifier: Url
- entityType: IP
fieldMappings:
- columnName: TI_ipEntity
identifier: Address
relevantTechniques:
queryFrequency: 1h
triggerThreshold: 0
queryPeriod: 1d
description: |
'Identifies a match in DnsEvents from Recorded Future Actively Communicating C&C Server Risklist.'
id: 22cc1dff-14ad-481d-97e1-0602895e429e
version: 1.0.0
tactics:
- CommandAndControl
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
| extend TI_ipEntity = NetworkIP
| 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.TI_ipEntity == $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, TI_ipEntity, Computer, EventId, SubType, ClientIP, Name, IPAddresses, NetworkIP, Description, AdditionalInformation
| extend timestamp = DNS_TimeGenerated, IPCustomEntity = ClientIP, HostCustomEntity = Computer, URLCustomEntity = Url
status: Available
requiredDataConnectors:
- dataTypes:
- DnsEvents
connectorId: DNS
triggerOperator: gt
{
"$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/22cc1dff-14ad-481d-97e1-0602895e429e')]",
"name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/22cc1dff-14ad-481d-97e1-0602895e429e')]",
"type": "Microsoft.OperationalInsights/workspaces/providers/alertRules",
"kind": "Scheduled",
"apiVersion": "2022-11-01-preview",
"properties": {
"displayName": "Detection of Malware C2 IPs in DNS Events",
"description": "'Identifies a match in DnsEvents from Recorded Future Actively Communicating C&C Server Risklist.'\n",
"severity": "Medium",
"enabled": true,
"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| extend TI_ipEntity = NetworkIP\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.TI_ipEntity == $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, TI_ipEntity, Computer, EventId, SubType, ClientIP, Name, IPAddresses, NetworkIP, Description, AdditionalInformation\n| extend timestamp = DNS_TimeGenerated, IPCustomEntity = ClientIP, HostCustomEntity = Computer, URLCustomEntity = Url\n",
"queryFrequency": "PT1H",
"queryPeriod": "P1D",
"triggerOperator": "GreaterThan",
"triggerThreshold": 0,
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"tactics": [
"CommandAndControl"
],
"techniques": null,
"alertRuleTemplateName": "22cc1dff-14ad-481d-97e1-0602895e429e",
"customDetails": null,
"entityMappings": [
{
"entityType": "Host",
"fieldMappings": [
{
"identifier": "FullName",
"columnName": "HostCustomEntity"
}
]
},
{
"entityType": "IP",
"fieldMappings": [
{
"identifier": "Address",
"columnName": "IPCustomEntity"
}
]
},
{
"entityType": "URL",
"fieldMappings": [
{
"identifier": "Url",
"columnName": "URLCustomEntity"
}
]
},
{
"entityType": "IP",
"fieldMappings": [
{
"identifier": "Address",
"columnName": "TI_ipEntity"
}
]
}
],
"OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Recorded Future/Analytic Rules/RecordedFutureIPMalwareC2inDNSEvents.yaml",
"status": "Available",
"templateVersion": "1.0.0"
}
}
]
}