Cloud Pen-testing Part -5
## Virtual Machines
List compute instances
```shell
gcloud compute instances listGet shell access to an instance
gcloud beta compute ssh --zone "<region>" "<instance name>" --project "<project name>"Puts public SSH key onto the metadata service for the project
gcloud compute ssh <local host>Get access scopes if on an instance
curl http://metadata.google.internal/computeMetadata/v1/instance/serviceaccounts/default/scopes -H 'Metadata-Flavor:Google'Use Google keyring to decrypt encrypted data
gcloud kms decrypt --ciphertext-file=encrypted-file.enc --plaintext-file=out.txt --key <crypto-key> --keyring <crypto-keyring> --location globalStorage Buckets
List Google Storage buckets
gsutil lsList Google Storage buckets recursively
Copy an item from a bucket
Webapps & SQL
List WebApps
List SQL instances
List SQL databases
Export SQL databases and buckets
First copy buckets to a local directory
Create a new storage bucket, change permissions, export SQL DB
Networking
List networks
List subnets
List VPN tunnels
List Interconnects (VPN)
Containers
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 credentials in ~/.config/gcloud/credentials.db. Search home directories:
Copy gcloud dir to your own home directory to authenticate as the compromised user:
Other Useful Cloud Tools and Techniques
ScoutSuite
Multi-cloud security auditing tool
Install ScoutSuite
To run as root
Scan AWS environment with ScoutSuite
Cloud_Enum
Tool to search for public resources in AWS, Azure, and GCP
Last updated
Was this helpful?