Google Cloud - Attack Overview PT.1
Google Cloud - Attack Overview PT.1
– ATTACK
OVERVIEW PT.1
Joas Antonio
https://www.linkedin.com/in/joas-antonio-dos-
santos
GOOGLE CLOUD
SERVICES
GCP PLATFFORM
https://cloud.google.com/blog/products/identity-security/getting-
started-with-identity-platform
https://support.google.com/a/answer/106368?hl=en#:~:text=With
%20Google%20Cloud%20Directory%20Sync,files)%20to%20your%2
0Google%20Account.
https://cloud.google.com/architecture/identity/federating-gcp-with-
active-directory-synchronizing-user-accounts
https://www.youtube.com/watch?v=PJ0nR9vx38U (GSPS)
GCP PLATFFORM #2
GAM is a command line tool for Google Workspace admins to manage
domain and user settings quickly and easily.
GitHub - GAM-team/GAM: command line management for Google
Workspace
GCP PLATFFORM #3
Zones and Regions: https://cloud.google.com/compute/docs/regions-zones
API: https://cloud.google.com/apis/docs/overview
IAM: https://cloud.google.com/iam?hl=pt-br
https://www.trendmicro.com/cloudoneconformity-staging/knowledge-
base/gcp/CloudIAM/
GCP PLATFORM #4
Type of member in GCP
○ Google Account
○ Service account
○ Google group
○ All users
○ Basic roles: Roles historically available in the Google Cloud Console. These roles are Owner, Editor, and Viewer.
○ Predefined roles: Roles that give finer-grained access control than the basic roles.
○ Custom roles: Roles that you create to tailor permissions to the needs of your organization when predefined roles don't meet your needs.
GCP PLATFORM #5
An Identity and Access Management (IAM) policy, which specifies
access controls for Google Cloud resources.
gcloud auth activate-service-account --key-file creds.json gcloud beta asset search-all-iam-policies --query
policy:"projects/xxxxxxxx/roles/CustomRole436" --project=xxxxxxxx
gcloud auth activate-service-account --project=<projectid> --key-
file=filename.json gcloud projects list
gcloud organizations get-iam-policy <org ID> gcloud source repos clone <repo_name>
GCP ENUMERATION TECHNIQUES
#2
gcloud compute instances list project
gcloud compute instances list --impersonate-service- gcloud compute ssh <local host>
account AccountName
curl
gcloud compute instances list -- http://metadata.google.internal/computeMetadata/v
configuration=stolenkeys 1/instance/service-accounts/default/scopes -H
'Metadata-Flavor:Google’
gcloud compute instances describe <instance id>
# Use Google keyring to decrypt encrypted data
gcloud compute instances describe <InstanceName> -
-zone=ZoneName --format=json | jq -c gcloud kms decrypt --ciphertext-file=encrypted-file.enc
'.serviceAccounts[].scopes[]' --plaintext-file=out.txt --key <crypto-key> --keyring
<crypto-keyring> --location global
gcloud beta compute ssh --zone "<region>" "<instance
name>" --project "<project name>"
# Puts public ssh key onto metadata service for
GCP ENUMERATION TECHNIQUES
#3
# Storage Buckets # Webapps & SQL
List Google Storage buckets gcloud app instances list
gsutil ls gcloud sql instances list
gsutil ls -r gs://<bucket name> gcloud spanner instances list
gsutil cat gs://bucket-name/anyobject gcloud bigtable instances list
gsutil cp gs://bucketid/item ~/ gcloud sql databases list --instance
<instance ID>
gcloud spanner databases list --instance
<instance name>> --location global
GCP ENUMERATION TECHNIQUES
#4
# Networking # Containers
gcloud compute networks list gcloud container clusters list
gcloud compute networks subnets list # GCP Kubernetes config file
~/.kube/config gets generated when you
gcloud compute vpn-tunnels list are authenticated with
gcloud compute interconnects list gcloud container clusters get-credentials
gcloud compute firewall-rules list <cluster name> --region <region>
gcloud functions describe <function name> gcloud sql backups list --instance=test
gcloud functions logs read <function name> --limit <number of lines> # Metadata Service URL
https://www.youtube.com/watch?v=vTgQLzeBfRU
https://about.gitlab.com/blog/2020/02/12/plundering-gcp-escalating-privileges-in-google-cloud-platform/
https://cloud.google.com/kubernetes-engine/docs/resources/security-patching?hl=pt-br
https://www.youtube.com/watch?v=L_ej12aahNI
https://89berner.medium.com/persistant-gcp-backdoors-with-googles-cloud-shell-2f75c83096ec
https://sysdig.com/blog/gcp-security-best-practices/
https://www.netskope.com/blog/gcp-oauth-token-hijacking-in-google-cloud-part-1
https://www.netskope.com/blog/targeted-attacks-abusing-google-cloud-platform-open-redirection
https://www.systoolsgroup.com/how-to/report-ip-abuse/
https://threatpost.com/hackers-abuse-google-cloud-platform-to-attack-d-link-routers/143492/
https://github.com/dxa4481/AttackingAndDefendingTheGCPMetadataAPI
https://github.com/4ndersonLin/awesome-cloud-security
EXTRAS AND TRAININGS
https://github.com/kh4sh3i/cloud-penetration-testing
https://github.com/Littlehack3r/awesome-gcp-pentesting
https://www.cyberwarfare.live/
https://www.sans.org/cyber-security-courses/cloud-penetration-
testing/
https://www.getastra.com/blog/security-audit/google-cloud-
penetration-testing/