Detection rules › YARA-L

sap hanadb assign admin authorizations

Severity
high
Time window
30m
Match by
user
Author
Google Cloud Security
Source
github.com/chronicle/detection-rules

Detects the assignment of administrative privileges or roles within SAP HANA DB.

MITRE ATT&CK coverage

TacticTechniques
Persistence

Rule body

// Copyright 2026 Google LLC. Licensed under Apache-2.0.

rule sap_hanadb_assign_admin_authorizations {

  meta:
    author = "Google Cloud Security"
    description = "Detects the assignment of administrative privileges or roles within SAP HANA DB."
    severity = "High"
    tactic = "TA0003"
    technique = "T1098"

  events:
    $e.metadata.log_type = "SAP_HANA_AUDIT"

    $statement = $e.additional.fields["executed_statement"]

    $statement = /ADMIN/ nocase
    (
        $statement = /GRANT PRIVILEGE/ nocase or
        $statement = /GRANT ROLE/ nocase
    )

    $user = $e.principal.user.userid

  match:
    $user over 30m

  outcome:
    $risk_score = max(80)
    $principal_user = array_distinct($user)
    $target_user = array_distinct($e.target.user.userid)
    $statements = array_distinct($statement)
    $system_id = array_distinct($e.target.resource.attribute.labels["system_id"])

  condition:
    $e
}

YARA-L rule structure

Condition

Fires when at least one $e event in the 30m window.

Events

$e

  • metadata.log_type = "SAP_HANA_AUDIT"
  • additional.fields["executed_statement"] matches "ADMIN"
  • additional.fields["executed_statement"] matches "GRANT PRIVILEGE"
  • additional.fields["executed_statement"] matches "GRANT ROLE"

Match and correlation

Match key
$user
Within
30m

Outcome

Outcome variables add context to a detection. When the rule generates an alert, $risk_score is displayed with it.

FieldExpression
risk_scoremax(80)
principal_userarray_distinct($user)
target_userarray_distinct($e.target.user.userid)
statementsarray_distinct($statement)
system_idarray_distinct($e.target.resource.attribute.labels["system_id"])