Is Your MariaDB Version Affected by the Remote Root Code Execution Vulnerability CVE-2016-6662?

Over the last few days, there has been a lot of questions and discussion around a vulnerability referred to as MySQL Remote Root Code Execution / Privilege Escalation 0day with CVE code CVE-2016-6662. It’s a serious vulnerability and we encourage every MariaDB Server, MariaDB Enterprise and MariaDB Enterprise Cluster user to read the below update on the vulnerability and how it affects MariaDB products.

The vulnerability can be exploited by both local and remote users. Both an authenticated connection to or SQL injection in an affected version of MariaDB Server can be used to exploit the vulnerability. If successful, a library file could be loaded and executed with root privileges.

The corresponding bug about the vulnerability can be seen in MariaDB’s project tracking with bug number MDEV-10465, which was opened on July 31, 2016.

MariaDB Enterprise and Enterprise Cluster
The following versions of MariaDB Enterprise and Enterprise Cluster include the fix for the vulnerability:

  • 5.5.51 or later versions
  • 10.0.27 or later versions
  • 10.1.17 or later versions

MariaDB Server
All stable MariaDB versions (5.5, 10.0, 10.1) were fixed in August 2016 in the following versions:

  • 5.5.51, released on August 10, 2016
  • 10.0.27, released on August 25, 2016
  • 10.1.17, released on August 30, 2016

If you’re on any of the above versions (or later), rest assured, you’re protected against this vulnerability. If you happen to be testing an alpha version of MariaDB 10.2, please be aware that the fix will be available in version 10.2.2, which is expected to be released soon.

More details on the vulnerability

The vulnerability makes use of the mysqld_safe startup script.

However, if the database user being used has neither SUPER nor FILE privilege or if the user has FILE but –secure-file-priv is set to isolate the location of import and export operations, then the vulnerability is NOT exploitable. It is always a recommended configuration to not grant SUPER privileges and to avoid granting FILE privileges without using –secure-file-priv.

Users that have installed MariaDB Server 10.1.8 or later from RPM or DEB packages are NOT affected by the vulnerability. This is due to the fact that in version 10.1.8, MariaDB started using systemd instead of init to manage the MariaDB service. In this case the mysqld_safe startup script isn’t used.

For the complete report of the vulnerability, please refer to the advisory by Dawid Golunski (legalhackers.com) who discovered the vulnerability.