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

Ubiquiti - Unusual DNS connection

Back
Id14a23ded-7fb9-48ee-ba39-859517a49b51
RulenameUbiquiti - Unusual DNS connection
DescriptionDetects unusual remote to local (R2L) DNS connections.
SeverityMedium
TacticsCommandAndControl
TechniquesT1090
T1572
Required data connectorsUbiquitiUnifi
KindScheduled
Query frequency1h
Query period1h
Trigger threshold0
Trigger operatorgt
Source Urihttps://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Ubiquiti UniFi/Analytic Rules/UbiquitiR2LDns.yaml
Version1.0.0
Arm template14a23ded-7fb9-48ee-ba39-859517a49b51.json
Deploy To Azure
let threshold = 50;
UbiquitiAuditEvent
| where EventCategory =~ 'firewall'
| where ipv4_is_private(SrcIpAddr) == 'False'
| where ipv4_is_private(DstIpAddr)
| where DstPortNumber == '53'
| summarize count() by SrcIpAddr, DstIpAddr
| where count_ > threshold
| extend IPCustomEntity = DstIpAddr
description: |
    'Detects unusual remote to local (R2L) DNS connections.'
status: Available
queryPeriod: 1h
severity: Medium
triggerOperator: gt
kind: Scheduled
triggerThreshold: 0
relevantTechniques:
- T1090
- T1572
version: 1.0.0
name: Ubiquiti - Unusual DNS connection
queryFrequency: 1h
id: 14a23ded-7fb9-48ee-ba39-859517a49b51
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Ubiquiti UniFi/Analytic Rules/UbiquitiR2LDns.yaml
entityMappings:
- fieldMappings:
  - columnName: IPCustomEntity
    identifier: Address
  entityType: IP
tactics:
- CommandAndControl
requiredDataConnectors:
- dataTypes:
  - UbiquitiAuditEvent
  connectorId: UbiquitiUnifi
query: |
  let threshold = 50;
  UbiquitiAuditEvent
  | where EventCategory =~ 'firewall'
  | where ipv4_is_private(SrcIpAddr) == 'False'
  | where ipv4_is_private(DstIpAddr)
  | where DstPortNumber == '53'
  | summarize count() by SrcIpAddr, DstIpAddr
  | where count_ > threshold
  | extend IPCustomEntity = DstIpAddr  
{
  "$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/14a23ded-7fb9-48ee-ba39-859517a49b51')]",
      "kind": "Scheduled",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/14a23ded-7fb9-48ee-ba39-859517a49b51')]",
      "properties": {
        "alertRuleTemplateName": "14a23ded-7fb9-48ee-ba39-859517a49b51",
        "customDetails": null,
        "description": "'Detects unusual remote to local (R2L) DNS connections.'\n",
        "displayName": "Ubiquiti - Unusual DNS connection",
        "enabled": true,
        "entityMappings": [
          {
            "entityType": "IP",
            "fieldMappings": [
              {
                "columnName": "IPCustomEntity",
                "identifier": "Address"
              }
            ]
          }
        ],
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Ubiquiti UniFi/Analytic Rules/UbiquitiR2LDns.yaml",
        "query": "let threshold = 50;\nUbiquitiAuditEvent\n| where EventCategory =~ 'firewall'\n| where ipv4_is_private(SrcIpAddr) == 'False'\n| where ipv4_is_private(DstIpAddr)\n| where DstPortNumber == '53'\n| summarize count() by SrcIpAddr, DstIpAddr\n| where count_ > threshold\n| extend IPCustomEntity = DstIpAddr\n",
        "queryFrequency": "PT1H",
        "queryPeriod": "PT1H",
        "severity": "Medium",
        "status": "Available",
        "suppressionDuration": "PT1H",
        "suppressionEnabled": false,
        "tactics": [
          "CommandAndControl"
        ],
        "techniques": [
          "T1090",
          "T1572"
        ],
        "templateVersion": "1.0.0",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}