Back
Idc1d2e3f4-1a2b-3c4d-5e6f-7a8b9c0d1e2f
RulenameTailscale Premium: Unexpected exit-node egress
DescriptionIdentifies when a node sends traffic via an exit node not used in the prior 7-day baseline. First-seen exit destinations from a node may indicate routing-policy drift, data exfiltration, or compromise.
SeverityMedium
TacticsCommandAndControl
Exfiltration
TechniquesT1090
T1041
Required data connectorsTailscalePremiumCCF
KindScheduled
Query frequency1h
Query period1h
Trigger threshold0
Trigger operatorgt
Source Urihttps://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Tailscale%20%28CCF%29/Analytic%20Rules/TailscalePremiumUnexpectedExitNodeEgress.yaml
Version1.0.0
Arm templatec1d2e3f4-1a2b-3c4d-5e6f-7a8b9c0d1e2f.json
Deploy To Azure
let baseline = 7d;
let recent = 1h;
let recentEgress =
    Tailscale_Network_CL
    | where TimeGenerated > ago(recent)
    | where HasExitTraffic
    | mv-expand t = ExitTraffic
    | extend Src = tostring(t.src), ExitDst = tostring(t.dst), Bytes = tolong(t.txBytes) + tolong(t.rxBytes)
    | summarize FirstSeen = min(TimeGenerated), TotalBytes = sum(Bytes) by NodeId, SrcNodeName, SrcUser, SrcOs, Src, ExitDst;
let baselineEgress =
    Tailscale_Network_CL
    | where TimeGenerated between (ago(baseline + recent) .. ago(recent))
    | where HasExitTraffic
    | mv-expand t = ExitTraffic
    | extend Src = tostring(t.src), ExitDst = tostring(t.dst)
    | distinct NodeId, Src, ExitDst;
recentEgress
| join kind=leftanti baselineEgress on NodeId, Src, ExitDst
| extend TotalMB = round(TotalBytes / 1024.0 / 1024.0, 2)
incidentConfiguration:
  groupingConfiguration:
    lookbackDuration: PT5H
    reopenClosedIncident: false
    matchingMethod: AllEntities
    enabled: true
  createIncident: true
name: 'Tailscale Premium: Unexpected exit-node egress'
triggerOperator: gt
query: |
  let baseline = 7d;
  let recent = 1h;
  let recentEgress =
      Tailscale_Network_CL
      | where TimeGenerated > ago(recent)
      | where HasExitTraffic
      | mv-expand t = ExitTraffic
      | extend Src = tostring(t.src), ExitDst = tostring(t.dst), Bytes = tolong(t.txBytes) + tolong(t.rxBytes)
      | summarize FirstSeen = min(TimeGenerated), TotalBytes = sum(Bytes) by NodeId, SrcNodeName, SrcUser, SrcOs, Src, ExitDst;
  let baselineEgress =
      Tailscale_Network_CL
      | where TimeGenerated between (ago(baseline + recent) .. ago(recent))
      | where HasExitTraffic
      | mv-expand t = ExitTraffic
      | extend Src = tostring(t.src), ExitDst = tostring(t.dst)
      | distinct NodeId, Src, ExitDst;
  recentEgress
  | join kind=leftanti baselineEgress on NodeId, Src, ExitDst
  | extend TotalMB = round(TotalBytes / 1024.0 / 1024.0, 2)
queryFrequency: 1h
description: Identifies when a node sends traffic via an exit node not used in the prior 7-day baseline. First-seen exit destinations from a node may indicate routing-policy drift, data exfiltration, or compromise.
id: c1d2e3f4-1a2b-3c4d-5e6f-7a8b9c0d1e2f
triggerThreshold: 0
queryPeriod: 1h
version: 1.0.0
kind: Scheduled
status: Available
severity: Medium
requiredDataConnectors:
- connectorId: TailscalePremiumCCF
  dataTypes:
  - Tailscale_Network_CL
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Tailscale%20%28CCF%29/Analytic%20Rules/TailscalePremiumUnexpectedExitNodeEgress.yaml
description-detailed: |
  Identifies when a node sends traffic via an exit node not used in the prior 7-day baseline. First-seen exit destinations from a specific source may indicate unsanctioned egress, a compromised node pivoting, or a policy misconfiguration. Requires Tailscale Premium or Enterprise.
