Snowflake Account Admin Granted


Description

Detect when account admin is granted.

Query · python

def rule(event):
    if event.get("DELETED_ON"):
        return False
    return "admin" in event.get("GRANTEE_NAME", "").lower()


def title(event):
    source_name = event.get("p_source_label", "<UNKNOWN SNOWFLAKE SOURCE>")
    target = event.get("GRANTED_TO", "<UNKNOWN TARGET>")
    actor = event.get("GRANTED_BY", "<UNKNOWN ACTOR>")
    role = event.get("GRANTEE_NAME", "<UNKNOWN ROLE>")
    return f"{source_name}: {actor} granted role {role} to {target}"
Raw source Snowflake Account Admin Granted · Panther Python
Esc
Published by panther-labs/panther-analysis ↗, licensed under Apache 2.0 ↗. Reproduced here unmodified.
AnalysisType: rule
Filename: snowflake_stream_account_admin_assigned.py
RuleID: "Snowflake.Stream.AccountAdminGranted"
DisplayName: Snowflake Account Admin Granted
Enabled: true
LogTypes:
  - Snowflake.GrantsToUsers
Severity: Medium
Reports:
  MITRE ATT&CK:
    - TA0004:T1078
Description: Detect when account admin is granted.
Tags:
  - Snowflake
  - '[MITRE] Privilege Escalation'
  - '[MITRE] Valid Accounts'
Tests:
  - Name: Admin Role Assigned
    ExpectedResult: true
    Log:
      {
        "p_event_time": "2024-10-08 11:24:50.682000000",
        "p_log_type": "Snowflake.GrantsToUsers",
        "p_source_label": "Snowflake Prod",
        "CREATED_ON": "2024-10-08 11:24:50.682000000",
        "GRANTED_BY": "SNOWFLAKE",
        "GRANTED_TO": "APPLICATION_ROLE",
        "GRANTEE_NAME": "TRUST_CENTER_ADMIN"
      }
  - Name: Non-Admin Role Assigned
    ExpectedResult: false
    Log:
      {
        "p_event_time": "2024-10-08 11:24:50.682000000",
        "p_log_type": "Snowflake.GrantsToUsers",
        "p_source_label": "Snowflake Prod",
        "CREATED_ON": "2024-10-08 11:24:50.682000000",
        "GRANTED_BY": "SNOWFLAKE",
        "GRANTED_TO": "APPLICATION_ROLE",
        "GRANTEE_NAME": "TRUST_CENTER_VIEWER"
      }


# ------ paired body: snowflake_stream_account_admin_assigned.py ------

def rule(event):
    if event.get("DELETED_ON"):
        return False
    return "admin" in event.get("GRANTEE_NAME", "").lower()


def title(event):
    source_name = event.get("p_source_label", "<UNKNOWN SNOWFLAKE SOURCE>")
    target = event.get("GRANTED_TO", "<UNKNOWN TARGET>")
    actor = event.get("GRANTED_BY", "<UNKNOWN ACTOR>")
    role = event.get("GRANTEE_NAME", "<UNKNOWN ROLE>")
    return f"{source_name}: {actor} granted role {role} to {target}"

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.