Detection rules › YARA-L
Google Workspace Alerts Aggregated By Severity
Generates alerts based on Google Workspace alerts center and aggregates them based on severity.
Rule body
// Copyright 2023 Google LLC. Licensed under Apache-2.0.
rule google_workspace_alerts_aggregated_by_severity {
meta:
author = "Google Cloud Security"
description = "Generates alerts based on Google Workspace alerts center and aggregates them based on severity."
rule_id = "mr_311cc4ab-627b-43a1-a744-8d7aa5e44fbf"
rule_name = "Google Workspace Alerts Aggregated By Severity"
type = "Alert"
data_source = "Workspace Alerts"
events:
$ws.metadata.vendor_name = "Google Workspace"
$ws.metadata.product_name = "Google Workspace Alerts"
$ws.security_result.severity = $severity
match:
$severity over 1h
outcome:
$risk_score = max(30 +
if($ws.security_result.severity = "LOW", 10)+
if($ws.security_result.severity = "MEDIUM", 30)+
if($ws.security_result.severity = "HIGH", 50)
)
$event_count = count_distinct($ws.metadata.id)
$event_type = array_distinct($ws.metadata.event_type)
$product_event_type = array_distinct($ws.metadata.product_event_type)
$security_category_details = array_distinct($ws.security_result.category_details)
$security_category = array_distinct($ws.security_result.category)
$security_investigation_tool_link = array_distinct($ws.security_result.detection_fields["security_investigation_tool_link"])
$security_summary = array_distinct($ws.security_result.summary)
$alert_severity = array_distinct($ws.security_result.severity)
condition:
$ws
}
YARA-L rule structure
Condition
Fires when at least one $ws event in the 1h window.
Events
$ws
Match and correlation
Outcome
Outcome variables add context to a detection. When the rule generates an alert, $risk_score is displayed with it.
| Field | Expression |
|---|---|
risk_score | max(30 + if($ws.security_result.severity = "LOW", 10)+ if($ws.security_result.severity = "MEDIUM", 30)+ if($ws.security_result.severity = "HIGH", 50) ) |
event_count | count_distinct($ws.metadata.id) |
event_type | array_distinct($ws.metadata.event_type) |
product_event_type | array_distinct($ws.metadata.product_event_type) |
security_category_details | array_distinct($ws.security_result.category_details) |
security_category | array_distinct($ws.security_result.category) |
security_investigation_tool_link | array_distinct($ws.security_result.detection_fields["security_investigation_tool_link"]) |
security_summary | array_distinct($ws.security_result.summary) |
alert_severity | array_distinct($ws.security_result.severity) |