Analytic rule catalog
Secret Exposure with Anomalous SPN Sign-In
Back
| Id | a91e677a-46b5-428e-8a7d-29a2bb33bb6f |
| Rulename | Secret Exposure with Anomalous SPN Sign-In |
| Description | Detects applications with open hardcoded-secret findings (CWE-798, CWE-259, CWE-321, CWE-522) that have associated service principal sign-in anomalies. Correlates StratoSecure secret findings with AAD SPN sign-in failures. |
| Severity | High |
| Tactics | CredentialAccess DefenseEvasion |
| Techniques | T1552 T1078.004 |
| Required data connectors | StratoSecurePush |
| Kind | Scheduled |
| Query frequency | 1h |
| Query period | 1455m |
| Trigger threshold | 0 |
| Trigger operator | gt |
| Source Uri | https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/StratoSecure/Analytic%20Rules/S2_Secret_AnomalousCredential.yaml |
| Version | 1.0.0 |
| Arm template | a91e677a-46b5-428e-8a7d-29a2bb33bb6f.json |
let lookback = 1d;
let SecretFindings = StratoSecure_Findings_CL
| where TimeGenerated >= ago(lookback)
| where FixStatus =~ "open"
| where CweId in ("CWE-798", "CWE-259", "CWE-321", "CWE-522")
| where Severity in ("Critical", "High")
| summarize FindingCount = count(), RuleIds = make_set(RuleId), Repos = make_set(Repository)
by ApplicationId, StraTenantId;
let AnomalousSignins = AADServicePrincipalSignInLogs
| where TimeGenerated >= ago(lookback)
| where ResultType != "0" or ConditionalAccessStatus =~ "failure"
| summarize FailedAttempts = count(), DistinctIPs = dcount(IPAddress),
FirstAttempt = min(TimeGenerated), LastAttempt = max(TimeGenerated)
by ServicePrincipalId, ServicePrincipalName
| where FailedAttempts > 5 or DistinctIPs > 3;
SecretFindings
| join kind=inner AnomalousSignins on $left.ApplicationId == $right.ServicePrincipalId
| project TimeGenerated = LastAttempt, ApplicationId, ServicePrincipalName, StraTenantId,
FindingCount, RuleIds, Repos, FailedAttempts, DistinctIPs
tactics:
- CredentialAccess
- DefenseEvasion
name: Secret Exposure with Anomalous SPN Sign-In
version: 1.0.0
queryFrequency: 1h
requiredDataConnectors:
- connectorId: StratoSecurePush
dataTypes:
- StratoSecure_Findings_CL
id: a91e677a-46b5-428e-8a7d-29a2bb33bb6f
triggerThreshold: 0
entityMappings:
- fieldMappings:
- identifier: AppId
columnName: ApplicationId
entityType: CloudApplication
queryPeriod: 1455m
severity: High
relevantTechniques:
- T1552
- T1078.004
description: |
Detects applications with open hardcoded-secret findings (CWE-798, CWE-259,
CWE-321, CWE-522) that have associated service principal sign-in anomalies.
Correlates StratoSecure secret findings with AAD SPN sign-in failures.
triggerOperator: gt
status: Available
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/StratoSecure/Analytic%20Rules/S2_Secret_AnomalousCredential.yaml
kind: Scheduled
query: |
let lookback = 1d;
let SecretFindings = StratoSecure_Findings_CL
| where TimeGenerated >= ago(lookback)
| where FixStatus =~ "open"
| where CweId in ("CWE-798", "CWE-259", "CWE-321", "CWE-522")
| where Severity in ("Critical", "High")
| summarize FindingCount = count(), RuleIds = make_set(RuleId), Repos = make_set(Repository)
by ApplicationId, StraTenantId;
let AnomalousSignins = AADServicePrincipalSignInLogs
| where TimeGenerated >= ago(lookback)
| where ResultType != "0" or ConditionalAccessStatus =~ "failure"
| summarize FailedAttempts = count(), DistinctIPs = dcount(IPAddress),
FirstAttempt = min(TimeGenerated), LastAttempt = max(TimeGenerated)
by ServicePrincipalId, ServicePrincipalName
| where FailedAttempts > 5 or DistinctIPs > 3;
SecretFindings
| join kind=inner AnomalousSignins on $left.ApplicationId == $right.ServicePrincipalId
| project TimeGenerated = LastAttempt, ApplicationId, ServicePrincipalName, StraTenantId,
FindingCount, RuleIds, Repos, FailedAttempts, DistinctIPs
{
"$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/a91e677a-46b5-428e-8a7d-29a2bb33bb6f')]",
"kind": "Scheduled",
"name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/a91e677a-46b5-428e-8a7d-29a2bb33bb6f')]",
"properties": {
"alertRuleTemplateName": "a91e677a-46b5-428e-8a7d-29a2bb33bb6f",
"customDetails": null,
"description": "Detects applications with open hardcoded-secret findings (CWE-798, CWE-259,\nCWE-321, CWE-522) that have associated service principal sign-in anomalies.\nCorrelates StratoSecure secret findings with AAD SPN sign-in failures.\n",
"displayName": "Secret Exposure with Anomalous SPN Sign-In",
"enabled": true,
"entityMappings": [
{
"entityType": "CloudApplication",
"fieldMappings": [
{
"columnName": "ApplicationId",
"identifier": "AppId"
}
]
}
],
"OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/StratoSecure/Analytic%20Rules/S2_Secret_AnomalousCredential.yaml",
"query": "let lookback = 1d;\nlet SecretFindings = StratoSecure_Findings_CL\n | where TimeGenerated >= ago(lookback)\n | where FixStatus =~ \"open\"\n | where CweId in (\"CWE-798\", \"CWE-259\", \"CWE-321\", \"CWE-522\")\n | where Severity in (\"Critical\", \"High\")\n | summarize FindingCount = count(), RuleIds = make_set(RuleId), Repos = make_set(Repository)\n by ApplicationId, StraTenantId;\nlet AnomalousSignins = AADServicePrincipalSignInLogs\n | where TimeGenerated >= ago(lookback)\n | where ResultType != \"0\" or ConditionalAccessStatus =~ \"failure\"\n | summarize FailedAttempts = count(), DistinctIPs = dcount(IPAddress),\n FirstAttempt = min(TimeGenerated), LastAttempt = max(TimeGenerated)\n by ServicePrincipalId, ServicePrincipalName\n | where FailedAttempts > 5 or DistinctIPs > 3;\nSecretFindings\n | join kind=inner AnomalousSignins on $left.ApplicationId == $right.ServicePrincipalId\n | project TimeGenerated = LastAttempt, ApplicationId, ServicePrincipalName, StraTenantId,\n FindingCount, RuleIds, Repos, FailedAttempts, DistinctIPs\n",
"queryFrequency": "PT1H",
"queryPeriod": "PT1455M",
"severity": "High",
"status": "Available",
"subTechniques": [
"T1078.004"
],
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"tactics": [
"CredentialAccess",
"DefenseEvasion"
],
"techniques": [
"T1078",
"T1552"
],
"templateVersion": "1.0.0",
"triggerOperator": "GreaterThan",
"triggerThreshold": 0
},
"type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
}
]
}