Database security threats and mitigations

This document identifies potential threats to the confidentiality, integrity, and availability of your data in Cloud SQL. For each threat, the document classifies the threat using the STRIDE and MITRE ATT&CK frameworks, describes the attack vectors through which the threat can manifest, and recommends mitigation strategies. The scope of this report is limited to your perspective, focusing on risks that you can manage within your Cloud SQL environment.

Notice: These threat models are based on currently known attack vectors and architectural assumptions. They are not exhaustive and serve as a baseline example to help Google Cloud customers assess their risk and guide their security decisions.

Threat details

The following sections provide information about each threat, their manifestations, and recommendations for mitigating such threats.

Each threat is classified using the following frameworks:

  • STRIDE category: STRIDE is a threat modeling framework that groups threats into six categories, based on the security property that the threat violates:

    • Spoofing: an attacker impersonates another user, service, or system. Violates authentication.
    • Tampering: an attacker modifies data, configurations, or code without authorization. Violates integrity.
    • Repudiation: an attacker performs actions that can't be traced back to them. Violates non-repudiation, such as through audit logging.
    • Information disclosure: an attacker gains access to data that they aren't authorized to see. Violates confidentiality.
    • Denial of service: an attacker prevents legitimate users from accessing a resource. Violates availability.
    • Elevation of privilege: an attacker gains permissions beyond what they were granted. Violates authorization.

    The manifestations for each threat also note the relevant STRIDE category in parentheses.

  • MITRE ATT&CK tactic: MITRE ATT&CK (Adversarial Tactics, Techniques, and Common Knowledge) is a publicly available knowledge base of attacker behavior based on real-world observations. In ATT&CK, a tactic describes the attacker's goal at a particular stage of an attack, such as Initial Access, Privilege Escalation, Persistence, or Exfiltration.

Identity and access management

This section describes threats that result from overly permissive Identity and Access Management (IAM) and database access controls.

Excessive IAM permissions leading to privilege escalation and instance takeover

If an IAM principal, such as a user or service account, is granted overly permissive roles (for example, roles/cloudsql.admin or roles/editor), and they're compromised, then an attacker can perform unauthorized actions on extensive Cloud SQL resources. This threat can lead to data compromise, data destruction, or a takeover of the database environment.

STRIDE category

Elevation of Privilege

MITRE ATT&CK tactic

Privilege Escalation

Manifestations
  • Instance deletion (tampering): An attacker with the cloudsql.instances.delete permission can permanently delete the database instance.

  • Security downgrade (tampering): An attacker with cloudsql.instances.update can disable security features like backups and high availability, or modify network configurations (authorized networks) to allow public access.

  • Data destruction (tampering): An attacker with cloudsql.instances.restoreBackup can overwrite the live database with an older, irrelevant, or malicious backup.

  • Privilege escalation (elevation of privilege): An attacker with cloudsql.instances.setIamPolicy can grant themselves or other entities higher-level permissions, including ownership of the instance.

  • Data access (information disclosure): An attacker with permissions to update users (cloudsql.users.update) can reset database user passwords and gain direct data plane access to the contents of the database.

  • Logical data deletion (tampering): An attacker with cloudsql.databases.delete can delete specific logical databases within an instance, which causes targeted data loss without destroying the entire instance.

  • User lockout and persistence (tampering): An attacker can use cloudsql.users.create and cloudsql.users.delete to remove legitimate database users (denial of service) or create their own backdoor user accounts for persistent data plane access.

  • Control-plane to data-plane escalation: A principal with cloudsql.users.create or cloudsql.users.update can create or modify database users, which grants them high-privilege database access directly to the data.

  • Replica takeover: A principal with the cloudsql.instances.promoteReplica permission can use the sql.instances.promoteReplica API method to promote a read replica to a standalone primary instance, which can divert application traffic or disrupt disaster recovery.

Mitigations
  • Implement the principle of least privilege for all IAM principals. Instead of assigning broad basic roles like roles/editor, use predefined, granular Cloud SQL roles such as roles/cloudsql.viewer, roles/cloudsql.client, or roles/cloudsql.editor. Create custom IAM roles if necessary to grant only the specific permissions required for a task. Regularly audit IAM policies using Cloud Asset Inventory or Recommender to identify and remove excessive permissions.

  • Separation of duties for agents. If an agent needs to read data and write to a log, use two separate, minimally-scoped service accounts: one for high-risk data access and one for low-risk operational tasks.


