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:

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 [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/9562

Item Details

Category: IDENTIFICATION AND AUTHENTICATION

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

Plugin: GCP

Control ID: 36512cf439420fa2a65296f1cf7380cbdeebfb550d0ba388b4a705e1c9b61352