{
  "$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/374a77f4-23ed-55dc-8441-8e47a1e079e9')]",
      "kind": "Scheduled",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/374a77f4-23ed-55dc-8441-8e47a1e079e9')]",
      "properties": {
        "alertRuleTemplateName": "374a77f4-23ed-55dc-8441-8e47a1e079e9",
        "customDetails": {
          "CoHostedCount": "cohostedCount",
          "MalwareCoHostCount": "malwareCoHostCount",
          "MaxThreatScore": "maxThreatScore"
        },
        "description": "Identifies IP addresses that host multiple domains associated with malware. When an IP has more than 3 co-hosted domains and at least 3 of those domains are flagged as malware by Whisper threat intelligence, it strongly indicates compromised or adversary-controlled infrastructure.\n",
        "displayName": "Whisper Security - Co-Hosted Malware Cluster Detection",
        "enabled": true,
        "entityMappings": [
          {
            "entityType": "DNS",
            "fieldMappings": [
              {
                "columnName": "DnsDomain",
                "identifier": "DomainName"
              }
            ]
          },
          {
            "entityType": "IP",
            "fieldMappings": [
              {
                "columnName": "IPAddress",
                "identifier": "Address"
              }
            ]
          }
        ],
        "incidentConfiguration": {
          "createIncident": true,
          "groupingConfiguration": {
            "enabled": true,
            "lookbackDuration": "PT5H",
            "matchingMethod": "AllEntities",
            "reopenClosedIncident": false
          }
        },
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Whisper/Analytic%20Rules/CoHostedMalwareCluster.yaml",
        "query": "// MITRE ATT&CK: T1584.001 - Compromise Infrastructure: Domains\n// Tactic: Resource Development\n// Detects clusters of malware-hosting domains sharing the same IP infrastructure\nlet minCohostedCount = 3;\nlet minMalwareCoHosts = 3;\nlet cohostedInfra = WhisperInfraContext_CL\n    | where TimeGenerated > ago(1d)\n    | where cohostedCount > minCohostedCount\n    | extend parsedIp = tostring(split(ipAddresses, \",\")[0])\n    | project indicator, parsedIp, cohostedCount, countries, registrar;\nlet malwareIndicators = WhisperThreatIntel_CL\n    | where TimeGenerated > ago(1d)\n    | where isMalware == true\n    | project indicator, threatScore, threatLevel, feedNames;\ncohostedInfra\n    | join kind=inner (malwareIndicators) on indicator\n    | summarize malwareCoHostCount = dcount(indicator), DnsDomains = make_set(indicator, 10), avgThreatScore = avg(threatScore), maxThreatScore = max(threatScore) by parsedIp, cohostedCount, countries, registrar\n    | where malwareCoHostCount >= minMalwareCoHosts\n    | extend DnsDomain = tostring(DnsDomains[0]), IPAddress = parsedIp\n    | project TimeGenerated = now(), DnsDomain, IPAddress, malwareCoHostCount, cohostedCount, avgThreatScore, maxThreatScore, countries, registrar, DnsDomains\n",
        "queryFrequency": "PT1H",
        "queryPeriod": "P1D",
        "severity": "High",
        "status": "Available",
        "subTechniques": [],
        "suppressionDuration": "PT1H",
        "suppressionEnabled": false,
        "tactics": [
          "ResourceDevelopment"
        ],
        "techniques": [
          "T1584"
        ],
        "templateVersion": "1.0.0",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}
