Azure-Sentinel/Detections/MultipleDataSources/Accountcreatedfromnon-appro...

105 строки
4.0 KiB
YAML
Исходник Постоянная ссылка Обычный вид История

id: 99d589fa-7337-40d7-91a0-c96d0c4fa437
name: Account created from non-approved sources
description: |
2023-10-06 06:39:59 +03:00
'This query looks for an account being created from a domain that is not regularly seen in a tenant.
Attackers may attempt to add accounts from these sources as a means of establishing persistant access to an environment.
2023-10-06 06:39:59 +03:00
Created accounts should be investigated to confirm expected creation.
Ref: https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-user-accounts#short-lived-accounts'
severity: Medium
requiredDataConnectors:
- connectorId: AzureActiveDirectory
dataTypes:
- SigninLogs
- AuditLogs
queryFrequency: 1d
queryPeriod: 7d
triggerOperator: gt
triggerThreshold: 0
tactics:
- Persistence
relevantTechniques:
- T1136.003
tags:
- AADSecOpsGuide
query: |
let core_domains = (SigninLogs
| where TimeGenerated > ago(7d)
| where ResultType == 0
| extend domain = tolower(split(UserPrincipalName, "@")[1])
| summarize by tostring(domain));
let alternative_domains = (SigninLogs
| where TimeGenerated > ago(7d)
| where isnotempty(AlternateSignInName)
| where ResultType == 0
| extend domain = tolower(split(AlternateSignInName, "@")[1])
| summarize by tostring(domain));
AuditLogs
| where TimeGenerated > ago(1d)
| where OperationName =~ "Add User"
2024-01-22 19:26:03 +03:00
| extend InitiatingAppName = tostring(InitiatedBy.app.displayName)
| extend InitiatingAppServicePrincipalId = tostring(InitiatedBy.app.servicePrincipalId)
| extend InitiatingUserPrincipalName = tostring(InitiatedBy.user.userPrincipalName)
| extend InitiatingAadUserId = tostring(InitiatedBy.user.id)
| extend InitiatingIpAddress = tostring(iff(isnotempty(InitiatedBy.user.ipAddress), InitiatedBy.user.ipAddress, InitiatedBy.app.ipAddress))
| extend UserAdded = tostring(TargetResources[0].userPrincipalName)
2023-10-06 06:21:01 +03:00
| extend UserAddedDomain = case(
UserAdded has "#EXT#", tostring(split(tostring(split(UserAdded, "#EXT#")[0]), "_")[1]),
2024-01-22 19:26:03 +03:00
UserAdded !has "#EXT#", tostring(split(UserAdded, "@")[1]),
2023-10-06 06:21:01 +03:00
UserAdded)
| where UserAddedDomain !in (core_domains) and UserAddedDomain !in (alternative_domains)
| extend AddedByName = case(
2024-01-22 19:26:03 +03:00
InitiatingUserPrincipalName has "#EXT#", tostring(split(tostring(split(InitiatingUserPrincipalName, "#EXT#")[0]), "_")[0]),
InitiatingUserPrincipalName !has "#EXT#", tostring(split(InitiatingUserPrincipalName, "@")[0]),
InitiatingUserPrincipalName)
2023-10-06 06:21:01 +03:00
| extend AddedByUPNSuffix = case(
2024-01-22 19:26:03 +03:00
InitiatingUserPrincipalName has "#EXT#", tostring(split(tostring(split(InitiatingUserPrincipalName, "#EXT#")[0]), "_")[1]),
InitiatingUserPrincipalName !has "#EXT#", tostring(split(InitiatingUserPrincipalName, "@")[1]),
InitiatingUserPrincipalName)
2023-10-06 06:21:01 +03:00
| extend UserAddedName = case(
UserAdded has "#EXT#", tostring(split(tostring(split(UserAdded, "#EXT#")[0]), "_")[0]),
2024-01-22 19:26:03 +03:00
UserAdded !has "#EXT#", tostring(split(UserAdded, "@")[0]),
2023-10-06 06:21:01 +03:00
UserAdded)
2024-01-22 19:26:03 +03:00
entityMappings:
2024-01-22 19:26:03 +03:00
- entityType: Account
fieldMappings:
- identifier: Name
columnName: InitiatingAppName
- identifier: AadUserId
columnName: InitiatingAppServicePrincipalId
- entityType: Account
fieldMappings:
2023-12-15 07:47:06 +03:00
- identifier: FullName
2024-01-22 19:26:03 +03:00
columnName: InitiatingUserPrincipalName
2023-10-06 06:21:01 +03:00
- identifier: Name
columnName: AddedByName
- identifier: UPNSuffix
columnName: AddedByUPNSuffix
- entityType: Account
fieldMappings:
2023-10-06 06:21:01 +03:00
- identifier: AadUserId
2024-01-22 19:26:03 +03:00
columnName: InitiatingAadUserId
- entityType: IP
fieldMappings:
- identifier: Address
columnName: InitiatingIpAddress
- entityType: Account
fieldMappings:
2023-12-15 07:47:06 +03:00
- identifier: FullName
columnName: UserAdded
2023-10-06 06:21:01 +03:00
- identifier: Name
columnName: UserAddedName
- identifier: UPNSuffix
columnName: UserAddedDomain
version: 1.2.1
kind: Scheduled
metadata:
2022-10-31 10:51:26 +03:00
source:
kind: Community
author:
2023-10-06 06:21:01 +03:00
name: Microsoft Security Research
2022-10-31 10:51:26 +03:00
support:
tier: Community
categories:
domains: [ "Security - Others", "Identity" ]