Authentications of Privileged Accounts Outside of Expected Controls
| Id | af435ca1-fb70-4de1-92c1-7435c48482a9 |
| Rulename | Authentications of Privileged Accounts Outside of Expected Controls |
| Description | Detects when a privileged user account successfully authenticates from a location, device or ASN that another admin has not logged in from in the last 7 days. Privileged accounts are a key target for threat actors, monitoring for logins from these accounts that deviate from normal activity can help identify compromised accounts. Authentication attempts should be investigated to ensure the activity was legitimate and if there is other similar activity. Ref: https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-user-accounts#monitoring-for-successful-unusual-sign-ins |
| Severity | Medium |
| Tactics | InitialAccess |
| Techniques | T1078.004 |
| Required data connectors | AzureActiveDirectory BehaviorAnalytics |
| Kind | Scheduled |
| Query frequency | 1d |
| Query period | 7d |
| Trigger threshold | 0 |
| Trigger operator | gt |
| Source Uri | https://github.com/Azure/Azure-Sentinel/blob/master/Detections/SigninLogs/AuthenticationsofPrivilegedAccountsOutsideofExpectedControls.yaml |
| Version | 1.0.2 |
| Arm template | af435ca1-fb70-4de1-92c1-7435c48482a9.json |
let admin_users = (IdentityInfo
| summarize arg_max(TimeGenerated, *) by AccountUPN
| where AssignedRoles contains "admin"
| summarize by tolower(AccountUPN));
let admin_asn = (SigninLogs
| where TimeGenerated between (ago(7d)..ago(1d))
| where tolower(UserPrincipalName) in (admin_users)
| summarize by AutonomousSystemNumber);
let admin_locations = (SigninLogs
| where TimeGenerated between (ago(7d)..ago(1d))
| where tolower(UserPrincipalName) in (admin_users)
| summarize by Location);
let admin_devices = (SigninLogs
| where TimeGenerated between (ago(7d)..ago(1d))
| where tolower(UserPrincipalName) in (admin_users)
| extend deviceId = tostring(DeviceDetail.deviceId)
| where isnotempty(deviceId)
| summarize by deviceId);
SigninLogs
| where TimeGenerated > ago(1d)
| where ResultType == 0
| where tolower(UserPrincipalName) in (admin_users)
| extend deviceId = tostring(DeviceDetail.deviceId)
| where AutonomousSystemNumber !in (admin_asn) and deviceId !in (admin_devices) and Location !in (admin_locations)
description: |
'Detects when a privileged user account successfully authenticates from a location, device or ASN that another admin has not logged in from in the last 7 days.
Privileged accounts are a key target for threat actors, monitoring for logins from these accounts that deviate from normal activity can help identify compromised accounts.
Authentication attempts should be investigated to ensure the activity was legitimate and if there is other similar activity.
Ref: https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-user-accounts#monitoring-for-successful-unusual-sign-ins'
tactics:
- InitialAccess
version: 1.0.2
metadata:
source:
kind: Community
support:
tier: Community
author:
name: Pete Bryan
categories:
domains:
- Security - Others
- Identity
severity: Medium
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Detections/SigninLogs/AuthenticationsofPrivilegedAccountsOutsideofExpectedControls.yaml
queryPeriod: 7d
id: af435ca1-fb70-4de1-92c1-7435c48482a9
tags:
- AADSecOpsGuide
triggerOperator: gt
requiredDataConnectors:
- dataTypes:
- SigninLogs
connectorId: AzureActiveDirectory
- dataTypes:
- BehaviorAnalytics
connectorId: BehaviorAnalytics
- dataTypes:
- IdentityInfo
connectorId: BehaviorAnalytics
triggerThreshold: 0
name: Authentications of Privileged Accounts Outside of Expected Controls
kind: Scheduled
relevantTechniques:
- T1078.004
query: |
let admin_users = (IdentityInfo
| summarize arg_max(TimeGenerated, *) by AccountUPN
| where AssignedRoles contains "admin"
| summarize by tolower(AccountUPN));
let admin_asn = (SigninLogs
| where TimeGenerated between (ago(7d)..ago(1d))
| where tolower(UserPrincipalName) in (admin_users)
| summarize by AutonomousSystemNumber);
let admin_locations = (SigninLogs
| where TimeGenerated between (ago(7d)..ago(1d))
| where tolower(UserPrincipalName) in (admin_users)
| summarize by Location);
let admin_devices = (SigninLogs
| where TimeGenerated between (ago(7d)..ago(1d))
| where tolower(UserPrincipalName) in (admin_users)
| extend deviceId = tostring(DeviceDetail.deviceId)
| where isnotempty(deviceId)
| summarize by deviceId);
SigninLogs
| where TimeGenerated > ago(1d)
| where ResultType == 0
| where tolower(UserPrincipalName) in (admin_users)
| extend deviceId = tostring(DeviceDetail.deviceId)
| where AutonomousSystemNumber !in (admin_asn) and deviceId !in (admin_devices) and Location !in (admin_locations)
entityMappings:
- fieldMappings:
- columnName: UserPrincipalName
identifier: FullName
entityType: Account
queryFrequency: 1d