Service account has admin privileges Affecting IAM service in Google


0.0
high
    Severity Framework Snyk CCSS
    Rule category IAM / Least Privilege

Is your enviroment affected by this misconfiguration?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
    Frameworks
    CIS-Controls CIS-Google CSA-CCM HIPAA ISO-27001 PCI-DSS SOC-2
  • Snyk ID SNYK-CC-00348
  • credit Snyk Research Team

Description

Service accounts should not have admin privileges as they give full access to an assigned application or a VM, and a service account can perform critical actions like delete, update, etc. without user intervention.

How to fix?

Remove any administrative roles from service accounts. Administrative roles include roles that have any of the following suffixes admin, roles/editor and roles/owner.

Example Configuration

resource "google_project_iam_member" "valid" {
  role = "roles/viewer"
  member = google_service_account.valid.email
}

resource "google_service_account" "valid" {
  account_id   = "service-account-id"
  display_name = "Service Account"
}