During the recent days there has been quite 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 user to read the below update on the vulnerability from a MariaDB point of view.
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 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, the vulnerability is NOT exploitable. It is always recommended configuration to not grant SUPER privileges and avoiding 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, we started using systemd instead of init to manage the MariaDB service. In this case the mysqld_safe startup script isn’t used.
The corresponding bug about the vulnerability can be seen in MariaDB’s project tracking with bug number MDEV-10465. It was opened on July 31st this year.
All stable MariaDB versions (5.5, 10.0, 10.1) were fixed in August in the following versions:
If you’re on any of the above versions (or later) you’re protected against this vulnerability.
If you happen to be testing an alpha version of 10.2, please be aware that the fix will be available in version 10.2.2. It is not available as of writing, but about to be released.
Update on Oct 3, 2016 – As a result of the discussion going on after the publication of this blog post, I’m here adding a couple of sentences to give some additional information.
- I say in the blog post that users that have done DEB or RPM installation of 10.1.8 or later aren’t affected because mysqld_safe isn’t called in startup. Although this is true, other tools could still call mysqld_safe and expose the vulnerability.
- You should always make sure that the default OS user mysql doesn’t have the right to modify the my.cnf file. However it should be noticed that you’re not 100% protected against this vulnerability only by making sure that is the case. You should upgrade to a version that include the fix for the vulnerability.