An attacker opens a Cloud SQL instance to the internet through authorized networks, exports or clones it, or grants allUsers or allAuthenticatedUsers access to a BigQuery dataset. A typical run with a stolen identity exports a database or table to a Cloud Storage bucket the attacker controls, then reads it from outside your organization. Record the current state, contain the identity and close public access first.
Exposure and copy changes: cloudsql.instances.update (authorized networks and public IP), cloudsql.instances.clone, cloudsql.instances.restoreBackup, cloudsql.backups.create, cloudsql.sslCerts.create
Data Access audit log for Cloud SQL (only if enabled)
Exports and database user changes, absent unless DATA_READ and DATA_WRITE were on for cloudsql.googleapis.com: cloudsql.instances.export, cloudsql.users.create, cloudsql.users.update
Cloud SQL operations
Exports, clones and backups, whatever the audit settings: gcloud sql operations list --instance=<instance> --limit=100
Cloud SQL operations
The person and the destination bucket of each EXPORT operation, in user and exportContext.uri: gcloud sql operations describe <operation>
Instance configuration
Current exposure: ipv4Enabled: true with 0.0.0.0/0 or unknown ranges in authorizedNetworks: gcloud sql instances describe <instance> --format='yaml(settings.ipConfiguration)'
BigQuery audit logs (Data Access on by default)
Extract jobs and their destinations, in jobConfig.extractConfig.destinationUris. Repeat with type="COPY" for copies into other projects: gcloud logging read 'protoPayload.methodName="google.cloud.bigquery.v2.JobService.InsertJob" AND protoPayload.metadata.jobInsertion.job.jobConfig.type="EXPORT"' --project=<project> --freshness=30d
BigQuery audit logs
Dataset access granted to everyone: protoPayload.serviceName="bigquery.googleapis.com" AND protoPayload.metadata.datasetChange:* AND ("allUsers" OR "allAuthenticatedUsers")
BigQuery audit logs
Authorized views in projects you do not own: datasetChange.dataset.acl.authorizedViews
Security Command Center
Exfiltration threat findings, and the Security Health Analytics findings PUBLIC_SQL_INSTANCE and PUBLIC_DATASET: Exfiltration: BigQuery Data ExfiltrationExfiltration: BigQuery Data ExtractionExfiltration: BigQuery Data to Google DriveExfiltration: Cloud SQL Data ExfiltrationExfiltration: Cloud SQL Restore Backup to External Organization
Contain
#
Item
1
Record the instance state first: gcloud sql instances describe <instance> --format=json
2
Save the dataset's access list: bq show --format=prettyjson <project>:<dataset> > <dataset>-acl.json
Remove public BigQuery access. Delete the allUsers, allAuthenticatedUsers and unknown view entries from the access array in a copy of the saved file. The file replaces the whole access list: bq update --source <file><project>:<dataset>
5
Close Cloud SQL to the internet. If the instance has a private IP, also remove the public address with --no-assign-ip: gcloud sql instances patch <instance> --clear-authorized-networks
6
Turn on deletion protection so the attacker cannot delete the evidence: gcloud sql instances patch <instance> --deletion-protection
7
Rotate database user passwords the attacker could have read or set: gcloud sql users set-password <user> --instance=<instance> --prompt-for-password
8
Delete export files and clones in buckets and projects you own destructive, after hashing and preserving a copy
Eradicate and recover
#
Item
1
Report export destinations and clones outside your organization to the Legal advisor
2
Remove SSL client certificates and database users created in the window
3
Enforce sql.restrictAuthorizedNetworks and sql.restrictPublicIp at the organization. The policy file sets enforce: true: gcloud org-policies set-policy <file>
4
Enforce domain restricted sharing so new grants to allUsers or outside domains fail. The legacy constraint is iam.allowedPolicyMemberDomains: iam.managed.allowedPolicyMembers
5
Enable Data Access audit logs for cloudsql.googleapis.com so the next export is logged
The Cloud SQL service agent writes the export file, so the bucket owner's logs record the service agent. Tie the export to a person through the operation's user field or the Data Access entry.
An export to a bucket in another organization leaves no copy you can delete. Treat the exported data as disclosed.
bq update --source overwrites the dataset access list. Edit a copy of the file you saved in step 2 so you keep legitimate grants.
Google Cloud documentation: Cloud SQL for MySQL audit logging; Cloud SQL Admin API Operation and instances resources; Cloud SQL organization policy constraints; domain restricted sharing; gcloud sql instances patch, gcloud sql operations list and describe, gcloud sql users set-password reference; BigQuery audit logs migration guide and BigQueryAuditMetadata; Introduction to audit workloads; Control access to resources with IAM (BigQuery); Enable Data Access audit logs; Security Command Center threat findings index and CIS 2.0 posture template. Checked September 2026. Re-checked October 2026: Cloud Audit Logs overview (Data Access off by default except BigQuery).