Excessive privileges using broad built-in database roles

Overusing broad built-in roles like cloudsqlsuperuser for application users instead of fine-grained ACLs significantly increases the potential impact of a credential breach. Application users are frequently granted high-privilege built-in roles (for example, cloudsqlsuperuser in PostgreSQL) that allow them to drop tables, modify other users, or change engine flags, rather than limiting them to specific table-level permissions.

STRIDE category

Elevation of Privilege

MITRE ATT&CK tactic

Privilege Escalation

Manifestations

An attacker compromises an application credential and, because it has cloudsqlsuperuser privileges, is able to exfiltrate the entire database using a Cloud SQL export job or delete database logs to cover their tracks.

Mitigations
  • Implement database role-based access control (RBAC) at the schema and table level, following the principle of least privilege.

  • Avoid granting cloudsqlsuperuser to human or service account users unless strictly required for administrative maintenance.

  • Configure and enable Model Armor for all agentic integrations.


Privilege escalation using PostgreSQL search_path hijacking

If high-privileged PostgreSQL users don't have their search_path parameter explicitly and safely set, they are vulnerable to hijacking. A lower-privileged user can create malicious functions (for example, in the public schema) that shadow standard functions. When the privileged user executes a query, they might unknowingly execute the malicious code, leading to unauthorized data access, modification, or privilege escalation within the database.

STRIDE category

Elevation of Privilege

MITRE ATT&CK tactic

Privilege Escalation

Manifestations

A low-privileged user creates a function named version() in the public schema that contains malicious SQL code. Then a superuser or other high-privileged role, without search_path secured to pg_catalog, connects and runs a query that calls version(). The malicious function from public is executed instead of the system's built-in function, with the privileges of the superuser.

Mitigations
  • Set the search_path to pg_catalog for all high-privileged roles. This can be done persistently using the following: ALTER ROLE SET search_path = pg_catalog;.

  • Audit database user and role configurations so that the search_path is correctly set for all privileged accounts.

  • Restrict or revoke permissions to create objects in the public schema from untrusted users. Consider using a different default schema for user objects.


Reliance on static password authentication for data-plane access

The use of static, long-lived database passwords for authentication creates a high risk of credential theft, brute-force discovery, and reuse across services.

STRIDE category

Spoofing

MITRE ATT&CK tactic

Credential Access

Manifestations

An attacker gains access to a credential and uses it to access the database without triggering any multi-factor or identity-based alerts.

Mitigations
  • Enforce IAM database authentication for all human and service account access, so that login tokens are short-lived and tied to an authenticated Google identity.

  • Implement Cloud SQL password policies only as a fallback for legacy applications. Enforce strong passwords and regular rotation for any remaining local database users.


Network security

This section describes threats that result from insecure network paths and connectivity configurations to your Cloud SQL instances.

Compromise of network security through vulnerabilities when using outdated Cloud SQL Auth Proxy

Using an outdated version of the Cloud SQL Auth Proxy client can expose connections to known security vulnerabilities. Attackers can exploit these flaws to intercept traffic, bypass authentication, or gain unauthorized access to the Cloud SQL instance, even if server-side configurations are secure.

STRIDE category

Elevation of Privilege

MITRE ATT&CK tactic

Privilege Escalation

Manifestations
  • An attacker exploits a known vulnerability (for example, remote code execution, authentication bypass) in an older version of the Cloud SQL Auth Proxy running on a client machine or service, compromising the connection.

  • Sensitive data in transit between the client and the proxy, or proxy and Google's frontends, can be exposed if the vulnerability affects TLS handling.

Mitigations
  • Ensure all clients using the Cloud SQL Auth Proxy are running the latest stable version.

  • Implement automated processes to regularly check for and deploy updates to the Cloud SQL Auth Proxy.


Insecure network configuration exposing database to unauthorized access

Misconfiguration of network controls for a Cloud SQL instance can expose it to the public internet, making it a target for reconnaissance, brute-force attacks, and exploitation of potential vulnerabilities. This risk is primarily associated with instances configured with a public IP address.

STRIDE category

Information Disclosure

MITRE ATT&CK tactic

Initial Access

Manifestations
  • Unrestricted internet exposure: Assigning a public IP to the Cloud SQL instance and configuring authorized networks with an overly permissive CIDR range like 0.0.0.0/0. This lets any system on the internet attempt a connection to the database port.

  • Weak network segmentation: Using broad internal IP ranges in authorized networks that include untrusted or unnecessary networks, which increases the attack surface within the cloud environment.

  • Unencrypted client connections: If the instance does not enforce SSL/TLS, a client connecting over an untrusted network can transmit credentials and sensitive data in cleartext, which makes it vulnerable to on-path attacks.

