GCP - common misconfigurations

MisconfigurationRiskWhat to look for
Public GCS bucketshighBucket IAM allows allUsers or allAuthenticatedUsers
Service account keys (user-managed)highJSON keys created - prefer workload identity instead
Broad IAM bindingshighroles/owner, roles/editor on org/folder/project
Public Cloud Functions / Cloud Runmedium--allow-unauthenticated flag set on deploy
Default service account used by computemediumGCE instances using the default SA have project-wide Editor
Firewall rules open to the worldmedium0.0.0.0/0 allowed on SSH/RDP/HTTP

Common tools

ToolPurpose
scoutsuiteMulti-cloud auditing (GCP supported)
gcp_scannerEnumerate GCP resources for misconfigs
GCPBucketBruteBruteforce GCS bucket names
policyuniverseParse and audit GCP IAM policies

Useful commands

# authenticate
gcloud auth login

# whoami
gcloud config get-value account

# list projects
gcloud projects list

# check if a GCS bucket is public
gsutil iam ch -r allUsers:objectViewer gs://BUCKET-NAME 2>/dev/null
gsutil ls -L -b gs://BUCKET-NAME | grep -A1 ACL

# enumerate service accounts
gcloud iam service-accounts list

# list firewall rules
gcloud compute firewall-rules list

# list GCE instances and their service accounts
gcloud compute instances list --format="table(name,zone,status,serviceAccounts[].email)"