Back
Id8a2c6e94-1b5d-4f7a-b3e8-2c9d4f6a1e52
RulenameContraForce - Machine credential activity
DescriptionIdentifies service-account and machine-credential lifecycle activity in the ContraForce

workspace: service accounts created or deleted, credentials created, regenerated or revoked,

and API client secret regenerations. Machine credentials grant standing programmatic access,

so unexpected lifecycle events can indicate persistence being established or an attempt to

rotate credentials out from under their legitimate owner.
SeverityMedium
TacticsPersistence
CredentialAccess
TechniquesT1098
T1136
Required data connectorsContraForceEvents
KindScheduled
Query frequency5m
Query period1d
Trigger threshold0
Trigger operatorgt
Source Urihttps://github.com/Azure/Azure-Sentinel/blob/master/Solutions/ContraForce/Analytic%20Rules/ContraForceMachineCredentialActivity.yaml
Version1.0.0
Arm template8a2c6e94-1b5d-4f7a-b3e8-2c9d4f6a1e52.json
Deploy To Azure
ContraForceEvents_CL
| where ingestion_time() > ago(5m)
| where ActivityType in ("ServiceAccountCreated", "ServiceAccountDeleted", "ServiceAccountCredentialCreated", "ServiceAccountCredentialRegenerated", "ServiceAccountCredentialRevoked", "ApiClientSecretRegenerated")
| extend Meta = parse_json(Metadata)
| project TimeGenerated, EventId, CfWorkspaceId, ActivityType, ActivityAction,
          ActorName, ActorEmail, TargetResourceType, TargetResourceId, TargetResourceName, Metadata
queryFrequency: 5m
incidentConfiguration:
  createIncident: true
  groupingConfiguration:
    reopenClosedIncident: false
    matchingMethod: Selected
    lookbackDuration: PT2H
    enabled: true
    groupByCustomDetails:
    - EventId
triggerThreshold: 0
triggerOperator: gt
severity: Medium
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/ContraForce/Analytic%20Rules/ContraForceMachineCredentialActivity.yaml
eventGroupingSettings:
  aggregationKind: AlertPerResult
alertDetailsOverride:
  alertDisplayNameFormat: 'ContraForce machine credential activity: {{ActivityType}} on {{TargetResourceName}}'
  alertDescriptionFormat: '{{ActorName}} performed {{ActivityType}} on {{TargetResourceName}}.'
query: |
  ContraForceEvents_CL
  | where ingestion_time() > ago(5m)
  | where ActivityType in ("ServiceAccountCreated", "ServiceAccountDeleted", "ServiceAccountCredentialCreated", "ServiceAccountCredentialRegenerated", "ServiceAccountCredentialRevoked", "ApiClientSecretRegenerated")
  | extend Meta = parse_json(Metadata)
  | project TimeGenerated, EventId, CfWorkspaceId, ActivityType, ActivityAction,
            ActorName, ActorEmail, TargetResourceType, TargetResourceId, TargetResourceName, Metadata
tactics:
- Persistence
- CredentialAccess
queryPeriod: 1d
customDetails:
  CfWorkspaceId: CfWorkspaceId
  EventId: EventId
  TargetResourceId: TargetResourceId
  ActorEmail: ActorEmail
relevantTechniques:
- T1098
- T1136
requiredDataConnectors:
- connectorId: ContraForceEvents
  dataTypes:
  - ContraForceEvents_CL
id: 8a2c6e94-1b5d-4f7a-b3e8-2c9d4f6a1e52
kind: Scheduled
version: 1.0.0
description: |
  'Identifies service-account and machine-credential lifecycle activity in the ContraForce
  workspace: service accounts created or deleted, credentials created, regenerated or revoked,
  and API client secret regenerations. Machine credentials grant standing programmatic access,
  so unexpected lifecycle events can indicate persistence being established or an attempt to
  rotate credentials out from under their legitimate owner.'
status: Available
name: ContraForce - Machine credential activity
{
  "$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/8a2c6e94-1b5d-4f7a-b3e8-2c9d4f6a1e52')]",
      "kind": "Scheduled",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/8a2c6e94-1b5d-4f7a-b3e8-2c9d4f6a1e52')]",
      "properties": {
        "alertDetailsOverride": {
          "alertDescriptionFormat": "{{ActorName}} performed {{ActivityType}} on {{TargetResourceName}}.",
          "alertDisplayNameFormat": "ContraForce machine credential activity: {{ActivityType}} on {{TargetResourceName}}"
        },
        "alertRuleTemplateName": "8a2c6e94-1b5d-4f7a-b3e8-2c9d4f6a1e52",
        "customDetails": {
          "ActorEmail": "ActorEmail",
          "CfWorkspaceId": "CfWorkspaceId",
          "EventId": "EventId",
          "TargetResourceId": "TargetResourceId"
        },
        "description": "'Identifies service-account and machine-credential lifecycle activity in the ContraForce\nworkspace: service accounts created or deleted, credentials created, regenerated or revoked,\nand API client secret regenerations. Machine credentials grant standing programmatic access,\nso unexpected lifecycle events can indicate persistence being established or an attempt to\nrotate credentials out from under their legitimate owner.'\n",
        "displayName": "ContraForce - Machine credential activity",
        "enabled": true,
        "entityMappings": null,
        "eventGroupingSettings": {
          "aggregationKind": "AlertPerResult"
        },
        "incidentConfiguration": {
          "createIncident": true,
          "groupingConfiguration": {
            "enabled": true,
            "groupByCustomDetails": [
              "EventId"
            ],
            "lookbackDuration": "PT2H",
            "matchingMethod": "Selected",
            "reopenClosedIncident": false
          }
        },
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/ContraForce/Analytic%20Rules/ContraForceMachineCredentialActivity.yaml",
        "query": "ContraForceEvents_CL\n| where ingestion_time() > ago(5m)\n| where ActivityType in (\"ServiceAccountCreated\", \"ServiceAccountDeleted\", \"ServiceAccountCredentialCreated\", \"ServiceAccountCredentialRegenerated\", \"ServiceAccountCredentialRevoked\", \"ApiClientSecretRegenerated\")\n| extend Meta = parse_json(Metadata)\n| project TimeGenerated, EventId, CfWorkspaceId, ActivityType, ActivityAction,\n          ActorName, ActorEmail, TargetResourceType, TargetResourceId, TargetResourceName, Metadata\n",
        "queryFrequency": "PT5M",
        "queryPeriod": "P1D",
        "severity": "Medium",
        "status": "Available",
        "subTechniques": [],
        "suppressionDuration": "PT1H",
        "suppressionEnabled": false,
        "tactics": [
          "CredentialAccess",
          "Persistence"
        ],
        "techniques": [
          "T1098",
          "T1136"
        ],
        "templateVersion": "1.0.0",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}