PIVTR-D
RGoogle Cloud playbook · Data and storage

Cloud SQL or BigQuery exposed or exported

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.

Look here

LogSearch for
Admin Activity audit log (cloudsql.googleapis.com)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 operationsExports, clones and backups, whatever the audit settings: gcloud sql operations list --instance=<instance> --limit=100
Cloud SQL operationsThe person and the destination bucket of each EXPORT operation, in user and exportContext.uri: gcloud sql operations describe <operation>
Instance configurationCurrent 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 logsDataset access granted to everyone: protoPayload.serviceName="bigquery.googleapis.com" AND protoPayload.metadata.datasetChange:* AND ("allUsers" OR "allAuthenticatedUsers")
BigQuery audit logsAuthorized views in projects you do not own: datasetChange.dataset.acl.authorizedViews
Security Command CenterExfiltration threat findings, and the Security Health Analytics findings PUBLIC_SQL_INSTANCE and PUBLIC_DATASET: Exfiltration: BigQuery Data Exfiltration Exfiltration: BigQuery Data Extraction Exfiltration: BigQuery Data to Google Drive Exfiltration: Cloud SQL Data Exfiltration Exfiltration: Cloud SQL Restore Backup to External Organization

Contain

#Item
1Record the instance state first: gcloud sql instances describe <instance> --format=json
2Save the dataset's access list: bq show --format=prettyjson <project>:<dataset> > <dataset>-acl.json
3Contain the identity that ran the export, following the service account key or Google account playbook
4Remove 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>
5Close 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
6Turn on deletion protection so the attacker cannot delete the evidence: gcloud sql instances patch <instance> --deletion-protection
7Rotate database user passwords the attacker could have read or set: gcloud sql users set-password <user> --instance=<instance> --prompt-for-password
8Delete export files and clones in buckets and projects you own destructive, after hashing and preserving a copy

Eradicate and recover

#Item
1Report export destinations and clones outside your organization to the Legal advisor
2Remove SSL client certificates and database users created in the window
3Enforce sql.restrictAuthorizedNetworks and sql.restrictPublicIp at the organization. The policy file sets enforce: true: gcloud org-policies set-policy <file>
4Enforce domain restricted sharing so new grants to allUsers or outside domains fail. The legacy constraint is iam.allowedPolicyMemberDomains: iam.managed.allowedPolicyMembers
5Enable Data Access audit logs for cloudsql.googleapis.com so the next export is logged
6List exposed tables and databases with exposure times for the notification decision
Watch out
  • 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).

Adapts material from Dynamic Incident Response: A Framework for Security Teams by Joshua Wright, © 2026 The Escal Institute of Advanced Technologies, Inc. d/b/a SANS Institute, licensed under CC BY 4.0. Figures reproduced under that license. Changes were made. Not published by, endorsed by, or affiliated with the SANS Institute.