gcloud GCP CLI tool
Authentication
1) User Identity Login
gcloud auth login 2) Service Account Login
gcloud auth activate-service-account --key-file=creds.json 3) List accounts available to gcloud
gcloud auth list 4) Prints access token. Can be assigned in a variable later on for other purposes
gcloud auth print-access-token 5) Removes all existing authenticated sessions
gcloud auth revoke --all 6) Adds credHelper for our gcloud region in the ~/.docker/config.json file to pull docker images
gcloud auth configure-docker LOCATION-docker.pkg.dev Account Information
1) Get account information
2) List organizations
3) Enumerate IAM policies set ORG-wide
4) Enumerate IAM policies set per project
5) Save the YAML output locally to a .yml file
6) Enumerate IAM policies with JSON format output
7) List projects
8) Set a different project
9) Gives a list of all APIs that are enabled in project
Repositories/Source Reader permissions
1) Get source code repos available to user
2) Clone repo to home dir
Virtual Machines
1) List compute instances
2) Get shell access to instance
3) Puts public ssh key onto metadata service for project
4) Use Google keyring to decrypt encrypted data
5) Get access scopes if on an instance
Storage Buckets
1) List Google Storage buckets
2) List Google Storage buckets recursively
3) Copy item from bucket
4) Print the item output in our terminal
5) Returns more information about a file
6) List objects stored in a specific bucket within a specific project
Webapps and SQL
1) List webapps
2) List SQL instances
3) List SQL databases
Export SQL databases and buckets
1) First copy buckets to local directory
2) Create a new storage bucket
3) Change permissions
4) Export SQL DB
Networking
1) List networks
2) List subnets
3) List VPN tunnels
4) List Interconnects (VPN)
Containers
1)
GCP Kubernetes config file ~/.kube/config gets generated when you are authenticated with gcloud and run:
If successful and the user has the correct permission the Kubernetes command below can be used to get cluster info:
Serverless
GCP functions log analysis – May get useful information from logs associated with GCP functions
Gcloud stores creds in ~/.config/gcloud/credentials.db Search home directories
Copy gcloud dir to your own home directory to auth as the compromised user
Secrets
1) List the secrets stored in a project
2) Access the secret
Service Account Impersonation
Artifacts
1) Enumerate artifact repository
2) List detailed information about a specific repository
3) List versions of a specific package
Identity Access Management IAM
1) List service accounts in a specific project
2) List permissions and roles assigned on a specific user
3) Check the permissions granted by this role
Last updated