Account created from non-approved sources
Id | 99d589fa-7337-40d7-91a0-c96d0c4fa437 |
Rulename | Account created from non-approved sources |
Description | This query looks for 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. Created accounts should be investigated to ensure they were legitimated created. Ref: https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-user-accounts#short-lived-accounts |
Severity | Medium |
Tactics | Persistence |
Techniques | T1136.003 |
Required data connectors | AzureActiveDirectory |
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/MultipleDataSources/Accountcreatedfromnon-approvedsources.yaml |
Version | 1.0.1 |
Arm template | 99d589fa-7337-40d7-91a0-c96d0c4fa437.json |
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"
| extend AddingUser = tostring(parse_json(tostring(InitiatedBy.user)).userPrincipalName)
| extend AddingSPN = tostring(parse_json(tostring(InitiatedBy.app)).servicePrincipalName)
| extend AddedBy = iif(isnotempty(AddingUser), AddingUser, AddingSPN)
| extend UserAdded = tostring(TargetResources[0].userPrincipalName)
| extend Domain = tolower(split(UserAdded, "@")[1])
| where Domain !in (core_domains) and Domain !in (alternative_domains)
| project-away AddingUser
| project-reorder TimeGenerated, UserAdded, Domain, AddedBy
requiredDataConnectors:
- connectorId: AzureActiveDirectory
dataTypes:
- SigninLogs
- AuditLogs
triggerOperator: gt
queryFrequency: 1d
name: Account created from non-approved sources
tags:
- AADSecOpsGuide
queryPeriod: 7d
metadata:
categories:
domains:
- Security - Others
- Identity
support:
tier: Community
author:
name: Pete Bryan
source:
kind: Community
id: 99d589fa-7337-40d7-91a0-c96d0c4fa437
description: |
'This query looks for 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.
Created accounts should be investigated to ensure they were legitimated created.
Ref: https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-user-accounts#short-lived-accounts'
severity: Medium
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"
| extend AddingUser = tostring(parse_json(tostring(InitiatedBy.user)).userPrincipalName)
| extend AddingSPN = tostring(parse_json(tostring(InitiatedBy.app)).servicePrincipalName)
| extend AddedBy = iif(isnotempty(AddingUser), AddingUser, AddingSPN)
| extend UserAdded = tostring(TargetResources[0].userPrincipalName)
| extend Domain = tolower(split(UserAdded, "@")[1])
| where Domain !in (core_domains) and Domain !in (alternative_domains)
| project-away AddingUser
| project-reorder TimeGenerated, UserAdded, Domain, AddedBy
version: 1.0.1
kind: Scheduled
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Detections/MultipleDataSources/Accountcreatedfromnon-approvedsources.yaml
entityMappings:
- entityType: Account
fieldMappings:
- identifier: FullName
columnName: AddedBy
- entityType: Account
fieldMappings:
- identifier: FullName
columnName: UserAdded
relevantTechniques:
- T1136.003
tactics:
- Persistence
triggerThreshold: 0
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"workspace": {
"type": "String"
}
},
"resources": [
{
"id": "[concat(resourceId('Microsoft.OperationalInsights/workspaces/providers', parameters('workspace'), 'Microsoft.SecurityInsights'),'/alertRules/99d589fa-7337-40d7-91a0-c96d0c4fa437')]",
"name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/99d589fa-7337-40d7-91a0-c96d0c4fa437')]",
"type": "Microsoft.OperationalInsights/workspaces/providers/alertRules",
"kind": "Scheduled",
"apiVersion": "2022-11-01-preview",
"properties": {
"displayName": "Account created from non-approved sources",
"description": "'This query looks for account being created from a domain that is not regularly seen in a tenant.\n Attackers may attempt to add accounts from these sources as a means of establishing persistant access to an environment.\n Created accounts should be investigated to ensure they were legitimated created.\n Ref: https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-user-accounts#short-lived-accounts'\n",
"severity": "Medium",
"enabled": true,
"query": "let core_domains = (SigninLogs\n | where TimeGenerated > ago(7d)\n | where ResultType == 0\n | extend domain = tolower(split(UserPrincipalName, \"@\")[1])\n | summarize by tostring(domain));\n let alternative_domains = (SigninLogs\n | where TimeGenerated > ago(7d)\n | where isnotempty(AlternateSignInName)\n | where ResultType == 0\n | extend domain = tolower(split(AlternateSignInName, \"@\")[1])\n | summarize by tostring(domain));\n AuditLogs\n | where TimeGenerated > ago(1d)\n | where OperationName =~ \"Add User\"\n | extend AddingUser = tostring(parse_json(tostring(InitiatedBy.user)).userPrincipalName)\n | extend AddingSPN = tostring(parse_json(tostring(InitiatedBy.app)).servicePrincipalName)\n | extend AddedBy = iif(isnotempty(AddingUser), AddingUser, AddingSPN)\n | extend UserAdded = tostring(TargetResources[0].userPrincipalName)\n | extend Domain = tolower(split(UserAdded, \"@\")[1])\n | where Domain !in (core_domains) and Domain !in (alternative_domains)\n | project-away AddingUser\n | project-reorder TimeGenerated, UserAdded, Domain, AddedBy\n",
"queryFrequency": "P1D",
"queryPeriod": "P7D",
"triggerOperator": "GreaterThan",
"triggerThreshold": 0,
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"tactics": [
"Persistence"
],
"techniques": [
"T1136.003"
],
"alertRuleTemplateName": "99d589fa-7337-40d7-91a0-c96d0c4fa437",
"customDetails": null,
"entityMappings": [
{
"fieldMappings": [
{
"identifier": "FullName",
"columnName": "AddedBy"
}
],
"entityType": "Account"
},
{
"fieldMappings": [
{
"identifier": "FullName",
"columnName": "UserAdded"
}
],
"entityType": "Account"
}
],
"tags": [
"AADSecOpsGuide"
],
"templateVersion": "1.0.1",
"OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Detections/MultipleDataSources/Accountcreatedfromnon-approvedsources.yaml"
}
}
]
}