How the attack works
Workloads on Google Cloud authenticate as service accounts, and automation outside Google Cloud often still authenticates with a service account key. A principal that can administer service accounts can take both away. DisableServiceAccount stops an account from being used, DeleteServiceAccount removes it, DisableServiceAccountKey stops one key from authenticating and DeleteServiceAccountKey removes the key for good. Google states that applications lose access to Google Cloud resources through a disabled or deleted service account, and that disabling the default App Engine or Compute Engine service account cuts off the instances that use it.
Attackers do this for impact, not for access. Removing the identities of deployment pipelines, backup jobs and security tooling breaks production and takes away the automation a response team would use, and deleting the accounts an attacker created removes the trace of what was done with them. The same calls are routine administration, because rotation, clean-up of unused accounts and the containment of a leaked key all produce them. What separates an attack is who made the call, how many accounts or keys lost access within a short time, and whether the accounts are ones that production depends on. Each call is an Admin Activity audit entry under iam.googleapis.com, which is always written.
What an attacker needs
- A role that can disable or delete service accounts, such as Service Account Admin (
iam.serviceAccounts.disable,iam.serviceAccounts.delete) or Delete Service Accounts, or one that can disable or delete keys, such as Service Account Key Admin (iam.serviceAccountKeys.disable,iam.serviceAccountKeys.delete). - Workloads, pipelines or tools that depend on the affected service accounts or keys.
Impact
Workloads that run as the service account, and applications that authenticate with the key, lose access to Google Cloud resources. A disabled account or key can be enabled again and a deleted account can be undeleted for 30 days, but a deleted key cannot be restored, so each application that used it needs a new credential. Until access is back, deployments, scheduled jobs and monitoring that ran under those identities stay down.
Detection rules
Many Service Accounts or Keys Disabled or Deleted by One Principal
Counts, per caller (principalEmail), the calls that disable or delete a service account or a service account key. Five or more within 15 minutes is the pattern of workload identities being removed in bulk, either to break what depends on them or to remove accounts after they were used. The count and the window are starting points to tune. The entries are Admin Activity audit logs, which are always written. A caller without a principalEmail, such as some federated identities, is not counted under its own name.
Fires when one protoPayload.authenticationInfo.principalEmail has at least 5 matching events within 15 minutes.
title: Service Account or Key Disabled or Deleted (Removal Burst Base Event)
id: eecfe98b-f3cc-4beb-ac61-d93ed2fa8acb
name: gcp_service_account_or_key_disabled_or_deleted
status: experimental
description: >-
Base event of the threshold rule in this file. A call to the IAM API that
disables or deletes a service account or a service account key.
logsource:
product: gcp
service: gcp.audit
detection:
selection:
protoPayload.serviceName: iam.googleapis.com
protoPayload.methodName:
- google.iam.admin.v1.DisableServiceAccount
- google.iam.admin.v1.DeleteServiceAccount
- google.iam.admin.v1.DisableServiceAccountKey
- google.iam.admin.v1.DeleteServiceAccountKey
condition: selection
level: low
---
title: Many Service Accounts or Keys Disabled or Deleted by One Principal
id: df9a057e-732f-4d8a-90ba-b8d9aadd78e4
status: experimental
description: >-
Counts, per caller (principalEmail), the calls that disable or delete a
service account or a service account key. Five or more within 15 minutes is
the pattern of workload identities being removed in bulk, either to break
what depends on them or to remove accounts after they were used. The count
and the window are starting points to tune. The entries are Admin Activity
audit logs, which are always written. A caller without a principalEmail,
such as some federated identities, is not counted under its own name.
references:
- https://docs.cloud.google.com/iam/docs/audit-logging
- https://docs.cloud.google.com/iam/docs/service-accounts-delete-undelete
- https://docs.cloud.google.com/logging/docs/reference/audit/auditlog/rest/Shared.Types/AuditLog
author: Forestall
date: 2026-11-18
tags:
- attack.impact
- attack.t1531
correlation:
type: event_count
rules:
- gcp_service_account_or_key_disabled_or_deleted
group-by:
- protoPayload.authenticationInfo.principalEmail
timespan: 15m
condition:
gte: 5
falsepositives:
- Infrastructure-as-code pipelines that tear down an environment and delete its service accounts in one run, and bulk key rotation. Exclude the pipeline and rotation identities.
- Planned clean-up of unused service accounts by the platform team. Confirm the change record.
- The values of 5 calls and 15 minutes are starting points, not tested limits. Measure what your own pipelines produce and adjust both.
level: high
False positives
- Infrastructure-as-code pipelines that tear down an environment and delete its service accounts in one run, and bulk key rotation. Exclude the pipeline and rotation identities.
- Planned clean-up of unused service accounts by the platform team. Confirm the change record.
- The values of 5 calls and 15 minutes are starting points, not tested limits. Measure what your own pipelines produce and adjust both.
Google Cloud Service Account Disabled or Deleted
Detects DisableServiceAccount and DeleteServiceAccount calls to the IAM API (Admin Activity audit log, always written). Google states that applications lose access to Google Cloud resources through a disabled or deleted service account. The account is named in protoPayload.resourceName and the caller in principalEmail. Both calls are also routine clean-up, so triage by who made the call, which account was affected and how many accounts the same caller removed. See the threshold rule on this page for bursts. Google lists the method names and the log type but publishes no example of these entries, so the rule matches on the method name alone.
title: Google Cloud Service Account Disabled or Deleted
id: f86ba00e-72e8-4470-8ba0-3ecb26653571
status: experimental
description: >-
Detects DisableServiceAccount and DeleteServiceAccount calls to the IAM API
(Admin Activity audit log, always written). Google states that applications
lose access to Google Cloud resources through a disabled or deleted service
account. The account is named in protoPayload.resourceName and the caller in
principalEmail. Both calls are also routine clean-up, so triage by who made
the call, which account was affected and how many accounts the same caller
removed. See the threshold rule on this page for bursts. Google lists the
method names and the log type but publishes no example of these entries, so
the rule matches on the method name alone.
references:
- https://docs.cloud.google.com/iam/docs/audit-logging
- https://docs.cloud.google.com/iam/docs/service-accounts-disable-enable
- https://docs.cloud.google.com/iam/docs/service-accounts-delete-undelete
author: Forestall
date: 2026-11-18
tags:
- attack.impact
- attack.t1531
logsource:
product: gcp
service: gcp.audit
detection:
selection:
protoPayload.serviceName: iam.googleapis.com
protoPayload.methodName:
- google.iam.admin.v1.DisableServiceAccount
- google.iam.admin.v1.DeleteServiceAccount
condition: selection
falsepositives:
- Clean-up of unused service accounts by the platform team, and infrastructure-as-code runs that remove the accounts of a stack they tear down. Exclude those identities by principalEmail in a filter_* selection and review removals of accounts that production depends on whoever made them.
- Containment of a compromised service account by the response team, which disables it on purpose.
level: medium
False positives
- Clean-up of unused service accounts by the platform team, and infrastructure-as-code runs that remove the accounts of a stack they tear down. Exclude those identities by principalEmail in a filter_* selection and review removals of accounts that production depends on whoever made them.
- Containment of a compromised service account by the response team, which disables it on purpose.
Google Cloud Service Account Key Disabled or Deleted
Detects DisableServiceAccountKey and DeleteServiceAccountKey calls to the IAM API (Admin Activity audit log, always written). A disabled key can no longer authenticate and can be enabled again. A deleted key is gone for good, because Google states that a deleted key cannot be undeleted. Both calls are part of normal key rotation, so the rule is a low-level signal. Triage by the caller (principalEmail), the service account and key in protoPayload.resourceName, and the number of keys the same caller removed. Google lists the method names and the log type but publishes no example of these entries, so the rule matches on the method name alone.
title: Google Cloud Service Account Key Disabled or Deleted
id: 566a9b9f-71ab-4d5d-b527-4a85c85c0dc3
status: experimental
description: >-
Detects DisableServiceAccountKey and DeleteServiceAccountKey calls to the
IAM API (Admin Activity audit log, always written). A disabled key can no
longer authenticate and can be enabled again. A deleted key is gone for
good, because Google states that a deleted key cannot be undeleted. Both
calls are part of normal key rotation, so the rule is a low-level signal.
Triage by the caller (principalEmail), the service account and key in
protoPayload.resourceName, and the number of keys the same caller removed.
Google lists the method names and the log type but publishes no example of
these entries, so the rule matches on the method name alone.
references:
- https://docs.cloud.google.com/iam/docs/audit-logging
- https://docs.cloud.google.com/iam/docs/keys-disable-enable
- https://docs.cloud.google.com/iam/docs/keys-create-delete
author: Forestall
date: 2026-11-18
tags:
- attack.impact
- attack.t1531
logsource:
product: gcp
service: gcp.audit
detection:
selection:
protoPayload.serviceName: iam.googleapis.com
protoPayload.methodName:
- google.iam.admin.v1.DisableServiceAccountKey
- google.iam.admin.v1.DeleteServiceAccountKey
condition: selection
falsepositives:
- Key rotation by people and by rotation automation, which disables and then deletes the old key. Exclude the rotation identities by principalEmail in a filter_* selection.
- Containment of an exposed key by the response team, and migration of an application from key files to Workload Identity Federation.
- Google's own exposure response. Google documents that when it disables a key it found exposed, the entry has the caller gcp-compromised-key-response@system.gserviceaccount.com. That is not an attacker, but the key has leaked, so treat it as compromised.
level: low
False positives
- Key rotation by people and by rotation automation, which disables and then deletes the old key. Exclude the rotation identities by principalEmail in a filter_* selection.
- Containment of an exposed key by the response team, and migration of an application from key files to Workload Identity Federation.
- Google's own exposure response. Google documents that when it disables a key it found exposed, the entry has the caller gcp-compromised-key-response@system.gserviceaccount.com. That is not an attacker, but the key has leaked, so treat it as compromised.
Detection logic
Patterns that need more than one event, a baseline or knowledge of your own environment. Each is a hypothesis to build and tune in your SIEM, not a ready rule.
Service account created and deleted again within a short time
An attacker who creates a service account as a working identity may delete it afterwards to remove the trace. An account whose whole life, from creation to deletion, fits into a short time and that was used in between is that pattern.
- A
google.iam.admin.v1.CreateServiceAccountentry fromiam.googleapis.com. Google's example gives the new account's address inprotoPayload.response.email. - Within 24 hours a
google.iam.admin.v1.DeleteServiceAccountentry for the same account, which is named inprotoPayload.resourceName. - Between the two, collect the entries whose
protoPayload.authenticationInfo.principalEmailis the account, and the keys and role bindings it was given.
Eventsgoogle.iam.admin.v1.CreateServiceAccountgoogle.iam.admin.v1.DeleteServiceAccount
LimitsTest deployments and pipelines that build and tear down an environment create and delete service accounts within minutes, so their callers have to be excluded. Google publishes no example of the delete entry, so check how your entries name the account before joining on it. The 24 hours are a starting point.
Triage
- Identify the caller (protoPayload.authenticationInfo.principalEmail) and the service account or key in protoPayload.resourceName. A person or workload outside the team that manages service accounts is the key signal.
- Count the accounts and keys the same caller disabled or deleted within the hour. One key during a rotation is normal. Many accounts across projects is not.
- Check what the affected accounts are used for, and whether workloads started failing with authentication errors after the call.
- Check whether the caller created the affected account shortly before. An account that is created, used and deleted within a short time points to clean-up of traces, so review what the account did in between.
- Review what else the caller did around the same time, such as allow policy changes, new service account keys, log sink changes and deletions of data.
Response
Once the attack is confirmed:
- Contain the caller first. Remove its service account administration roles and reset its credentials or, if it is a service account, disable it after checking what depends on it.
- Enable the disabled service accounts and keys again, and undelete deleted service accounts. Google documents that a deleted account can be undeleted within 30 days and keeps its identity and roles.
- Replace deleted keys, which cannot be restored. Prefer moving the affected application to an attached service account or to Workload Identity Federation over issuing a new key file.
- Look for what the outage was meant to cover, such as deleted data and backups, changed allow policies, new service accounts and keys, and stopped log exports.
- Confirm that the restored workloads authenticate again, and review who holds the roles that allowed the removal.
Mitigation
- Grant Service Account Admin, Delete Service Accounts and Service Account Key Admin on individual service accounts or small projects, not on folders or the organization, and only to the team that manages service accounts.
- Follow Google's guidance to disable a service account or key first and delete it only after a waiting period, so that a mistaken or hostile removal can be undone.
- Enable change risk recommendations, which Google documents as warning when someone tries to delete a service account that Google Cloud has identified as important.
- Run workloads on attached service accounts and Workload Identity Federation instead of key files, so that fewer applications depend on a credential that can be deleted for good.
- Keep a record of which service accounts production depends on, with their roles, so that a removal can be recognized and reversed quickly.
Frequently asked questions
Can a deleted service account be recovered?
Usually, for a limited time. Google documents that a deleted service account can be undeleted if it was deleted 30 days ago or less and no new account with the same name exists. An undeleted account keeps its identity and its roles. After 30 days IAM removes the account permanently and Google Cloud cannot recover it. A new account created with the same name is a separate identity and does not inherit the roles.
Can a deleted service account key be restored?
No. Google states that a deleted key cannot be undeleted, and recommends disabling a key and waiting before deleting it. A disabled key can be enabled again at any time. Every application that authenticated with a deleted key needs a new credential.
How do I tell an attack from key rotation or clean-up of unused accounts?
A single event does not tell. Rotation, clean-up and the containment of a leaked key produce the same audit entries. Look at who made the call, how many accounts and keys were affected within a short time, and whether production depends on them. The threshold rule on this page counts removals per caller for that reason.
Does disabling or deleting a key stop tokens that were already issued with it?
No. Google documents that disabling or deleting a service account key does not revoke short-lived credentials that were issued based on the key. Those stay valid until they expire, unless the service account itself is disabled or deleted. This matters when the removal is a containment step and not an attack.