Microsoft Sentinel Analytic Rules
cloudbrothers.infoAzure Sentinel RepoToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

Detection of Malware C2 Domains in Syslog Events

Back
Iddffd068f-fdab-440e-bbc0-34c14b623c89
RulenameDetection of Malware C2 Domains in Syslog Events
DescriptionIdentifies a match in Syslog from Recorded Future C2 DNS Name Domains Risklist.
SeverityMedium
TacticsCommandAndControl
Required data connectorsSyslog
KindScheduled
Query frequency1h
Query period1d
Trigger threshold0
Trigger operatorgt
Source Urihttps://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Recorded Future/Analytic Rules/RecordedFutureDomainMalwareC2inSyslogEvents.yaml
Version1.0.1
Arm templatedffd068f-fdab-440e-bbc0-34c14b623c89.json
Deploy To Azure
// Identifies a match in Syslog from the Recorded Future DOMAIN Malware C2 DNS Name 
let dt_lookBack = 1h;
let ioc_lookBack = 1d;
//Create a list of TLDs in our threat feed for later validation
let list_tlds = ThreatIntelligenceIndicator
| where TimeGenerated > ago(ioc_lookBack)
// Picking up only Recorded Future IOC's that are pertinent to the use case (Malware C2 Detection)
| where Description == 'Recorded Future - Domains - Command and Control Activity'
| where isnotempty(DomainName)
| extend parts = split(DomainName, '.')
| extend tld = parts[(array_length(parts)-1)]
| summarize count() by tostring(tld)
| summarize make_list(tld);
ThreatIntelligenceIndicator
| where TimeGenerated >= ago(ioc_lookBack) and ExpirationDateTime > now()
| where Active == true
// Picking up only Recorded Future IOC's that are pertinent to the use case (Malware C2 Detection)
| where Description == 'Recorded Future - Domains - Command and Control Activity'
// Picking up only IOC's that contain the entities we want
| where isnotempty(DomainName)
| join (
  Syslog
  | where TimeGenerated > ago(dt_lookBack)
  //Extract domain patterns from syslog message
  | extend domain = extract("(([a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z]{2,})",1, tolower(SyslogMessage))
  | where isnotempty(domain)
  | extend parts = split(domain, '.')
  //Split out the TLD
  | extend tld = parts[(array_length(parts)-1)]
  //Validate parsed domain by checking if the TLD is in the list of TLDs in our threat feed
  | where tld in~ (list_tlds)
  | extend Syslog_TimeGenerated = TimeGenerated
  ) 
on $left.DomainName==$right.domain
| where Syslog_TimeGenerated >= TimeGenerated and Syslog_TimeGenerated < ExpirationDateTime
| summarize LatestIndicatorTime = arg_max(TimeGenerated, *) by IndicatorId
| project LatestIndicatorTime, Description, ActivityGroupNames, IndicatorId, ThreatType, ExpirationDateTime, ConfidenceScore, Syslog_TimeGenerated, SyslogMessage, Computer, ProcessName, domain, HostIP, Url
| extend timestamp = Syslog_TimeGenerated, HostCustomEntity = Computer, IPCustomEntity = HostIP, URLCustomEntity = Url
queryFrequency: 1h
severity: Medium
id: dffd068f-fdab-440e-bbc0-34c14b623c89
status: Available
requiredDataConnectors:
- dataTypes:
  - Syslog
  connectorId: Syslog
kind: Scheduled
description: |
    'Identifies a match in Syslog from Recorded Future C2 DNS Name Domains Risklist.'
query: |
  // Identifies a match in Syslog from the Recorded Future DOMAIN Malware C2 DNS Name 
  let dt_lookBack = 1h;
  let ioc_lookBack = 1d;
  //Create a list of TLDs in our threat feed for later validation
  let list_tlds = ThreatIntelligenceIndicator
  | where TimeGenerated > ago(ioc_lookBack)
  // Picking up only Recorded Future IOC's that are pertinent to the use case (Malware C2 Detection)
  | where Description == 'Recorded Future - Domains - Command and Control Activity'
  | where isnotempty(DomainName)
  | extend parts = split(DomainName, '.')
  | extend tld = parts[(array_length(parts)-1)]
  | summarize count() by tostring(tld)
  | summarize make_list(tld);
  ThreatIntelligenceIndicator
  | where TimeGenerated >= ago(ioc_lookBack) and ExpirationDateTime > now()
  | where Active == true
  // Picking up only Recorded Future IOC's that are pertinent to the use case (Malware C2 Detection)
  | where Description == 'Recorded Future - Domains - Command and Control Activity'
  // Picking up only IOC's that contain the entities we want
  | where isnotempty(DomainName)
  | join (
    Syslog
    | where TimeGenerated > ago(dt_lookBack)
    //Extract domain patterns from syslog message
    | extend domain = extract("(([a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z]{2,})",1, tolower(SyslogMessage))
    | where isnotempty(domain)
    | extend parts = split(domain, '.')
    //Split out the TLD
    | extend tld = parts[(array_length(parts)-1)]
    //Validate parsed domain by checking if the TLD is in the list of TLDs in our threat feed
    | where tld in~ (list_tlds)
    | extend Syslog_TimeGenerated = TimeGenerated
    ) 
  on $left.DomainName==$right.domain
  | where Syslog_TimeGenerated >= TimeGenerated and Syslog_TimeGenerated < ExpirationDateTime
  | summarize LatestIndicatorTime = arg_max(TimeGenerated, *) by IndicatorId
  | project LatestIndicatorTime, Description, ActivityGroupNames, IndicatorId, ThreatType, ExpirationDateTime, ConfidenceScore, Syslog_TimeGenerated, SyslogMessage, Computer, ProcessName, domain, HostIP, Url
  | extend timestamp = Syslog_TimeGenerated, HostCustomEntity = Computer, IPCustomEntity = HostIP, URLCustomEntity = Url  
