Back to controls

Ensure instances are not configured to use the default service account

It is recommended to configure your instance to not use the default Compute Engine service account because it has the Editor role on the project.

Category

Controls

Medium

Applies to

Google Cloud

Coverage

null controls, 1 queries

Asset types

1 covered

Overview

It is recommended to configure your instance to not use the default Compute Engine service account because it has the Editor role on the project.

Rationale

The default Compute Engine service account has the Editor role on the project, which allows read and write access to most Google Cloud Services. To defend against privilege escalations if your VM is compromised and prevent an attacker from gaining access to all of your project, it is recommended to not use the default Compute Engine service account. Instead, you should create a new service account and assigning only the permissions needed by your instance.

The default Compute Engine service account is named <projectNumber>[email protected].

Remediation guidance

From Google Cloud Console

  1. Go to the VM instances page by visiting: https://console.cloud.google.com/compute/instances
  2. Click on each VM instance name to go to its details page
  3. Click STOP and then click EDIT
  4. Under the section Identity and API access, select a service account other than the default Compute Engine service account. You may first need to create a new service account.
  5. Click Save and then click START

Using Google Cloud CLI

  1. Stop the instance:
gcloud compute instances stop <instanceName>
  1. Update the instance:
gcloud compute instances set-service-account <instanceName> --serviceaccount=<serviceAccount>
  1. Restart the instance:
gcloud compute instances start <instanceName>

Default Value

By default, Compute instances are configured to use the default Compute Engine service account.

References

  1. https://cloud.google.com/compute/docs/access/service-accounts
  2. https://cloud.google.com/compute/docs/access/create-enable-service-accounts-for-instances
  3. https://cloud.google.com/sdk/gcloud/reference/compute/instances/set-service-account

Multiple Remediation Paths

Google Cloud

SERVICE-WIDE (RECOMMENDED when many resources are affected): Enforce Organization Policies at org/folder level so new resources inherit secure defaults.

gcloud org-policies set-policy policy.yaml

ASSET-LEVEL: Use the product-specific remediation steps above for only the impacted project/resources.

PREVENTIVE: Use org policy constraints/custom constraints and enforce checks in deployment pipelines.

References for Service-Wide Patterns

  • GCP Organization Policy overview: https://cloud.google.com/resource-manager/docs/organization-policy/overview
  • GCP Organization policy constraints catalog: https://cloud.google.com/resource-manager/docs/organization-policy/org-policy-constraints
  • gcloud org-policies: https://cloud.google.com/sdk/gcloud/reference/org-policies

Operational Rollout Workflow

Use this sequence to reduce risk and avoid repeated drift.

1. Contain at Service-Wide Scope First (Recommended)

  • Google Cloud: apply organization policy constraints at org/folder scope.
gcloud org-policies set-policy policy.yaml

2. Remediate Existing Affected Assets

  • Execute the control-specific Console/CLI steps documented above for each flagged resource.
  • Prioritize internet-exposed and production assets first.

3. Validate and Prevent Recurrence

  • Re-scan after each remediation batch.
  • Track exceptions with owner and expiry date.
  • Add preventive checks in IaC/CI pipelines.

Query logic

These are the stored checks tied to this control.

Instances are not configured to use the default service account

Connectors

Google Cloud

Covered asset types

VM

Expected check: eq []

vms(where: {serviceAccountEmail_CONTAINS: "[email protected]"}) {...AssetFragment}
Cyscale Logo
Cyscale is an agentless cloud-native application protection platform (CNAPP) that automates the contextual analysis of cloud misconfigurations, vulnerabilities, access, and data, to provide an accurate and actionable assessment of risk.

Stay connected

Receive new blog posts and product updates from Cyscale

By clicking Subscribe, I agree to Cyscale’s Privacy Policy


© 2026 Cyscale Limited

LinkedIn icon
Twitter icon
Facebook icon
crunch base icon
angel icon