Back
Id7237a848-30f2-499b-9ad5-024aea1288bd
RulenameTailscale: OAuth client or API key created with write scopes
DescriptionIdentifies creation of a Tailscale OAuth client or API access key whose granted scopes include WRITE permissions (anything matching :write). Tokens with write scopes are high-value adversary targets.
SeverityHigh
TacticsPersistence
PrivilegeEscalation
TechniquesT1098
T1136
Required data connectorsTailscaleCCF
TailscalePremiumCCF
KindScheduled
Query frequency15m
Query period15m
Trigger threshold0
Trigger operatorgt
Source Urihttps://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Tailscale%20%28CCF%29/Analytic%20Rules/TailscaleOAuthClientCreatedWithWriteScopes.yaml
Version1.0.0
Arm template7237a848-30f2-499b-9ad5-024aea1288bd.json
Deploy To Azure
Tailscale_Audit_CL
| where EventType == "CONFIG"
| where Action == "CREATE"
| where tostring(Target.type) in ("API_KEY", "OAUTH_CLIENT")
| extend Scopes = extract(@"scopes\s*-\s*(.+)$", 1, ActionDetails)
| where Scopes contains ":write"
| extend WriteScopes = extract_all(@"([a-zA-Z_]+:write)", Scopes)
| extend ActorLogin = tostring(Actor.loginName)
| extend ActorType = tostring(Actor.type)
| extend TargetName = tostring(Target.name)
| extend TargetId = tostring(Target.id)
| extend TargetType = tostring(Target.type)
| project TimeGenerated, ActorLogin, ActorType, Action, TargetType, TargetName, TargetId, WriteScopes, Scopes, Origin, ActionDetails
incidentConfiguration:
  createIncident: true
  groupingConfiguration:
    lookbackDuration: PT5H
    reopenClosedIncident: false
    enabled: true
    matchingMethod: AllEntities
entityMappings:
- entityType: Account
  fieldMappings:
  - columnName: ActorLogin
    identifier: FullName
query: |
  Tailscale_Audit_CL
  | where EventType == "CONFIG"
  | where Action == "CREATE"
  | where tostring(Target.type) in ("API_KEY", "OAUTH_CLIENT")
  | extend Scopes = extract(@"scopes\s*-\s*(.+)$", 1, ActionDetails)
  | where Scopes contains ":write"
  | extend WriteScopes = extract_all(@"([a-zA-Z_]+:write)", Scopes)
  | extend ActorLogin = tostring(Actor.loginName)
  | extend ActorType = tostring(Actor.type)
  | extend TargetName = tostring(Target.name)
  | extend TargetId = tostring(Target.id)
  | extend TargetType = tostring(Target.type)
  | project TimeGenerated, ActorLogin, ActorType, Action, TargetType, TargetName, TargetId, WriteScopes, Scopes, Origin, ActionDetails
id: 7237a848-30f2-499b-9ad5-024aea1288bd
queryFrequency: 15m
description-detailed: |
  Detects creation of a Tailscale OAuth client or API access key whose granted scopes include WRITE permissions (anything matching ":write"). Tokens with write scopes can modify tailnet configuration, manage devices, write ACLs, and revoke keys - high-value adversary targets. Compare against the recent actor history; revoke immediately if unexpected.
status: Available
version: 1.0.0
severity: High
relevantTechniques:
- T1098
- T1136
name: 'Tailscale: OAuth client or API key created with write scopes'
kind: Scheduled
tactics:
- Persistence
- PrivilegeEscalation
requiredDataConnectors:
- dataTypes:
  - Tailscale_Audit_CL
  connectorId: TailscaleCCF
- dataTypes:
  - Tailscale_Audit_CL
  connectorId: TailscalePremiumCCF
description: Identifies creation of a Tailscale OAuth client or API access key whose granted scopes include WRITE permissions (anything matching :write). Tokens with write scopes are high-value adversary targets.
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Tailscale%20%28CCF%29/Analytic%20Rules/TailscaleOAuthClientCreatedWithWriteScopes.yaml
triggerOperator: gt
triggerThreshold: 0
queryPeriod: 15m
{
  "$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/7237a848-30f2-499b-9ad5-024aea1288bd')]",
      "kind": "Scheduled",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/7237a848-30f2-499b-9ad5-024aea1288bd')]",
      "properties": {
        "alertRuleTemplateName": "7237a848-30f2-499b-9ad5-024aea1288bd",
        "customDetails": null,
        "description": "Identifies creation of a Tailscale OAuth client or API access key whose granted scopes include WRITE permissions (anything matching :write). Tokens with write scopes are high-value adversary targets.",
        "description-detailed": "Detects creation of a Tailscale OAuth client or API access key whose granted scopes include WRITE permissions (anything matching \":write\"). Tokens with write scopes can modify tailnet configuration, manage devices, write ACLs, and revoke keys - high-value adversary targets. Compare against the recent actor history; revoke immediately if unexpected.\n",
        "displayName": "Tailscale: OAuth client or API key created with write scopes",
        "enabled": true,
        "entityMappings": [
          {
            "entityType": "Account",
            "fieldMappings": [
              {
                "columnName": "ActorLogin",
                "identifier": "FullName"
              }
            ]
          }
        ],
        "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/TailscaleOAuthClientCreatedWithWriteScopes.yaml",
        "query": "Tailscale_Audit_CL\n| where EventType == \"CONFIG\"\n| where Action == \"CREATE\"\n| where tostring(Target.type) in (\"API_KEY\", \"OAUTH_CLIENT\")\n| extend Scopes = extract(@\"scopes\\s*-\\s*(.+)$\", 1, ActionDetails)\n| where Scopes contains \":write\"\n| extend WriteScopes = extract_all(@\"([a-zA-Z_]+:write)\", Scopes)\n| extend ActorLogin = tostring(Actor.loginName)\n| extend ActorType = tostring(Actor.type)\n| extend TargetName = tostring(Target.name)\n| extend TargetId = tostring(Target.id)\n| extend TargetType = tostring(Target.type)\n| project TimeGenerated, ActorLogin, ActorType, Action, TargetType, TargetName, TargetId, WriteScopes, Scopes, Origin, ActionDetails\n",
        "queryFrequency": "PT15M",
        "queryPeriod": "PT15M",
        "severity": "High",
        "status": "Available",
        "subTechniques": [],
        "suppressionDuration": "PT1H",
        "suppressionEnabled": false,
        "tactics": [
          "Persistence",
          "PrivilegeEscalation"
        ],
        "techniques": [
          "T1098",
          "T1136"
        ],
        "templateVersion": "1.0.0",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}