1. Resources
  2. Detection rules
  3. Service Account Created in Google Cloud

Service Account Created in Google Cloud detection rules

An attacker with rights in a project creates a new Google Cloud service account as an identity of their own, then gives it roles, keys or impersonation rights so that access survives the loss of the first foothold.

Platform
Google Cloud
Severity
Medium
Log source
Google Cloud Audit Logs
Last updated
Rule formats
Sigmaand queries for: SplunkMicrosoft SentinelIBM QRadar
What an attacker needs
The iam.serviceAccounts.create permission on a project where service account creation is not blocked by organization policy.
Impact
A durable identity under the attacker's control whose reach depends on the roles, keys and impersonation rights it is given afterwards.
Response
Disable the new service account first, then remove every role binding, key and impersonation grant that names it before you delete it.
Mitigation
Create service accounts only through a provisioning pipeline, and enforce the organization policy that disables service account creation elsewhere.
API method
google.iam.admin.v1.CreateServiceAccount
Threat groups
APT29LAPSUS$

How the attack works

Service accounts are the identities that workloads use in Google Cloud. A principal with iam.serviceAccounts.create on a project can add one. The permission is part of the Create Service Accounts role (roles/iam.serviceAccountCreator), and Google notes that the basic roles might also contain it. Creating a service account grants nothing by itself: the account has no access until someone gives it roles, which the console offers as an optional step of the same creation flow.

Attackers create a service account so that their access no longer depends on the identity they compromised. The name can imitate the workload accounts that already exist in the project, and the calls that follow make the account useful: a role binding that names it, a key created for it or a grant that lets another principal impersonate it. This page covers the creation of the identity. Two neighbouring pages cover the later steps on an existing service account, a user-managed key being created for it and impersonation rights being granted on it.

The creation is written to the Admin Activity audit log as google.iam.admin.v1.CreateServiceAccount. Google's sample query for this event reads the new account from protoPayload.request.account_id (the part before the @) and protoPayload.response.email (the full address).

What an attacker needs

  • The iam.serviceAccounts.create permission on a project, through the Create Service Accounts role or a broader role that includes it.
  • Service account creation not blocked in that project by the organization policy iam.managed.disableServiceAccountCreation or the legacy iam.disableServiceAccountCreation.
  • To make the account useful, the right to grant it roles, to create a key for it or to impersonate it.

Impact

A durable identity under the attacker's control inside the project. Its reach depends on what it is given afterwards: with Owner, Editor or IAM admin roles it controls the project, and with bindings on a folder or the organization it reaches further. Because it looks like one more workload account, it can stay unnoticed after the original foothold is cleaned up.

Detection rules

Service Account Created in Google Cloud

Detects the creation of a service account in a Google Cloud project (Admin Activity audit log). The creation grants nothing by itself, so the rule is a low-level signal: review creations made outside the provisioning pipeline and look for a role binding, a key or an impersonation grant for the new account right after. The new account is in protoPayload.request.account_id and protoPayload.response.email.

LevelLowStatusExperimentalLog sourceGoogle Cloud Audit Logs
title: Service Account Created in Google Cloud
id: 85aa633c-7ca8-47f3-9095-ab6982a9172b
status: experimental
description: >-
  Detects the creation of a service account in a Google Cloud project (Admin
  Activity audit log). The creation grants nothing by itself, so the rule is a
  low-level signal: review creations made outside the provisioning pipeline
  and look for a role binding, a key or an impersonation grant for the new
  account right after. The new account is in protoPayload.request.account_id
  and protoPayload.response.email.
references:
  - https://docs.cloud.google.com/iam/docs/audit-logging
  - https://docs.cloud.google.com/iam/docs/service-accounts-create
  - https://attack.mitre.org/techniques/T1136/003/
author: Forestall
date: 2026-11-16
tags:
  - attack.persistence
  - attack.t1136.003
logsource:
  product: gcp
  service: gcp.audit
detection:
  selection:
    protoPayload.serviceName: iam.googleapis.com
    protoPayload.methodName: google.iam.admin.v1.CreateServiceAccount
  condition: selection
falsepositives:
  - Provisioning pipelines and deployment tools that create service accounts for new workloads. Exclude their identities by protoPayload.authenticationInfo.principalEmail in a filter_* selection, and keep the rule for people and for identities that do not normally create service accounts.
level: low

False positives

  • Provisioning pipelines and deployment tools that create service accounts for new workloads. Exclude their identities by protoPayload.authenticationInfo.principalEmail in a filter_* selection, and keep the rule for people and for identities that do not normally create service accounts.

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 given a key or an impersonation grant by the same caller

Detection hypothesisSequence of eventsNeeds your own lists

