GCP_CAN_ACT_AS_SA
Summary
FSProtect ACL Alias
GCP_CAN_ACT_AS_SA
GCP Alias
Persistence & Impersonation
Affected Object Types
Service Accounts
Exploitation Certainty
Likely
Granting Roles
roles/owner, roles/editor, roles/iam.serviceAccountUser
Description
GCP_CAN_ACT_AS_SA indicates that an identity holds iam.serviceAccounts.actAs permission on a GCP Service Account. This permission allows the identity to attach the target SA to GCP infrastructure — specifically when creating or updating VMs, Cloud Run services, Cloud Functions, App Engine apps, or GKE node pools.
Unlike GCP_CAN_IMPERSONATE_SA (which generates tokens directly), GCP_CAN_ACT_AS_SA requires a compute vehicle: the attacker must spin up or modify an infrastructure resource to attach the target SA, then extract its access token from the GCP metadata server.
Key abuse scenarios:
Create a VM with the target SA attached → SSH into VM → extract token from metadata server → use as target SA.
Deploy a Cloud Run service using the target SA → invoke the service → exfiltrate the SA's token from within.
Modify an existing VM's SA attachment to swap in a higher-privilege SA.
Identification
gcloud CLI
GCP Console
Open GCP Console → IAM & Admin → Service Accounts.
Click a service account → Principals with access tab.
Look for principals with
Service Account Userrole.
Exploitation
This path requires both GCP_CAN_ACT_AS_SA and a compute creation capability. → see GCP_CAN_CREATE_COMPUTE.
gcloud CLI
Mitigation
Restrict
roles/iam.serviceAccountUser— assign only when necessary and scope to the minimum required SA, not project-wide.Disable default SA binding on new VMs using org policy:
constraints/compute.disableDefaultServiceAccountCreationBlock project-default SA at compute creation with
constraints/compute.requireOsLogin.Audit VM service account assignments — verify all VMs use purpose-specific minimal SAs.
Enable OS Login to restrict SSH access and tie it to IAM identity.
Detection
Admin Activity
*compute.instances.insert
resource.type=gce_instance, SA field in request
Admin Activity
*compute.instances.setServiceAccount
SA changed on existing VM
Alert on:
VM creation or SA modification attaching a privileged SA to a VM by an unexpected principal.
Metadata server token requests from VMs created within the last 24 hours.
References
https://cloud.google.com/iam/docs/service-accounts#the_service_account_user_role
https://cloud.google.com/compute/docs/access/service-accounts
Last updated
Was this helpful?