Detection rules › YARA-L

GCP Workload Identity Pool Disabled Or Deleted

Severity
high
Type
Alert
Author
Google Cloud Security
Source
github.com/chronicle/detection-rules

Detect when GCP Workload identity pools are disabled or deleted. Disabling or deleting a pool will prevent any connected identities from accessing all GCP resources.

MITRE ATT&CK coverage

Event coverage

ProviderEventTitle
GCP-iam.googleapis.comgoogle-iam-WorkloadIdentityPools-DeleteWorkloadIdentityPoolDelete workload identity pool
GCP-iam.googleapis.comgoogle-iam-WorkloadIdentityPools-UpdateWorkloadIdentityPoolUpdate workload identity pool

Rule body yaral

/*
 * Copyright 2024 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

 rule gcp_workload_identity_pool_disabled_or_deleted {

  meta:
    author = "Google Cloud Security"
    description = "Detect when GCP Workload identity pools are disabled or deleted. Disabling or deleting a pool will prevent any connected identities from accessing all GCP resources."
    rule_id = "mr_265fbe68-80c6-48b0-a211-dca6bcef0fd2"
    rule_name = "GCP Workload Identity Pool Disabled Or Deleted"
    mitre_attack_tactic = "Defense Evasion, Persistence, Privilege Escalation, Initial Access"
    mitre_attack_technique = "Valid Accounts: Cloud Accounts"
    mitre_attack_url = "https://attack.mitre.org/techniques/T1078/004/"
    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.iam.v1.WorkloadIdentityPools.DeleteWorkloadIdentityPool" or
        (
            $gcp.metadata.product_event_type = "google.iam.v1.WorkloadIdentityPools.UpdateWorkloadIdentityPool" and
            $gcp.target.resource.attribute.labels["req_identityPool_disabled"] = "true"
        )
    )
    $gcp.target.application = "iam.googleapis.com"
    $gcp.security_result.action = "ALLOW"

  outcome:
    $risk_score = max(75)
    $mitre_attack_tactic = "Defense Evasion, Persistence, Privilege Escalation, Initial Access"
    $mitre_attack_technique = "Valid Accounts: Cloud Accounts"
    $mitre_attack_technique_id = "T1078.004"
    $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 = $gcp.principal.user.userid
    $principal_user_display_name = $gcp.principal.user.user_display_name
    $target_resource_name = $gcp.target.resource.name
    $event_name = $gcp.metadata.product_event_type

  condition:
    $gcp
}

Detection logic

Fires when at least one $gcp event.

Events

$gcp

  • metadata.log_type = "GCP_CLOUDAUDIT"
  • metadata.product_event_type = "google.iam.v1.WorkloadIdentityPools.DeleteWorkloadIdentityPool"
  • metadata.product_event_type = "google.iam.v1.WorkloadIdentityPools.UpdateWorkloadIdentityPool"
  • target.resource.attribute.labels["req_identityPool_disabled"] = "true"
  • target.application = "iam.googleapis.com"
  • security_result.action = "ALLOW"

Outcome

Fields the detection emits on a match. $risk_score drives alerting; Chronicle surfaces the rest on the detection.

FieldExpression
risk_scoremax(75)
event_countcount_distinct($gcp.metadata.id)
network_http_user_agentarray_distinct($gcp.network.http.user_agent)
principal_iparray_distinct($gcp.principal.ip)
principal_ip_countryarray_distinct($gcp.principal.ip_geo_artifact.location.country_or_region)
principal_ip_statearray_distinct($gcp.principal.ip_geo_artifact.location.state)
principal_user_id$gcp.principal.user.userid
principal_user_display_name$gcp.principal.user.user_display_name
target_resource_name$gcp.target.resource.name
event_name$gcp.metadata.product_event_type