Detection rules › Kusto
Snowflake - User granted admin privileges
'Detects when user asigned admin privileges.'
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Privilege Escalation |
Rule body
id: 5ed33eee-0ab6-4bf5-9e9b-6100db83d39a
name: Snowflake - User granted admin privileges
description: |
'Detects when user asigned admin privileges.'
severity: Medium
status: Available
requiredDataConnectors:
- connectorId: Snowflake
dataTypes:
- Snowflake
queryFrequency: 1h
queryPeriod: 1h
triggerOperator: gt
triggerThreshold: 0
tactics:
- PrivilegeEscalation
relevantTechniques:
- T1078
query: |
let adm_roles = dynamic(['SECURITYADMIN', 'SYSADMIN', 'ACCOUNTADMIN']);
Snowflake
| where QueryType =~ 'GRANT'
| where QueryText startswith 'GRANT ROLE'
| extend granted_role = extract(@'GRANT ROLE\s(\S+)\sto\suser', 1, QueryText)
| where granted_role in~ (adm_roles)
| extend usr = extract(@'GRANT ROLE\s(\S+)\sto\suser(\S+)', 2, QueryText)
| extend AccountCustomEntity = usr
entityMappings:
- entityType: Account
fieldMappings:
- identifier: Name
columnName: AccountCustomEntity
version: 1.0.1
kind: Scheduled
Stages and Predicates
Parameters
let adm_roles = dynamic(['SECURITYADMIN', 'SYSADMIN', 'ACCOUNTADMIN']);
Stage 1: source
Snowflake
Stage 2: where
| where QueryType =~ 'GRANT'
Stage 3: where
| where QueryText startswith 'GRANT ROLE'
Stage 4: extend
| extend granted_role = extract(@'GRANT ROLE\s(\S+)\sto\suser', 1, QueryText)
Stage 5: where
| where granted_role in~ (adm_roles)
Stage 6: extend
| extend usr = extract(@'GRANT ROLE\s(\S+)\sto\suser(\S+)', 2, QueryText)
Stage 7: extend
| extend AccountCustomEntity = usr
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
QueryText | starts_with |
| field:"QueryText" kind:starts_with value:"GRANT ROLE" |
QueryType | eq |
| field:"QueryType" kind:eq value:"GRANT" |
granted_role | in |
| field:"granted_role" kind:in |
Output fields
These fields are emitted when the rule matches.
| Field | Source |
|---|---|
granted_role | extend |
usr | extend |
AccountCustomEntity | extend |