A new service account is of no use to an attacker until they can authenticate as it. The creator adding a key for it, or a binding that lets an identity impersonate it, within the hour turns the new account into a way back in. Provisioning pipelines do the same, so the caller is what separates the two.

  1. A google.iam.admin.v1.CreateServiceAccount entry from iam.googleapis.com. Note the new address in protoPayload.response.email and the caller in authenticationInfo.principalEmail.
  2. Within 60 minutes, by the same caller, a google.iam.admin.v1.CreateServiceAccountKey entry whose protoPayload.request.name names the new account.
  3. Or a google.iam.admin.v1.SetIAMPolicy entry on the new account (resource.labels.email_id) whose serviceData.policyDelta.bindingDeltas add a Token Creator, Service Account User or Workload Identity User role.
  4. Raise the pair when the caller is not one of your provisioning identities, and look for the first entries authenticated as the new account.

Eventsgoogle.iam.admin.v1.CreateServiceAccountgoogle.iam.admin.v1.CreateServiceAccountKeygoogle.iam.admin.v1.SetIAMPolicy

LimitsLegacy deployments that create an account and a key file for it in one go, and federation set-ups that grant Workload Identity User, look the same, so the list of provisioning identities is what makes this usable. A key uploaded instead of created, or created by a second identity, is not matched. The 60 minutes are a starting point.

Triage

  • Read the caller (principalEmail), the project (protoPayload.resourceName) and the new account (protoPayload.request.account_id, protoPayload.response.email). Check whether the caller is the usual provisioning identity and whether the name follows your convention or imitates an existing account.
  • Search the Admin Activity log for the new account's email in the minutes and hours after the creation. Look for SetIamPolicy calls that add it as a member, for CreateServiceAccountKey or UploadServiceAccountKey on it, and for a policy change on the service account that grants Token Creator or Service Account User.
  • Review what else the caller did around the same time, such as other service accounts, role changes or organization policy changes.
  • If nobody can explain the account, disable it while you investigate. A disabled service account can be enabled again.

Response

Once the attack is confirmed:

  1. Disable the service account first. That stops it from authenticating, which also blocks access tokens it already obtained, and it can be undone if a workload turns out to depend on the account.
  2. Remove every role binding that names the account, on the project and on folders, the organization and individual resources. Deleting a service account does not remove its bindings at once. Google purges them automatically after at most 60 days, and until then they stay in the policies with a deleted: prefix.
  3. Delete the keys that were created or uploaded for the account, and remove grants that let other principals impersonate it.
  4. Contain the identity that created the account and remove its right to create service accounts, because it can create another one.
  5. Review everything the account did under its own principalEmail, undo it, and then delete the account. A deleted service account can be restored for 30 days, so search the audit log for UndeleteServiceAccount afterwards.

Mitigation

  • Create service accounts only through an approved provisioning pipeline, and enforce iam.managed.disableServiceAccountCreation on projects and folders that do not need new ones.
  • Grant the Create Service Accounts role narrowly, and keep the basic roles Owner and Editor off people and workloads that only need to deploy.
  • Enforce the organization policies that disable service account key creation and key upload, so that a new service account cannot be given a long-lived key.
  • Review service accounts regularly and disable the ones without an owner or recent use. Google recommends disabling a service account before deleting it.

Frequently asked questions

Why is the rule only at level low if this is a persistence step?

Creating a service account grants nothing by itself, and provisioning pipelines and deployment tools produce the same event. The useful signal is a creation outside the normal provisioning path that is followed by a role binding, a key or an impersonation grant for the new account. Raise the priority when the caller is a person or an identity that does not normally create service accounts.

How is this different from a service account key being created?

A key is a new credential for a service account that already exists and already holds roles, so the attacker inherits its access at once. A new service account is a new identity that starts with no access and has to be given roles first. The two often follow each other, since a freshly created account is usually given a key or impersonation rights next.

Where does the audit entry name the new service account?

Google's sample query for this event reads two fields: `protoPayload.request.account_id`, which holds the part of the address before the `@`, and `protoPayload.response.email`, which holds the full address. The caller is in `protoPayload.authenticationInfo.principalEmail`. Use the full address to search for what happened to the account afterwards.

Does deleting the service account remove its access everywhere?

Deleting stops the account from authenticating, but its role bindings are not removed immediately. Google purges them automatically after at most 60 days, and until then they remain in the allow policies with a `deleted:` prefix. A deleted service account can also be restored within 30 days, and a restored account keeps its roles. Remove the bindings yourself and watch for an undelete.

References

We respect your privacy

We use cookies to keep this site secure and working properly. With your permission, we also use optional cookies to understand usage and improve the experience. Cookie Policy

You can change your choice at any time.