{
  "$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/59246163-4cc0-4e96-a0f0-f098a83cf425')]",
      "kind": "Scheduled",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/59246163-4cc0-4e96-a0f0-f098a83cf425')]",
      "properties": {
        "alertRuleTemplateName": "59246163-4cc0-4e96-a0f0-f098a83cf425",
        "customDetails": null,
        "description": "A single device is generating an unusually high volume of threat-intel-matched (IOC) blocks in a short window. This pattern is more consistent with malware/beaconing behavior than manual browsing and should be investigated for device compromise. Note: the 5-per-hour threshold below is a starting point based on limited sample data - tune it once a real baseline is established.\n",
        "displayName": "CTE - Compromised Device Suspected (High-Volume IOC Blocks)",
        "enabled": true,
        "entityMappings": [
          {
            "entityType": "Host",
            "fieldMappings": [
              {
                "columnName": "HostName",
                "identifier": "HostName"
              }
            ]
          },
          {
            "entityType": "URL",
            "fieldMappings": [
              {
                "columnName": "Url",
                "identifier": "Url"
              }
            ]
          },
          {
            "entityType": "IP",
            "fieldMappings": [
              {
                "columnName": "ClientIp",
                "identifier": "Address"
              }
            ]
          }
        ],
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Cybereinforce/Analytic%20Rules/CompromisedDeviceSuspectedHighVolumeIOCBlocks.yaml",
        "query": "CybereinforceCTE_CL\n| where EventType == \"block.url\"\n| extend d = parse_json(Details)\n| extend\n    DeviceId = tostring(d.deviceId),\n    HostName = iff(isnotempty(tostring(d.hostname)), tostring(d.hostname), strcat(\"cte-device-\", substring(EntityId, 0, 8))),\n    DeviceUser = tostring(d.deviceUser),\n    DeviceOs = tostring(d.deviceOs),\n    DeviceVersion = tostring(d.deviceVersion),\n    Url = tostring(d.url),\n    IsIoc = tobool(d.ioc),\n    ClientIp = tostring(split(tostring(d.clientIp), \":\")[0])\n| where IsIoc == true\n| summarize IOC_BlockCount=count(), SampleUrls=make_set(Url, 20), SampleIps=make_set(ClientIp, 20), FirstSeen=min(TimeGenerated), LastSeen=max(TimeGenerated) by DeviceId, HostName, DeviceUser, DeviceOs, DeviceVersion, TenantId\n| where IOC_BlockCount >= 5\n| extend Url = tostring(SampleUrls[0]), ClientIp = tostring(SampleIps[0])\n",
        "queryFrequency": "PT15M",
        "queryPeriod": "PT1H",
        "severity": "High",
        "subTechniques": [],
        "suppressionDuration": "PT1H",
        "suppressionEnabled": false,
        "tactics": [
          "CommandAndControl",
          "Exfiltration"
        ],
        "techniques": [
          "T1041",
          "T1071"
        ],
        "templateVersion": "1.0.0",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}