Mitigations
  • Prefer private IP connectivity for Cloud SQL instances by using a VPC network and Private Service Access. If a public IP is unavoidable, strictly limit the authorized networks configuration to the smallest possible set of specific, trusted IP addresses. Enforce the use of the Cloud SQL Auth Proxy for all client connections, as it provides an encrypted tunnel and uses IAM for authentication instead of relying solely on network location. Use the sql.restrictPublicIp organization policy constraint to programmatically prevent the creation of Cloud SQL instances with public IPs across the organization.

  • Prefer private IP connectivity using a VPC network and Private Services Access so that the database is not routable from the public internet. Apply the sql.restrictPublicIp organization policy to programmatically prevent the creation of public IP instances.

  • If a public IP is required, strictly limit the authorized networks allowlist to the specific, trusted IP addresses of client applications.

  • Enforce the use of the Cloud SQL Auth Proxy or Language Connectors for all connections to provide an encrypted mTLS tunnel and IAM-based authorization.

  • Leverage built-in brute-force protection to get log alerts and real-time throttling to mitigate automated login attempts.

  • Use IAM database authentication instead of static, password-based users to eliminate the risk of credential theft and brute-force attacks on weak passwords of publicly visible databases.

  • Implement a VPC Service Controls perimeter to restrict sensitive data access and services from outside the trusted environment. In particular, restrict access to the Storage and Cloud SQL services to help prevent data exfiltration.and administrative access to the Cloud SQL instance from compromised credentials outside the perimeter.


Network access exposed through excessively large authorized networks

By configuring excessively large CIDR blocks in authorized networks, administrators allow access from millions of untrusted hosts, undermining network-level isolation and enabling threat actors within those ranges to attempt unauthorized connections.

STRIDE category

Information Disclosure

MITRE ATT&CK tactic

Initial Access

Manifestations

A customer configures a very broad network range (for example, a /8 prefix) in authorized networks, unnecessarily increasing the attack surface by allowing connections from millions of hosts.

Mitigations
  • If you use authorized networks, use a CIDR prefix no smaller than /16, and preferably greater than /19. Use strong authentication to control access to the database, and consider consider strategies like using a proxy or bastion host with a smaller authorized network range.

  • Where possible, enforce the sql.restrictAuthorizedNetworks organization policy to prevent the use of authorized networks accessing the database from the public internet, and configure private IP connections instead.


Data encryption and compliance

This section describes threats to the availability and confidentiality of encrypted data, and to meeting compliance requirements for encryption.

Availability loss due to disabled or destroyed customer-managed encryption key

When a Cloud SQL instance is configured with a customer-managed encryption key (CMEK), its availability depends on the availability of the Cloud Key Management Service key. If the key is disabled or destroyed, the Cloud SQL instance can't decrypt its data, which compromises the availability and might lead to permanent data loss.

STRIDE category

Denial of Service

MITRE ATT&CK tactic

Impact

Manifestations
  • Malicious or accidental key destruction: A principal with administrative privileges over the Cloud KMS key (for example, roles/cloudkms.admin) can maliciously or accidentally destroy the key material, which makes all data in the Cloud SQL instance and its backups irrecoverable.

  • Key disablement: A principal with administrative privileges over the Cloud KMS key can disable the key, which interferes with data access and availability until the key is re-enabled.

  • Permission loss on service agent: If the IAM binding that grants the Cloud SQL Service Agent the roles/cloudkms.cryptoKeyEncrypterDecrypter role on the key is removed, the instance loses its ability to perform cryptographic operations, which compromises the availability of the data.

Mitigations
  • Strictly limit IAM permissions on the CMEK. The Cloud SQL Service Agent requires the roles/cloudkms.cryptoKeyEncrypterDecrypter role. Avoid granting administrative permissions like roles/cloudkms.admin to any user or service account not explicitly tasked with key lifecycle management.

  • Enable CMEK deletion protection to prevent accidental or malicious destruction of the key material. Use the organization policy constraint constraints/cloudkms.minimumDestroyScheduledDuration to set a minimum period during which a key version scheduled for destruction remains recoverable.


Inconsistent encryption protection level for data cache on local SSD