relevantTechniques:
- T1090
- T1041
tactics:
- CommandAndControl
- Exfiltration
entityMappings:
- fieldMappings:
  - identifier: HostName
    columnName: SrcNodeName
  entityType: Host
- fieldMappings:
  - identifier: FullName
    columnName: SrcUser
  entityType: Account
- fieldMappings:
  - identifier: Address
    columnName: Src
  entityType: IP
{
  "$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/c1d2e3f4-1a2b-3c4d-5e6f-7a8b9c0d1e2f')]",
      "kind": "Scheduled",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/c1d2e3f4-1a2b-3c4d-5e6f-7a8b9c0d1e2f')]",
      "properties": {
        "alertRuleTemplateName": "c1d2e3f4-1a2b-3c4d-5e6f-7a8b9c0d1e2f",
        "customDetails": null,
        "description": "Identifies when a node sends traffic via an exit node not used in the prior 7-day baseline. First-seen exit destinations from a node may indicate routing-policy drift, data exfiltration, or compromise.",
        "description-detailed": "Identifies when a node sends traffic via an exit node not used in the prior 7-day baseline. First-seen exit destinations from a specific source may indicate unsanctioned egress, a compromised node pivoting, or a policy misconfiguration. Requires Tailscale Premium or Enterprise.\n",
        "displayName": "Tailscale Premium: Unexpected exit-node egress",
        "enabled": true,
        "entityMappings": [
          {
            "entityType": "Host",
            "fieldMappings": [
              {
                "columnName": "SrcNodeName",
                "identifier": "HostName"
              }
            ]
          },
          {
            "entityType": "Account",
            "fieldMappings": [
              {
                "columnName": "SrcUser",
                "identifier": "FullName"
              }
            ]
          },
          {
            "entityType": "IP",
            "fieldMappings": [
              {
                "columnName": "Src",
                "identifier": "Address"
              }
            ]
          }
        ],
        "incidentConfiguration": {
          "createIncident": true,
          "groupingConfiguration": {
            "enabled": true,
            "lookbackDuration": "PT5H",
            "matchingMethod": "AllEntities",
            "reopenClosedIncident": false
          }
        },
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Tailscale%20%28CCF%29/Analytic%20Rules/TailscalePremiumUnexpectedExitNodeEgress.yaml",
        "query": "let baseline = 7d;\nlet recent = 1h;\nlet recentEgress =\n    Tailscale_Network_CL\n    | where TimeGenerated > ago(recent)\n    | where HasExitTraffic\n    | mv-expand t = ExitTraffic\n    | extend Src = tostring(t.src), ExitDst = tostring(t.dst), Bytes = tolong(t.txBytes) + tolong(t.rxBytes)\n    | summarize FirstSeen = min(TimeGenerated), TotalBytes = sum(Bytes) by NodeId, SrcNodeName, SrcUser, SrcOs, Src, ExitDst;\nlet baselineEgress =\n    Tailscale_Network_CL\n    | where TimeGenerated between (ago(baseline + recent) .. ago(recent))\n    | where HasExitTraffic\n    | mv-expand t = ExitTraffic\n    | extend Src = tostring(t.src), ExitDst = tostring(t.dst)\n    | distinct NodeId, Src, ExitDst;\nrecentEgress\n| join kind=leftanti baselineEgress on NodeId, Src, ExitDst\n| extend TotalMB = round(TotalBytes / 1024.0 / 1024.0, 2)\n",
        "queryFrequency": "PT1H",
        "queryPeriod": "PT1H",
        "severity": "Medium",
        "status": "Available",
        "subTechniques": [],
        "suppressionDuration": "PT1H",
        "suppressionEnabled": false,
        "tactics": [
          "CommandAndControl",
          "Exfiltration"
        ],
        "techniques": [
          "T1041",
          "T1090"
        ],
        "templateVersion": "1.0.0",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}