Detection rules › YARA-L
GCP Multiple Secrets Deleted
Detect when multiple secrets or secret versions are deleted from GCP Secret Manager.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Impact |
Telemetry coverage
Rule body
// Copyright 2024 Google LLC. Licensed under Apache-2.0.
rule gcp_multiple_secrets_deleted {
meta:
author = "Google Cloud Security"
description = "Detect when multiple secrets or secret versions are deleted from GCP Secret Manager."
rule_id = "mr_c91c9fe8-6569-4764-a8d8-9b88dd3b7f77"
rule_name = "GCP Multiple Secrets Deleted"
mitre_attack_tactic = "Impact"
mitre_attack_technique = "Data Destruction"
mitre_attack_url = "https://attack.mitre.org/techniques/T1485/"
mitre_attack_version = "v14.1"
type = "Alert"
data_source = "GCP Cloud Audit"
platform = "GCP"
severity = "High"
priority = "High"
events:
$gcp.metadata.log_type = "GCP_CLOUDAUDIT"
(
$gcp.metadata.product_event_type = "google.cloud.secretmanager.v1.SecretManagerService.DestroySecretVersion" or
$gcp.metadata.product_event_type = "google.cloud.secretmanager.v1.SecretManagerService.DeleteSecret"
)
$gcp.target.application = "secretmanager.googleapis.com"
$gcp.security_result.action = "ALLOW"
$gcp.target.user.userid = $user_id
match:
$user_id over 1h
outcome:
$risk_score = max(75)
$mitre_attack_tactic = "Impact"
$mitre_attack_technique = "Data Destruction"
$mitre_attack_technique_id = "T1485"
$event_count = count_distinct($gcp.metadata.id)
$network_http_user_agent = array_distinct($gcp.network.http.user_agent)
$principal_ip = array_distinct($gcp.principal.ip)
$principal_ip_country = array_distinct($gcp.principal.ip_geo_artifact.location.country_or_region)
$principal_ip_state = array_distinct($gcp.principal.ip_geo_artifact.location.state)
$principal_user_id = array_distinct($gcp.principal.user.userid)
$principal_user_display_name = array_distinct($gcp.principal.user.user_display_name)
$target_resource_name = array_distinct($gcp.target.resource.name)
condition:
#gcp >= 10
}
YARA-L rule structure
Condition
Fires when $gcp occurs at least 10 times in the 1h window.
Events
$gcp
metadata.log_type = "GCP_CLOUDAUDIT"metadata.product_event_typeis one of:google.cloud.secretmanager.v1.SecretManagerService.DestroySecretVersiongoogle.cloud.secretmanager.v1.SecretManagerService.DeleteSecret
target.application = "secretmanager.googleapis.com"security_result.action = "ALLOW"
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(75) |
event_count | count_distinct($gcp.metadata.id) |
network_http_user_agent | array_distinct($gcp.network.http.user_agent) |
principal_ip | array_distinct($gcp.principal.ip) |
principal_ip_country | array_distinct($gcp.principal.ip_geo_artifact.location.country_or_region) |
principal_ip_state | array_distinct($gcp.principal.ip_geo_artifact.location.state) |
principal_user_id | array_distinct($gcp.principal.user.userid) |
principal_user_display_name | array_distinct($gcp.principal.user.user_display_name) |
target_resource_name | array_distinct($gcp.target.resource.name) |