Microsoft Sentinel Analytic Rules
cloudbrothers.infoAzure Sentinel RepoToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

Snowflake - User granted admin privileges

Back
Id5ed33eee-0ab6-4bf5-9e9b-6100db83d39a
RulenameSnowflake - User granted admin privileges
DescriptionDetects when user asigned admin privileges.
SeverityMedium
TacticsPrivilegeEscalation
TechniquesT1078
Required data connectorsSnowflake
KindScheduled
Query frequency1h
Query period1h
Trigger threshold0
Trigger operatorgt
Source Urihttps://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Snowflake/Analytic Rules/SnowflakeUserAddAdminPrivileges.yaml
Version1.0.0
Arm template5ed33eee-0ab6-4bf5-9e9b-6100db83d39a.json
Deploy To Azure
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
id: 5ed33eee-0ab6-4bf5-9e9b-6100db83d39a
requiredDataConnectors:
- dataTypes:
  - Snowflake
  connectorId: Snowflake
triggerOperator: gt
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Snowflake/Analytic Rules/SnowflakeUserAddAdminPrivileges.yaml
relevantTechniques:
- T1078
kind: Scheduled
name: Snowflake - User granted admin privileges
queryFrequency: 1h
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  
severity: Medium
triggerThreshold: 0
tactics:
- PrivilegeEscalation
entityMappings:
- fieldMappings:
  - columnName: AccountCustomEntity
    identifier: Name
  entityType: Account
version: 1.0.0
queryPeriod: 1h
description: |
    'Detects when user asigned admin privileges.'
status: Available
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "workspace": {
      "type": "String"
    }
  },
  "resources": [
    {
      "apiVersion": "2023-02-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",
        "suppressionDuration": "PT1H",
        "suppressionEnabled": false,
        "tactics": [
          "PrivilegeEscalation"
        ],
        "techniques": [
          "T1078"
        ],
        "templateVersion": "1.0.0",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}