Cloud SQL Instance Publicly Accessible
The Cloud SQL instance has a public IP address whose authorised networks include 0.0.0.0/0, so its database port accepts connections from anywhere on the internet.
| Severity | High |
| CVSS 3.1 | 8.1 CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H Open in the calculator |
| CVSS 4.0 | 9.2 CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-668: Exposure of Resource to Wrong Sphere |
| OWASP Top 10 | A01:2025 Broken Access Control |
| MITRE ATT&CK | T1110 Brute Force, T1213.006 Databases |
| Category | Security Misconfiguration |
Description
A Cloud SQL instance can have a private IP address inside a VPC network, a public IP address, or both. With a public IP address, direct connections are accepted only from the address ranges listed as authorised networks, while connections made through the Cloud SQL Auth Proxy or the Cloud SQL language connectors are authorised through IAM instead. The finding applies where the authorised networks include 0.0.0.0/0 or other very large ranges, so that the database port (TCP 3306 for MySQL, 5432 for PostgreSQL or 1433 for SQL Server) accepts connections from anywhere.
Anyone on the internet can then attempt to log in to the database. Built-in or application users with weak or reused passwords can be guessed, and credentials leaked from connection strings in code, configuration files or compromised workstations can be used from anywhere. A successful login gives the attacker whatever that user can do, which for the built-in administrative users and most application accounts is full read and write access to the data. The impact is lower where passwords are strong and users have limited rights, but the instance then has no network-level defence.
The setting is usually added so that developers, reporting tools or applications with changing addresses can connect without private networking. It is often found together with instances that do not require SSL/TLS, where credentials and data may also cross the internet unencrypted, and with built-in database users, such as root or postgres, that have weak passwords.
The exposure is identified by reviewing each instance's connection settings, for example with gcloud sql instances describe, and confirmed by connecting to the public address from outside the organisation's network. Google's recommender also flags instances whose authorised networks include 0.0.0.0/0.
Remediation
- Remove
0.0.0.0/0and other broad ranges from the authorised networks, leaving only the specific addresses that genuinely need direct access. - Prefer private connectivity: give the instance a private IP address, connect from inside the VPC network, and remove the public IP address once nothing depends on it.
- Where a public IP address must remain, connect through the Cloud SQL Auth Proxy or a Cloud SQL connector, which authorise connections through IAM and encrypt them, with no authorised networks configured.
- Require encrypted connections through the instance's SSL mode, use IAM database authentication where the database engine supports it, and set strong, unique passwords for built-in users.
- Prevent recurrence with the
constraints/sql.restrictAuthorizedNetworksandconstraints/sql.restrictPublicIporganisation policy constraints.
Confirm the fix by describing the instance again and by attempting a direct connection to its public address from outside the organisation's network, expecting it to be refused.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.