Cloud SQL has the ability to enable a data cache backed by local SSD to increase query performance. Local SSD disks have encryption-at-rest using Google default encryption, but are not compatible with customer-managed encryption keys or customer-supplied encryption keys. If the customer has regulatory or compliance requirements for managing their own encryption keys, then using data cache on a local SSD can cause non-compliance.

STRIDE category

Information Disclosure

MITRE ATT&CK tactic

Collection

Manifestations
  • A customer is using CMEK to encrypt their data at rest. They enable data cache on a local SSD to improve query performance, but their audit team determines this configuration does not meet their compliance requirements.

  • An attacker with access to the underlying infrastructure or exploiting a hypervisor vulnerability accesses the local SSD cache.

Mitigations

If you have requirements to manage your own encryption keys through CMEK or CSEK, disable data cache features.


Unauthorized access to plain text PII in masked PostgreSQL databases

Data masking and anonymization functions (like dynamic mask) only affect the presentation layer for specific users; the underlying data remains stored in the database as plain text. A compromise of a high-privilege administrative account renders masking ineffective.

STRIDE category

Information Disclosure

MITRE ATT&CK tactic

Collection

Manifestations

An internal attacker or a compromised administrator bypasses the dynamic masking engine to query the base tables directly, viewing PII such as unmasked email addresses and passwords that were intended to be hidden.

Mitigations

Use the pgcrypto extension to hash or encrypt PII at the storage layer before it is written to the disk. This helps ensure that even an administrator cannot view the raw data without the specific decryption key.


Backup, recovery, and resiliency

This section describes threats to the availability and recoverability of your data, including destructive actions and resource exhaustion.

Abuse of read replica functionality for data exfiltration or takeover

An attacker with sufficient IAM permissions can abuse the read replica functionality to either exfiltrate data or disrupt service. This functionality, while useful for scaling and disaster recovery, presents a risk if not properly secured.

STRIDE category

Information Disclosure

MITRE ATT&CK tactic

Exfiltration

Manifestations
  • Data exfiltration using cloning: An attacker with the cloudsql.instances.create permission can create a read replica (clone) of a production database instance. Once the replica is created, the attacker has a complete, isolated copy of the data, which can be accessed and exfiltrated without affecting the primary instance or triggering data plane alerts.

  • Service disruption using promotion: An attacker with the cloudsql.instances.update permission can promote an existing read replica to become the new primary instance. This can cause a denial of service for applications connected to the original primary and can be used as part of a larger takeover strategy.

Mitigations

Apply the principle of least privilege so that only essential administrative principals have permissions like cloudsql.instances.create, cloudsql.instances.clone, and cloudsql.instances.promoteReplica. Monitor Cloud Audit Logs for sql.instances.clone and sql.instances.promoteReplica API calls and alert on unauthorized or unexpected activity.


Data destruction using malicious deletion of database resources

An attacker with specific IAM permissions can maliciously delete critical database resources, which leads to permanent data loss for applications that rely on the database. This is a direct impact attack that undermines data availability and integrity.

STRIDE category

Tampering

MITRE ATT&CK tactic

Impact

Manifestations
  • Instance deletion: An attacker with the cloudsql.instances.delete permission can use the sql.instances.delete API method to permanently delete an entire Cloud SQL instance. This action destroys all data, backups, replicas, and configurations associated with the instance.

  • Logical database deletion: An attacker with the cloudsql.databases.delete permission can use the sql.databases.delete API method to delete a specific logical Cloud SQL database within an instance. This results in targeted data loss without destroying the entire instance.

Mitigations

Strictly apply the principle of least privilege and avoid granting cloudsql.instances.delete or cloudsql.databases.delete permissions to any principals that don't explicitly require them for their operational duties. Enable the deletion protection flag on critical Cloud SQL instances to prevent accidental or malicious deletion. Ensure automated backups are configured with a sufficient point-in-time recovery window to restore data if a destructive action occurs.


Data destruction using schema tampering

An attacker with schema-modification permissions can render critical tables unusable or cause silent data corruption, disrupting application access and compromising the integrity of stored database information.

STRIDE category

Tampering

MITRE ATT&CK tactic

Impact

Manifestations

A principal with cloudsql.instances.update or a high-privilege built-in role (for example, cloudsqlsuperuser) executes an ALTER TABLE command to change a column's data type, resulting in loss of information or breaking all downstream queries from client applications.

Mitigations
  • Strictly limit permissions for schema modification (for example, ALTER TABLE) to a small number of trusted administrators or automated CI/CD service accounts.

  • Enable Cloud SQL table snapshots or point-in-time recovery (PITR) to recover from malicious or accidental structural changes.