tactics:
- CommandAndControl
triggerThreshold: 0
triggerOperator: gt
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Recorded Future/Analytic Rules/RecordedFutureDomainMalwareC2inSyslogEvents.yaml
relevantTechniques: 
entityMappings:
- entityType: Host
  fieldMappings:
  - identifier: FullName
    columnName: HostCustomEntity
- entityType: IP
  fieldMappings:
  - identifier: Address
    columnName: IPCustomEntity
- entityType: URL
  fieldMappings:
  - identifier: Url
    columnName: URLCustomEntity
- entityType: DNS
  fieldMappings:
  - identifier: DomainName
    columnName: domain
version: 1.0.1
name: Detection of Malware C2 Domains in Syslog Events
queryPeriod: 1d
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "workspace": {
      "type": "String"
    }
  },
  "resources": [
    {
      "apiVersion": "2023-02-01-preview",
      "id": "[concat(resourceId('Microsoft.OperationalInsights/workspaces/providers', parameters('workspace'), 'Microsoft.SecurityInsights'),'/alertRules/dffd068f-fdab-440e-bbc0-34c14b623c89')]",
      "kind": "Scheduled",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/dffd068f-fdab-440e-bbc0-34c14b623c89')]",
      "properties": {
        "alertRuleTemplateName": "dffd068f-fdab-440e-bbc0-34c14b623c89",
        "customDetails": null,
        "description": "'Identifies a match in Syslog from Recorded Future C2 DNS Name Domains Risklist.'\n",
        "displayName": "Detection of Malware C2 Domains in Syslog Events",
        "enabled": true,
        "entityMappings": [
          {
            "entityType": "Host",
            "fieldMappings": [
              {
                "columnName": "HostCustomEntity",
                "identifier": "FullName"
              }
            ]
          },
          {
            "entityType": "IP",
            "fieldMappings": [
              {
                "columnName": "IPCustomEntity",
                "identifier": "Address"
              }
            ]
          },
          {
            "entityType": "URL",
            "fieldMappings": [
              {
                "columnName": "URLCustomEntity",
                "identifier": "Url"
              }
            ]
          },
          {
            "entityType": "DNS",
            "fieldMappings": [
              {
                "columnName": "domain",
                "identifier": "DomainName"
              }
            ]
          }
        ],
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Recorded Future/Analytic Rules/RecordedFutureDomainMalwareC2inSyslogEvents.yaml",
        "query": "// Identifies a match in Syslog from the Recorded Future DOMAIN Malware C2 DNS Name \nlet dt_lookBack = 1h;\nlet ioc_lookBack = 1d;\n//Create a list of TLDs in our threat feed for later validation\nlet list_tlds = ThreatIntelligenceIndicator\n| where TimeGenerated > ago(ioc_lookBack)\n// Picking up only Recorded Future IOC's that are pertinent to the use case (Malware C2 Detection)\n| where Description == 'Recorded Future - Domains - Command and Control Activity'\n| where isnotempty(DomainName)\n| extend parts = split(DomainName, '.')\n| extend tld = parts[(array_length(parts)-1)]\n| summarize count() by tostring(tld)\n| summarize make_list(tld);\nThreatIntelligenceIndicator\n| where TimeGenerated >= ago(ioc_lookBack) and ExpirationDateTime > now()\n| where Active == true\n// Picking up only Recorded Future IOC's that are pertinent to the use case (Malware C2 Detection)\n| where Description == 'Recorded Future - Domains - Command and Control Activity'\n// Picking up only IOC's that contain the entities we want\n| where isnotempty(DomainName)\n| join (\n  Syslog\n  | where TimeGenerated > ago(dt_lookBack)\n  //Extract domain patterns from syslog message\n  | extend domain = extract(\"(([a-z0-9]+(-[a-z0-9]+)*\\\\.)+[a-z]{2,})\",1, tolower(SyslogMessage))\n  | where isnotempty(domain)\n  | extend parts = split(domain, '.')\n  //Split out the TLD\n  | extend tld = parts[(array_length(parts)-1)]\n  //Validate parsed domain by checking if the TLD is in the list of TLDs in our threat feed\n  | where tld in~ (list_tlds)\n  | extend Syslog_TimeGenerated = TimeGenerated\n  ) \non $left.DomainName==$right.domain\n| where Syslog_TimeGenerated >= TimeGenerated and Syslog_TimeGenerated < ExpirationDateTime\n| summarize LatestIndicatorTime = arg_max(TimeGenerated, *) by IndicatorId\n| project LatestIndicatorTime, Description, ActivityGroupNames, IndicatorId, ThreatType, ExpirationDateTime, ConfidenceScore, Syslog_TimeGenerated, SyslogMessage, Computer, ProcessName, domain, HostIP, Url\n| extend timestamp = Syslog_TimeGenerated, HostCustomEntity = Computer, IPCustomEntity = HostIP, URLCustomEntity = Url\n",
        "queryFrequency": "PT1H",
        "queryPeriod": "P1D",
        "severity": "Medium",
        "status": "Available",
        "suppressionDuration": "PT1H",
        "suppressionEnabled": false,
        "tactics": [
          "CommandAndControl"
        ],
        "techniques": null,
        "templateVersion": "1.0.1",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}