let adm_roles = dynamic(['SECURITYADMIN', 'SYSADMIN', 'ACCOUNTADMIN']);
Snowflake
| where QUERY_TYPE_s =~ 'GRANT'
| where QUERY_TEXT_s startswith 'GRANT ROLE'
| extend granted_role = extract(@'GRANT ROLE\s(\S+)\sto\suser', 1, QUERY_TEXT_s)
| where granted_role in~ (adm_roles)
| extend usr = extract(@'GRANT ROLE\s(\S+)\sto\suser(\S+)', 2, QUERY_TEXT_s)
| extend AccountCustomEntity = usr
entityMappings:
- entityType: Account
fieldMappings:
- identifier: Name
columnName: AccountCustomEntity
queryFrequency: 1h
name: Snowflake - User granted admin privileges
kind: Scheduled
tactics:
- PrivilegeEscalation
triggerThreshold: 0
query: |
let adm_roles = dynamic(['SECURITYADMIN', 'SYSADMIN', 'ACCOUNTADMIN']);
Snowflake
| where QUERY_TYPE_s =~ 'GRANT'
| where QUERY_TEXT_s startswith 'GRANT ROLE'
| extend granted_role = extract(@'GRANT ROLE\s(\S+)\sto\suser', 1, QUERY_TEXT_s)
| where granted_role in~ (adm_roles)
| extend usr = extract(@'GRANT ROLE\s(\S+)\sto\suser(\S+)', 2, QUERY_TEXT_s)
| extend AccountCustomEntity = usr
relevantTechniques:
- T1078
triggerOperator: gt
queryPeriod: 1h
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Snowflake/Analytic Rules/SnowflakeUserAddAdminPrivileges.yaml
severity: Medium
status: Available
id: 5ed33eee-0ab6-4bf5-9e9b-6100db83d39a
requiredDataConnectors:
- connectorId: Snowflake
dataTypes:
- Snowflake
version: 1.0.0
description: |
'Detects when user asigned admin privileges.'
{
"$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/5ed33eee-0ab6-4bf5-9e9b-6100db83d39a')]",
"kind": "Scheduled",
"name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/5ed33eee-0ab6-4bf5-9e9b-6100db83d39a')]",
"properties": {
"alertRuleTemplateName": "5ed33eee-0ab6-4bf5-9e9b-6100db83d39a",
"customDetails": null,
"description": "'Detects when user asigned admin privileges.'\n",
"displayName": "Snowflake - User granted admin privileges",
"enabled": true,
"entityMappings": [
{
"entityType": "Account",
"fieldMappings": [
{
"columnName": "AccountCustomEntity",
"identifier": "Name"
}
]
}
],
"OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Snowflake/Analytic Rules/SnowflakeUserAddAdminPrivileges.yaml",
"query": "let adm_roles = dynamic(['SECURITYADMIN', 'SYSADMIN', 'ACCOUNTADMIN']);\nSnowflake\n| where QUERY_TYPE_s =~ 'GRANT'\n| where QUERY_TEXT_s startswith 'GRANT ROLE'\n| extend granted_role = extract(@'GRANT ROLE\\s(\\S+)\\sto\\suser', 1, QUERY_TEXT_s)\n| where granted_role in~ (adm_roles)\n| extend usr = extract(@'GRANT ROLE\\s(\\S+)\\sto\\suser(\\S+)', 2, QUERY_TEXT_s)\n| extend AccountCustomEntity = usr\n",
"queryFrequency": "PT1H",
"queryPeriod": "PT1H",
"severity": "Medium",
"status": "Available",
"subTechniques": [],
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"tactics": [
"PrivilegeEscalation"
],
"techniques": [
"T1078"
],
"templateVersion": "1.0.0",
"triggerOperator": "GreaterThan",
"triggerThreshold": 0
},
"type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
}
]
}