MySQL database instance has a passwordless default root user Affecting Cloud SQL service in Google


Severity

0.0
critical
0
10
    Severity Framework
    Snyk CCSS
    Rule category
    General / Access

Is your enviroment affected by this misconfiguration?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
    Frameworks
    CIS-Controls
  • Snyk ID SNYK-CC-00222
  • credit Snyk Research Team

Description

MySQL database instances have the option for NOT having a password for the administrative/root user. This is not recommended; a password should be set to ensure that only authorized users have administrative privileges.

How to fix?

Set the name attribute to a username and the password attribute to a strong password.

Example Configuration

resource "google_sql_user" "non_admin" {
  instance = google_sql_database_instance.no_default_admin.name
  name     = "yourusernamegoeshere"
  password = "yoursuperstrongpasswordgoeshere"
  host     = "example.com"
}