MySQL 5.5.x < 5.5.52 Multiple Vulnerabilities - Nessus
Critical Plugin ID: 93375This page contains detailed information about the MySQL 5.5.x < 5.5.52 Multiple Vulnerabilities Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.
Plugin Overview
ID: 93375
Name: MySQL 5.5.x < 5.5.52 Multiple Vulnerabilities
Filename: mysql_5_5_52.nasl
Vulnerability Published: 2016-09-06
This Plugin Published: 2016-09-08
Last Modification Time: 2019-11-14
Plugin Version: 1.16
Plugin Type: remote
Plugin Family: Databases
Dependencies:
mysql_login.nasl, mysql_version.nasl
Required KB Items [?]: Settings/ParanoidReport
Vulnerability Information
Severity: Critical
Vulnerability Published: 2016-09-06
Patch Published: 2016-09-06
CVE [?]: CVE-2016-5624, CVE-2016-6662, CVE-2016-6663
CPE [?]: cpe:/a:oracle:mysql
In the News: True
Synopsis
The remote database server is affected by multiple vulnerabilities.
Description
The version of MySQL running on the remote host is 5.5.x prior to 5.5.52. It is, therefore, affected by multiple vulnerabilities :
- An unspecified flaw exists in the DML subcomponent that allows an authenticated, remote attacker to cause a denial of service condition. (CVE-2016-5624)
- A flaw exists in the check_log_path() function within file sql/sys_vars.cc due to inadequate restrictions on the ability to write to the my.cnf configuration file and allowing the loading of configuration files from path locations not used by current versions. An authenticated, remote attacker can exploit this issue by using specially crafted queries that utilize logging functionality to create new files or append custom content to existing files. This allows the attacker to gain root privileges by inserting a custom .cnf file with a 'malloc_lib=' directive pointing to specially crafted mysql_hookandroot_lib.so file and thereby cause MySQL to load a malicious library the next time it is started. (CVE-2016-6662)
- An unspecified flaw exists that allows an authenticated, remote attacker to bypass restrictions and create the /var/lib/mysql/my.cnf file with custom contents without the FILE privilege requirement. (CVE-2016-6663) - A flaw exists that is related to the use of temporary files by REPAIR TABLE. An authenticated, remote attacker can exploit this to gain elevated privileges.
- A buffer overflow condition exists when handling long integer values in MEDIUMINT columns due to the improper validation of certain input. An authenticated, remote attacker can exploit this to cause a denial of service condition or the execution of arbitrary code.
- An unspecified flaw exists due to how a prepared statement uses a parameter in the select list of a derived table that was part of a join. An authenticated, remote attacker can exploit this to cause a server exit, resulting in a denial of service condition.
Note that Nessus has not tested for these issues but has instead relied only on the application's self-reported version number.
Solution
Upgrade to MySQL version 5.5.52 or later.
Public Exploits
Target Network Port(s): 3306
Target Asset(s): Services/mysql
Exploit Available: True (Exploit-DB, GitHub)
Exploit Ease: Exploits are available
Here's the list of publicly known exploits and PoCs for verifying the MySQL 5.5.x < 5.5.52 Multiple Vulnerabilities vulnerability:
- Exploit-DB: exploits/linux/local/40360.py
[EDB-40360: MySQL / MariaDB / PerconaDB 5.5.51/5.6.32/5.7.14 - Code Execution / Privilege Escalation] - Exploit-DB: exploits/linux/local/40678.c
[EDB-40678: MySQL / MariaDB / PerconaDB 5.5.x/5.6.x/5.7.x - 'mysql' System User Privilege Escalation / Race Condition] - Exploit-DB: exploits/linux/local/40679.sh
[EDB-40679: MySQL / MariaDB / PerconaDB 5.5.x/5.6.x/5.7.x - 'root' System User Privilege Escalation] - GitHub: https://github.com/Ashrafdev/MySQL-Remote-Root-Code-Execution
[CVE-2016-6662: 0ldSQL_MySQL_RCE_exploit.py (ver. 1.0) (CVE-2016-6662) MySQL Remote Root Code ...] - GitHub: https://github.com/MAYASEVEN/CVE-2016-6662
[CVE-2016-6662: From SQL injection to root shell with CVE-2016-6662 by MaYaSeVeN] - GitHub: https://github.com/MaYaSeVeN/CVE-2016-6662
[CVE-2016-6662] - GitHub: https://github.com/boompig/cve-2016-6662
[CVE-2016-6662] - GitHub: https://github.com/konstantin-kelemen/mysqld_safe-CVE-2016-6662-patch
[CVE-2016-6662: MySQL server CVE-2016-6662 patch playbook] - GitHub: https://github.com/kyawthiha7/pentest-methodology
[CVE-2016-6662] - GitHub: https://github.com/meersjo/ansible-mysql-cve-2016-6662
[CVE-2016-6662: Simple ansible playbook to patch mysql servers against CVE-2016-6662] - GitHub: https://github.com/scmanjarrez/CVEScannerV2
[CVE-2016-6662] - GitHub: https://github.com/brmzkw/links
[CVE-2016-6663] - GitHub: https://github.com/firebroo/CVE-2016-6663
[CVE-2016-6663] - GitHub: https://github.com/r0eXpeR/redteam_vul
[CVE-2016-6663] - GitHub: https://github.com/KosukeShimofuji/CVE-2016-6662
[CVE-2016-6662: Research CVE-2016-6662]
Before running any exploit against any system, make sure you are authorized by the owner of the target system(s) to perform such activity. In any other case, this would be considered as an illegal activity.
WARNING: Beware of using unverified exploits from sources such as GitHub or Exploit-DB. These exploits and PoCs could contain malware. For more information, see how to use exploits safely.
Risk Information
CVSS Score Source [?]: CVE-2016-6662
CVSS V2 Vector: AV:N/AC:L/Au:N/C:C/I:C/A:C/E:POC/RL:OF/RC:C
CVSS Base Score: | 10.0 (High) |
Impact Subscore: | 10.0 |
Exploitability Subscore: | 10.0 |
CVSS Temporal Score: | 7.8 (High) |
CVSS Environmental Score: | NA (None) |
Modified Impact Subscore: | NA |
Overall CVSS Score: | 7.8 (High) |
CVSS Base Score: | 9.8 (Critical) |
Impact Subscore: | 5.9 |
Exploitability Subscore: | 3.9 |
CVSS Temporal Score: | 8.8 (High) |
CVSS Environmental Score: | NA (None) |
Modified Impact Subscore: | NA |
Overall CVSS Score: | 8.8 (High) |
Go back to menu.
Plugin Source
This is the mysql_5_5_52.nasl nessus plugin source code. This script is Copyright (C) 2016-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
#
# (C) Tenable Network Security, Inc.
#
include("compat.inc");
if (description)
{
script_id(93375);
script_version("1.16");
script_cvs_date("Date: 2019/11/14");
script_cve_id("CVE-2016-5624", "CVE-2016-6662", "CVE-2016-6663");
script_bugtraq_id(92911, 92912, 93635);
script_xref(name:"EDB-ID", value:"40360");
script_name(english:"MySQL 5.5.x < 5.5.52 Multiple Vulnerabilities");
script_summary(english:"Checks the version of MySQL server.");
script_set_attribute(attribute:"synopsis", value:
"The remote database server is affected by multiple vulnerabilities.");
script_set_attribute(attribute:"description", value:
"The version of MySQL running on the remote host is 5.5.x prior to
5.5.52. It is, therefore, affected by multiple vulnerabilities :
- An unspecified flaw exists in the DML subcomponent that
allows an authenticated, remote attacker to cause a
denial of service condition. (CVE-2016-5624)
- A flaw exists in the check_log_path() function within
file sql/sys_vars.cc due to inadequate restrictions on
the ability to write to the my.cnf configuration file
and allowing the loading of configuration files from
path locations not used by current versions. An
authenticated, remote attacker can exploit this issue
by using specially crafted queries that utilize logging
functionality to create new files or append custom
content to existing files. This allows the attacker to
gain root privileges by inserting a custom .cnf file
with a 'malloc_lib=' directive pointing to specially
crafted mysql_hookandroot_lib.so file and thereby cause
MySQL to load a malicious library the next time it is
started. (CVE-2016-6662)
- An unspecified flaw exists that allows an authenticated,
remote attacker to bypass restrictions and create the
/var/lib/mysql/my.cnf file with custom contents without
the FILE privilege requirement. (CVE-2016-6663)
- A flaw exists that is related to the use of temporary
files by REPAIR TABLE. An authenticated, remote attacker
can exploit this to gain elevated privileges.
- A buffer overflow condition exists when handling long
integer values in MEDIUMINT columns due to the improper
validation of certain input. An authenticated, remote
attacker can exploit this to cause a denial of service
condition or the execution of arbitrary code.
- An unspecified flaw exists due to how a prepared
statement uses a parameter in the select list of a
derived table that was part of a join. An authenticated,
remote attacker can exploit this to cause a server exit,
resulting in a denial of service condition.
Note that Nessus has not tested for these issues but has instead
relied only on the application's self-reported version number.");
# http://www.oracle.com/technetwork/security-advisory/cpuoct2016-2881722.html
script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?bac902d5");
script_set_attribute(attribute:"see_also", value:"http://dev.mysql.com/doc/relnotes/mysql/5.5/en/news-5-5-52.html");
# http://legalhackers.com/advisories/MySQL-Exploit-Remote-Root-Code-Execution-Privesc-CVE-2016-6662.html
script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?fbd97f45");
script_set_attribute(attribute:"solution", value:
"Upgrade to MySQL version 5.5.52 or later.");
script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:C/I:C/A:C");
script_set_cvss_temporal_vector("CVSS2#E:POC/RL:OF/RC:C");
script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H");
script_set_cvss3_temporal_vector("CVSS:3.0/E:P/RL:O/RC:C");
script_set_attribute(attribute:"cvss_score_source", value:"CVE-2016-6662");
script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
script_set_attribute(attribute:"exploit_available", value:"true");
script_set_attribute(attribute:"in_the_news", value:"true");
script_set_attribute(attribute:"vuln_publication_date", value:"2016/09/06");
script_set_attribute(attribute:"patch_publication_date", value:"2016/09/06");
script_set_attribute(attribute:"plugin_publication_date", value:"2016/09/08");
script_set_attribute(attribute:"potential_vulnerability", value:"true");
script_set_attribute(attribute:"plugin_type", value:"remote");
script_set_attribute(attribute:"cpe", value:"cpe:/a:oracle:mysql");
script_end_attributes();
script_category(ACT_GATHER_INFO);
script_family(english:"Databases");
script_copyright(english:"This script is Copyright (C) 2016-2019 and is owned by Tenable, Inc. or an Affiliate thereof.");
script_dependencies("mysql_version.nasl", "mysql_login.nasl");
script_require_keys("Settings/ParanoidReport");
script_require_ports("Services/mysql", 3306);
exit(0);
}
include("mysql_version.inc");
mysql_check_version(fixed:'5.5.52', min:'5.5', severity:SECURITY_HOLE);
The latest version of this script can be found in these locations depending on your platform:
- Linux / Unix:
/opt/nessus/lib/nessus/plugins/mysql_5_5_52.nasl
- Windows:
C:\ProgramData\Tenable\Nessus\nessus\plugins\mysql_5_5_52.nasl
- Mac OS X:
/Library/Nessus/run/lib/nessus/plugins/mysql_5_5_52.nasl
Go back to menu.
How to Run
Here is how to run the MySQL 5.5.x < 5.5.52 Multiple Vulnerabilities as a standalone plugin via the Nessus web user interface (https://localhost:8834/):
- Click to start a New Scan.
- Select Advanced Scan.
- Navigate to the Plugins tab.
- On the top right corner click to Disable All plugins.
- On the left side table select Databases plugin family.
- On the right side table select MySQL 5.5.x < 5.5.52 Multiple Vulnerabilities plugin ID 93375.
- Specify the target on the Settings tab and click to Save the scan.
- Run the scan.
Here are a few examples of how to run the plugin in the command line. Note that the examples below demonstrate the usage on the Linux / Unix platform.
Basic usage:
/opt/nessus/bin/nasl mysql_5_5_52.nasl -t <IP/HOST>
Run the plugin with audit trail message on the console:
/opt/nessus/bin/nasl -a mysql_5_5_52.nasl -t <IP/HOST>
Run the plugin with trace script execution written to the console (useful for debugging):
/opt/nessus/bin/nasl -T - mysql_5_5_52.nasl -t <IP/HOST>
Run the plugin with using a state file for the target and updating it (useful for running multiple plugins on the target):
/opt/nessus/bin/nasl -K /tmp/state mysql_5_5_52.nasl -t <IP/HOST>
Go back to menu.
References
BID | SecurityFocus Bugtraq ID: See also:
- https://www.tenable.com/plugins/nessus/93375
- http://dev.mysql.com/doc/relnotes/mysql/5.5/en/news-5-5-52.html
- http://www.nessus.org/u?bac902d5
- http://www.nessus.org/u?fbd97f45
- https://vulners.com/nessus/MYSQL_5_5_52.NASL
- 93609 - MariaDB 10.0.x < 10.0.27 Multiple Vulnerabilities
- 95540 - MariaDB 10.0.x < 10.0.28 Multiple Vulnerabilities
- 93610 - MariaDB 10.1.x < 10.1.17 Multiple Vulnerabilities
- 95632 - MariaDB 10.1.x < 10.1.18 Multiple Vulnerabilities
- 93611 - MariaDB 5.5.x < 5.5.51 Multiple Vulnerabilities
- 95633 - MariaDB 5.5.x < 5.5.52 Multiple Vulnerabilities
- 93376 - MySQL 5.5.x < 5.5.52 Multiple Vulnerabilities
- 94165 - MySQL 5.5.x < 5.5.53 Multiple Vulnerabilities (October 2016 CPU)
- 94196 - MySQL 5.5.x < 5.5.53 Multiple Vulnerabilities (October 2016 CPU)
- 93377 - MySQL 5.6.x < 5.6.33 Multiple Vulnerabilities
- 93378 - MySQL 5.6.x < 5.6.33 Multiple Vulnerabilities
- 94166 - MySQL 5.6.x < 5.6.34 Multiple Vulnerabilities (October 2016 CPU) (SWEET32)
- 94197 - MySQL 5.6.x < 5.6.34 Multiple Vulnerabilities (October 2016 CPU) (SWEET32)
- 93379 - MySQL 5.7.x < 5.7.15 Multiple Vulnerabilities
- 93380 - MySQL 5.7.x < 5.7.15 Multiple Vulnerabilities
- 94167 - MySQL 5.7.x < 5.7.16 Multiple Vulnerabilities (October 2016 CPU) (SWEET32)
- 94198 - MySQL 5.7.x < 5.7.16 Multiple Vulnerabilities (October 2016 CPU) (SWEET32)
Version
This page has been produced using Nessus Professional 10.1.2 (#68) LINUX, Plugin set 202205072148.
Plugin file mysql_5_5_52.nasl version 1.16. For more plugins, visit the Nessus Plugin Library.
Go back to menu.