-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathGrantHighPrivilegeMicrosoftGraphPermissions.yaml
42 lines (42 loc) · 1.79 KB
/
GrantHighPrivilegeMicrosoftGraphPermissions.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
id: e57acdbc-fc60-42eb-8666-da9ce7bbf66e
name: Grant high privilege Microsoft Graph permissions
description: |
'Identifies when an Application registration was granted a high privilege Microsoft Graph permission'
severity: Medium
requiredDataConnectors:
- connectorId: AuditLogs
dataTypes:
- AuditLogs
queryFrequency: 1d
queryPeriod: 1d
triggerOperator: gt
triggerThreshold: 0
tactics:
- Persistence
relevantTechniques:
- T1098
query: |
let DangerousPermissions = dynamic(["AppRoleAssignment.ReadWrite.All","Application.ReadWrite.All","RoleManagement.ReadWrite.Directory"]);
AuditLogs
| where OperationName == "Add app role assignment to service principal"
| mv-expand TargetResources
| mv-expand TargetResources.modifiedProperties
| where TargetResources_modifiedProperties.displayName == "AppRole.Value"
| extend InitiatedByUserPrincipalName = InitiatedBy.user.userPrincipalName
| extend AddedPermission = replace_string(tostring(TargetResources_modifiedProperties.newValue),'"','')
| where AddedPermission in~ ( DangerousPermissions )
| extend IPCustomEntity = todynamic(InitiatedBy).user.ipAddress
| extend ServicePrincipalAppId = replace_string(tostring(todynamic(TargetResources).modifiedProperties[5].newValue),'"','')
| extend ServicePrincipalDisplayName = replace_string(tostring(todynamic(TargetResources).modifiedProperties[6].newValue),'"','')
| project timestamp = TimeGenerated, IPCustomEntity, AccountCustomEntity=InitiatedByUserPrincipalName, ServicePrincipalAppId, ServicePrincipalDisplayName, AddedPermission
entityMappings:
- entityType: Account
fieldMappings:
- identifier: FullName
columnName: AccountCustomEntity
- entityType: IP
fieldMappings:
- identifier: Address
columnName: IPCustomEntity
version: 1.0.1
kind: Scheduled