| name | cis-gcp-foundations-1.5 |
| description | Ensure That Service Account Has No Admin Privileges |
| category | cis-gcp-foundations |
| version | 4.0.0 |
| author | cyberstrike-official |
| tags | ["cis","gcp","iam","service-accounts","mfa","kms","api-keys"] |
| cis_id | 1.5 |
| cis_benchmark | CIS Google Cloud Platform Foundation Benchmark v4.0.0 |
| tech_stack | ["gcp"] |
| cwe_ids | [] |
| chains_with | [] |
| prerequisites | [] |
| severity_boost | {} |
1.5 Ensure That Service Account Has No Admin Privileges (Automated)
Profile Applicability
Description
A service account is a special Google account that belongs to an application or a VM, instead of to an individual end-user. The application uses the service account to call the service's Google API so that users aren't directly involved. It's recommended not to use admin access for ServiceAccount.
Rationale
Service accounts represent service-level security of the Resources (application or a VM) which can be determined by the roles assigned to it. Enrolling ServiceAccount with Admin rights gives full access to an assigned application or a VM. A ServiceAccount Access holder can perform critical actions like delete, update change settings, etc. without user intervention. For this reason, it's recommended that service accounts not have Admin rights.
Impact
Removing *Admin or *admin or Editor or Owner role assignments from service accounts may break functionality that uses impacted service accounts. Required role(s) should be assigned to impacted service accounts in order to restore broken functionalities.
Audit Procedure
From Google Cloud Console
- Go to
IAM & admin/IAM using https://console.cloud.google.com/iam-admin/iam
- Under the
IAM Tab look for VIEW BY PRINCIPALS
- Filter
PRINCIPALS using type : Service account
- Look for the Service Account with the nomenclature:
SERVICE_ACCOUNT_NAME@PROJECT_ID.iam.gserviceaccount.com
- Ensure that there are no such Service Accounts with roles containing
*Admin or *admin or role matching Editor or role matching Owner under Role column.
From Google Cloud CLI
- Get the policy that you want to modify, and write it to a JSON file:
gcloud projects get-iam-policy PROJECT_ID --format json > iam.json
- The contents of the JSON file will look similar to the following. Note that
role of members group associated with each serviceaccount does not contain *Admin or *admin or does not match or does not match .