Denial of service using resource exhaustion or destructive API calls

An attacker can tamper with a Cloud SQL instance to make it unavailable to legitimate applications. This can be achieved by exhausting instance resources through the data plane, or by using control plane permissions to alter or destroy the instance.

STRIDE category

Denial of Service

MITRE ATT&CK tactic

Impact

Manifestations
  • Destructive API calls: A compromised IAM principal with cloudsql.instances.delete can destroy the instance, or with cloudsql.instances.update can stop it or resize it to an unusable configuration.

  • Data plane resource exhaustion: A compromised end-user application or a malicious client can flood the instance with a high volume of connections or computationally expensive queries, which exhausts CPU, memory, or storage resources.

  • Cryptographic key destruction (CMEK): If using customer-managed encryption keys, an attacker with permissions on the Cloud KMS key (for example, cloudkms.cryptoKeyVersions.destroy) can destroy the key material, which makes all data in the database permanently unreadable and inaccessible.

Mitigations
  • Protect against destructive API calls by applying least-privilege IAM roles and enabling deletion protection on the Cloud SQL instance. Secure CMEK keys with restrictive IAM policies.

  • For data plane protection, implement connection pooling and rate limiting in applications, optimize queries to prevent resource spikes, and configure Cloud Monitoring alerts for key metrics (CPU, memory, active connections) to enable early detection of anomalous activity.


Disk exhaustion denial of service using excessive logging or transaction operations

Excessive logging or transaction operations can exhaust the available disk storage of a Cloud SQL instance. Specifically, high-volume database auditing (such as pgAudit logging verbose statements) or elevated write activity generating substantial transaction (binary/write-ahead) logs can consume all free disk space, causing instance unavailability or failure.

STRIDE category

Denial of Service

MITRE ATT&CK tactic

Impact

Manifestations
  • Audit log disk/resource exhaustion: A malicious actor or misconfigured application generates a high volume of database queries that are captured by auditing (such as pgAudit), which rapidly consumes available disk space and I/O capacity and results in a denial of service.

  • Transaction log disk exhaustion: High write activity generates a large volume of transaction (binary) logs. An instance, even when enabled for automatic storage increases, experiences rapid disk growth due to log retention, potentially leading to a denial of service if the disk hits its limit.

Mitigations
  • Size instance storage to account for transaction log retention.

  • Set a metrics-based alerting policy for the disk utilization metric to trigger when available space falls below 20%.


Information disclosure in backups using row-level security (RLS) suspension

To help ensure that database backups are complete, administrators can disable RLS during the pg_dump process. This creates a risk where the resulting backup files contain sensitive PII in plain text that was otherwise hidden from users in the live database.

STRIDE category

Information Disclosure

MITRE ATT&CK tactic

Exfiltration

Manifestations

A developer or an attacker gains access to a database backup file and discovers they can read all tenant data because the RLS filters were suspended when the row_security parameter was set to OFF for the backup user.

Mitigations

Use the Anonymous Dump (pg_dump_anon) feature of the postgresql_anonymizer extension to export masked data instead of live PII when backups are needed for non-production environments.


Recovery failure or prolonged outage due to disabled point-in-time recovery (PITR)

Without PITR or sufficient backup retention, destructive actions (malicious or accidental) can't be precisely rolled back, which significantly extends downtime and data loss.

STRIDE category

Tampering

MITRE ATT&CK tactic

Impact

Manifestations

An attacker performs a destructive action, such as dropping tables or deleting data. Because point-in-time recovery (PITR) is disabled or misconfigured, administrators are unable to restore the database to the exact moment before the attack, which results in permanent data loss and prolonged service disruption.

Mitigations

Enable point-in-time recovery (PITR) and automated backups for all critical Cloud SQL instances. Ensure that the backup retention period aligns with the organization's recovery point objective (RPO) and recovery time objective (RTO) requirements. Regularly test the restoration process to verify its effectiveness.


Monitoring and logging

This section describes threats that result from gaps in logging, auditing, and monitoring, which can let attacks go undetected.

Insufficient logging and monitoring preventing threat detection and response

A lack of comprehensive logging and monitoring for both the control plane and data plane of Cloud SQL can let an attacker's activities go undetected. This prevents timely incident response and makes forensic investigation difficult, which lets an attacker maintain persistence and cover their tracks.

STRIDE category

