4.1 Ensure That Instances Are Not Configured To Use the Default Service Account

Information

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:

When a default Compute Engine service account is created, it is automatically granted the Editor role (roles/editor) on your project which allows read and write access to most Google Cloud Services. This role includes a very large number of permissions. To defend against privilege escalations if your VM is compromised and prevent an attacker from gaining access to all of your project, you should either revoke the Editor role from the default Compute Engine service account or create a new service account and assign only the permissions needed by your instance. To mitigate this at scale, we strongly recommend that you disable the automatic role grant by adding a constraint to your organization policy.

The default Compute Engine service account is named [PROJECT_NUMBER][email protected].

Solution

From Google Cloud Console

Go to the VM instances page by visiting: https://console.cloud.google.com/compute/instances.

Click on the instance name to go to its VM instance details page.

Click STOP and then click EDIT.

Under the section API and identity management, select a service account other than the default Compute Engine service account. You may first need to create a new service account.

Click Save and then click START.

From Google Cloud CLI

Stop the instance:

gcloud compute instances stop <INSTANCE_NAME>

Update the instance:

gcloud compute instances set-service-account <INSTANCE_NAME> --service-account=<SERVICE_ACCOUNT>

Restart the instance:

gcloud compute instances start <INSTANCE_NAME>

Default Value:

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

See Also

https://workbench.cisecurity.org/benchmarks/11843

Item Details

Category: IDENTIFICATION AND AUTHENTICATION

References: 800-53|IA-5, CSCv7|4.7

Plugin: GCP

Control ID: 9a5c80949435c0b4985f105f0b612e57aef2d55c24e0f3c28762b67de489427c