๐ก๏ธ Google GCE Instance is configured to use the Default Service Account with full access to all Cloud APIs๐ข
- Contextual name: ๐ก๏ธ Instance is configured to use the Default Service Account with full access to all Cloud APIs๐ข
- ID:
/ce/ca/google/compute-engine/instance-use-default-service-account-with-full-access - Tags:
- ๐ข Policy with categories
- ๐ข Policy with type
- ๐ข Production policy
- Policy Type:
COMPLIANCE_POLICY - Policy Categories:
SECURITY
Logicโ
- ๐ง prod.logic.yaml๐ข
Similar Policiesโ
- Cloud Conformity: Check for Instance-Associated Service Accounts with Full API Access
Descriptionโ
Descriptionโ
To support principle of least privileges and prevent potential privilege escalation it is recommended that instances are not assigned to default service account
Compute Engine default service accountwith ScopeAllow full access to all Cloud APIs.Rationaleโ
Along with ability to optionally create, manage and use user managed custom service accounts, Google
Compute Engine provides default service accountCompute Engine default service account for an instances to access necessary cloud services.Project Editorrole is assigned toCompute Engine default service accounthence, This service account has almost all capabilities over all cloud services except billing. However, whenCompute Engine default service accountassigned to an instance it can operate in 3 scopes.1. Allow default access: Allows only minimum access required to run an Instance (Least Privileges)
2. Allow full access to all Cloud APIs: Allow full access to all the cloud APIs/Services (Too much access)... see more
Remediationโ
Remediationโ
From Google Cloud Consoleโ
- Go to the
VM instancespage by visiting: https://console.cloud.google.com/compute/instances.- Click on the impacted VM instance.
- If the instance is not stopped, click the
Stopbutton. Wait for the instance to be stopped.- Next, click the
Editbutton.- Scroll down to the
Service Accountsection.- Select a different service account or ensure that
Allow full access to all Cloud APIsis not selected.- Click the
Savebutton to save your changes and then clickSTART.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> --scopes [SCOPE1, SCOPE2...]Restart the instance:
gcloud compute instances start <INSTANCE_NAME>