Repudiation

MITRE ATT&CK tactic

Defense Evasion

Manifestations
  • Lack of data access logging: By default, Google Cloud Admin Activity audit logs are enabled, but Data Access audit logs (which record read operations and API calls that don't modify data) are not. This lets an attacker perform reconnaissance on instance configurations and backups using the Cloud SQL Admin API without leaving a trace.

  • No database-level auditing: Cloud SQL does not enable detailed database-level auditing by default. Without configuring database flags like pgaudit, specific queries run by a database user (for example, SELECT from a sensitive table) are not logged.

  • Log tampering: An attacker with permissions to modify Cloud Logging configurations (logging.sinks.update) or delete logs (logging.logEntries.delete) can erase evidence of their malicious activity.

  • Inadequate performance monitoring: Failure to configure alerts in Cloud Monitoring for key performance metrics (for example, sustained high CPU utilization, abnormal spikes in active connections, or low storage) prevents the real-time detection of ongoing attacks. This lets data plane attacks like denial of service (resource exhaustion) or brute-force password attempts proceed without an operational response.

  • Inadequate threat monitoring: Failure to configure alerts in Cloud Monitoring for key performance metrics (for example, sustained high CPU utilization) or built-in brute-force detection metrics prevents the real-time identification of ongoing credential-based attacks.

Mitigations
  • Enable Data Access audit logs for the Cloud SQL Admin API so that all control plane actions (including reads) are recorded. Configure database-level auditing within the Cloud SQL instance settings to capture sensitive data plane operations.

  • To protect log integrity, export logs to a separate, dedicated logging project with highly restricted access.

  • Establish alerting policies in Cloud Monitoring for anomalous activity, such as spikes in CPU utilization, memory, or active connections, to enable rapid detection of potential DoS or brute-force attacks. To protect log integrity, export logs to a separate, dedicated logging project with highly restricted access.

  • Establish metrics-based or log-based alerting policies in Cloud Monitoring to notify administrators of brute-force access attempts. Leverage the built-in detection metrics that identify suspicious volumes of failed logins to trigger an 'above threshold' alert, enabling proactive containment of potential breaches.

  • Implement agent-specific logging for LLM-driven applications that interface with the database. This logging must record the raw SQL string generated by the LLM prior to validation or execution, along with the final tool execution workflow decision (for example, human-in-the-middle approval versus agent-only autonomous execution) to improve integrity and auditability of AI actions.


Risk of unreviewed Google administrative access due to disabled Access Approval and Access Transparency

When Access Approval is not enabled, Google personnel can access your resources during support or incident response without first getting your explicit approval. When Access Transparency is not enabled, you have no visibility into when and why Google administrators interact with your data plane or control plane resources.

STRIDE category

Repudiation

MITRE ATT&CK tactic

Defense Evasion

Manifestations

A Google employee accesses a production instance or sensitive logs containing PII to troubleshoot an issue. Because Access Approval is disabled, the access proceeds without your approval. Because Access Transparency is disabled, no Access Transparency log is generated for you to audit.

Mitigations
  • Enable Access Approval so that Google personnel must get your explicit approval before they access your data or configurations. For exceptions, see Access Approval exclusions.

  • Enable Access Transparency so that Google administrator access to your data generates near-real-time logs, including the reason for the access, that you can review in Cloud Audit Logs.


Application and integration security

This section describes threats that originate in the applications, integrations, and AI agents that access your Cloud SQL databases.

Confused-deputy abuse using AI/ML and downstream integrations

Cloud SQL integrates with other Google Cloud services, such as Gemini Enterprise Agent Platform for online predictions. An attacker with limited permissions may manipulate the data in the database to trigger these integrations in a way that causes the downstream service (which may have higher privileges) to perform unauthorized actions.

STRIDE category

Elevation of Privilege

MITRE ATT&CK tactic

Privilege Escalation

Manifestations

An attacker modifies a table used as a trigger for a Cloud Function or Gemini Enterprise Agent Platform endpoint, causing the downstream service to exfiltrate data or perform an unauthorized API call with its service account identity.

Mitigations

Apply the principle of least privilege to service accounts used by downstream services triggered by database activity.


Data compromise using SQL injection

An attacker can exploit SQL injection vulnerabilities in client applications to execute arbitrary, unauthorized SQL commands. This exploit can occur using either the legitimate database credentials utilized by the application or using a compromised database account, allowing the attacker to bypass application logic and access, modify, or delete sensitive data within the database.

STRIDE category

Information Disclosure

MITRE ATT&CK tactic

Initial Access

Manifestations
  • Exploitation using legitimate application connection: An attacker submits malicious SQL inputs to a vulnerable client application, executing unauthorized statements under the application's legitimate database user account to exfiltrate or corrupt database data.

  • Exploitation using compromised credentials: An attacker leverages compromised, leaked, or weak database credentials to interact with the database plane directly or inject arbitrary statements.

Mitigations
  • Design the applications that access the database to use secure coding practices, including parameterized queries (prepared statements) and input validation, to prevent SQL injection vulnerabilities. Grant the database user account used by the client application only the minimum necessary permissions on the database (for example, SELECT, INSERT, UPDATE, DELETE on specific tables). Avoid granting administrative rights like superuser or DDL permissions.

  • Use Google Cloud Armor to mitigate SQL injection attacks. Google Cloud Armor includes preconfigured WAF rules based on the OWASP ModSecurity Core Rule Set (CRS). These rules contain signatures designed to detect and block common SQL injection attack patterns in HTTP request parameters (for example, URL queries, POST body contents).

  • Follow best practices for authenticating database user accounts, such as using IAM database authentication or enable policy policies to mitigate the risk of credential theft or brute-force attacks on weak passwords.


Information disclosure using misconfigured row-level security (RLS) or views

Cloud SQL for PostgreSQL supports row-level security and database views as mechanisms for data isolation. Flaws in the SQL logic of these policies or views can lead to a user accessing data belonging to another user, bypassing intended segregation.

STRIDE category

Information Disclosure

MITRE ATT&CK tactic

Initial Access

Manifestations

A developer creates a complex RLS policy with a logical error (for example, an incorrect WHERE clause) that allows an unprivileged user to view sensitive records from others.

Mitigations
  • Implement a strict code review process for all SQL logic used in RLS policies and authorized views.

  • Regularly audit built-in database security configurations against the application's multi-tenancy requirements.


Prompt injection leading to malicious SQL execution

When an agentic system has access to a database, AI agents that utilize natural language to SQL capabilities or the executeSql tool are susceptible to manipulation using prompt injection. This creates a residual risk where an attacker can trick the agent into generating and executing unauthorized or destructive SQL commands, bypassing intended application logic.

STRIDE category

Tampering

MITRE ATT&CK tactic

Execution

Manifestations
  • Indirect prompt injection: A malicious user or a compromised external data source provides a prompt that causes the LLM to ignore its system instructions and generate a query such as DROP TABLE or a cross-database SELECT to exfiltrate PII.

  • Unsanitized query execution: The agent application executes raw SQL strings generated by an LLM without applying input validation or parameterized query standards, allowing the LLM to act as a proxy for a classic SQL injection attack.

  • Agentic data leakage: A malicious user tricks an agent into returning data from another tenant because the agent was equipped with a generic execute_sql tool.

Mitigations
  • Create a separate, dedicated service account for each unique agent or application using MCP tools. Grant the service account the least privilege IAM roles. If an agent needs both read access to data and write access to a log or temporary storage, use two separate service accounts—one account for high-risk data access (minimally scoped) and one for low-risk operational tasks.

  • Integrate the Cloud SQL remote MCP server with Model Armor: Use managed security layers to proactively screen tool calls for SQL injection patterns, malicious payloads, and prompt injection attempts before they reach the database.

  • Enforce read-only tool scopes: For retrieval-focused agents, ensure the underlying database service account is granted only SELECT privileges so that prompt injections cannot mutate or delete data.

  • Implement intent and topicality enforcement: Use safety frameworks to validate that the generated SQL aligns with the predefined intent of the application and the specific session context (for example, allowlisting specific query types).

  • Replace open-ended plan and execute architectures with hard-coded logic that translates requests into a small set of safe, predefined functions.

  • Use Sensitive Data Protection templates within Model Armor to redact or mask PII before it is returned to the user, providing a safety net if the model is compromised.


System operations and configuration

This section describes threats that result from insecure operational practices, default settings, and instance configuration.

Data inconsistency during import and export

Data integrity can be compromised during migrations if the environment settings don't match between the source and destination. Additionally, standard exports can impact primary instance performance.

STRIDE category

Tampering

MITRE ATT&CK tactic

Impact

Manifestations

A database restored from an export file exhibits unexpected behavior or data corruption because the SQL mode used during the import was different from the mode used during the export.

Mitigations
  • Use serverless exports to offload the operation to a temporary instance, preserving primary instance performance.

  • Ensure the exact same SQL mode is used for both the import and export operations.


Disruptive maintenance operations

Without a defined maintenance window, critical system updates (patches, OS upgrades) can occur at inopportune times, causing brief service interruptions and dropping active connections during peak usage.

STRIDE category

Denial of Service

MITRE ATT&CK tactic

Impact

Manifestations

A scheduled maintenance event triggers during high-traffic hours, causing a temporary denial of service and application errors because the instance becomes briefly unavailable.

Mitigations
  • Configure a maintenance window to control when disruptive updates can occur.

  • Test the application's response to maintenance updates using self-service maintenance to simulate an update event.


Exploitation of insecure defaults in API and CLI interfaces

Some interfaces (API, gcloud CLI, Terraform) don't enable secure defaults. This creates a gap where automation-heavy users may unintentionally deploy insecure instances. New instances created through the Google Cloud console have strong password policies by default, but new instances created using the Cloud SQL Admin API, gcloud CLI, or Terraform do not.

STRIDE category

Tampering

MITRE ATT&CK tactic

Defense Evasion

Manifestations

A developer uses a script to provision a fleet of PostgreSQL instances and unintentionally uses weak, guessable credentials because the passwordPolicy was not explicitly configured.

Mitigations
  • Explicitly configure strong password policies in all infrastructure-as-code templates.

  • Use the sql.restrictPublicIp organization policy to enforce a secure-by-default posture across all interfaces, mitigating the risk of a database accessed through insecure default passwords and public IP.


Insecure or noncompliant Cloud SQL database flag configuration

Unsafe or noncompliant database flags (for example, reduced logging, relaxed authentication, or unsafe extensions) weaken security controls and visibility, which enables abuse while remaining difficult to detect.

STRIDE category

Tampering

MITRE ATT&CK tactic

Defense Evasion

Manifestations

An attacker with permissions to modify instance settings can change database flags to disable logging, relax authentication requirements, or enable unsafe extensions, which weakens the security posture and evades detection.

Mitigations
  • Follow the principle of least privilege so that only necessary principals have permissions to modify Cloud SQL instance settings, including database flags.

  • Implement infrastructure-as-code guardrails and code reviews to restrict the modification of critical database flags. Regularly audit Cloud SQL instance configurations against security baselines to ensure compliance.


Security vulnerability exposure due to deferred maintenance

Cloud SQL regularly releases maintenance versions that include critical security patches for the underlying operating system and database engine. Relying solely on scheduled maintenance events or using deny maintenance periods can leave instances exposed to known exploits and high-severity CVEs for extended periods.

STRIDE category

Elevation of Privilege

MITRE ATT&CK tactic

Initial Access

Manifestations

A zero-day or high-impact vulnerability is disclosed in a database engine. Although Google has released a patched maintenance version, the customer's instance remains vulnerable because they have suppressed updates.

Mitigations
  • Utilize self-service maintenance to apply new maintenance versions immediately when critical security updates are announced, rather than waiting for the automated rollout.

  • Opt-in to maintenance notifications so that you're aware of available security patches and upcoming scheduled events, and regularly review Cloud SQL release notes to monitor for critical security improvements and maintenance versions

  • Minimize the duration and frequency of deny maintenance periods so that critical security fixes are not blocked beyond necessary operational windows.


Weakening of security posture using organization policy tampering

An attacker who compromises a IAM principal with high-level permissions, such as the orgpolicy.policyAdmin role, can disable or misconfigure organization-level security policies. This action does not directly compromise a Cloud SQL instance but removes critical, preventative guardrails, which enables other attacks.

STRIDE category

Tampering

MITRE ATT&CK tactic

Defense Evasion

Manifestations
  • Enabling public IPs: An attacker can disable the sql.restrictPublicIp organization policy constraint, which lets developers or other compromised accounts subsequently create Cloud SQL instances with public IP addresses that might otherwise be forbidden.

  • Widening network access: An attacker can modify the sql.restrictAuthorizedNetworks policy to remove restrictions on which CIDR ranges can be added to an instance's authorized networks list, which paves the way for insecure configurations.

Mitigations

Strictly limit the number of principals granted the orgpolicy.policyAdmin role. Access to this role should be governed by an emergency access or just-in-time access procedure. Implement robust monitoring and alerting on Cloud Audit Logs for any API calls that modify organization policies, particularly those related to Cloud SQL security.