For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/default_rules/def-000-9fj.md. A documentation index is available at /llms.txt.

Instances should be configured to use a non-default service account with restricted API access

Description

This rule fails when an instance uses the Compute Engine default service account (PROJECT_NUMBER-compute@developer.gserviceaccount.com) with the https://www.googleapis.com/auth/cloud-platform access scope, which the console calls “Allow full access to all Cloud APIs”. The default service account can hold the project Editor role, so this scope lets anything running on the instance use those permissions against every Cloud API, which can lead to privilege escalation. The check matches the full-access scope exactly: narrower scopes such as https://www.googleapis.com/auth/cloud-platform.read-only pass, and so do instances that use a user-managed service account. GKE nodes, identified by a name starting with gke- together with a goog-k8s-cluster-name label, are skipped.

Remediation

  1. Stop the instance.
  2. Attach a user-managed service account that has only the roles the workload needs, or keep the default service account and select narrower access scopes, following Attach the service account and update the access scope.
  3. Start the instance.

References