CVE-2016-6662

CRITICAL EXPLOITED LAB

Oracle MySQL, MariaDB, Percona Server - Privilege Escalation via my.cnf

Title source: llm
STIX 2.1

Exploitation Summary

CVE-2016-6662 has been observed exploited in the wild (reported by VulnCheck KEV). EIP tracks 8 public exploits from researchers including Dawid Golunski, MAYASEVEN, Ashrafdev.

AI-analyzed exploit summary This exploit leverages CVE-2016-6662 to achieve remote root code execution or privilege escalation in MySQL/MariaDB/Percona by injecting a malicious trigger and shared library into the database directory, which then modifies the MySQL configuration file to load the library.

Description

Oracle MySQL through 5.5.52, 5.6.x through 5.6.33, and 5.7.x through 5.7.15; MariaDB before 5.5.51, 10.0.x before 10.0.27, and 10.1.x before 10.1.17; and Percona Server before 5.5.51-38.1, 5.6.x before 5.6.32-78.0, and 5.7.x before 5.7.14-7 allow local users to create arbitrary configurations and bypass certain protection mechanisms by setting general_log_file to a my.cnf configuration. NOTE: this can be leveraged to execute arbitrary code with root privileges by setting malloc_lib. NOTE: the affected MySQL version information is from Oracle's October 2016 CPU. Oracle has not commented on third-party claims that the issue was silently patched in MySQL 5.5.52, 5.6.33, and 5.7.15.

Exploits (8)

exploitdb WORKING POC
by Dawid Golunski · pythonlocallinux
https://www.exploit-db.com/exploits/40360

This exploit leverages CVE-2016-6662 to achieve remote root code execution or privilege escalation in MySQL/MariaDB/Percona by injecting a malicious trigger and shared library into the database directory, which then modifies the MySQL configuration file to load the library.

Classification
Working Poc 95%
Attack Type
Rce | Lpe
Complexity
Moderate
Reliability
Reliable
Target: MySQL/MariaDB/Percona (versions affected by CVE-2016-6662)
Auth required
Prerequisites: Valid MySQL credentials with CREATE TABLE, SELECT, and FILE privileges · Writable MySQL configuration file or directory
devstral-2 · analyzed Feb 16, 2026 Full analysis →
nomisec WORKING POC 29 stars
by MAYASEVEN · poc
https://github.com/MAYASEVEN/CVE-2016-6662

This repository contains a functional exploit for CVE-2016-6662, which leverages SQL injection to achieve remote root code execution on MySQL servers. The exploit crafts a malicious trigger and shared library to modify the MySQL configuration file, leading to arbitrary code execution upon service restart.

Classification
Working Poc 95%
Attack Type
Rce
Complexity
Complex
Reliability
Reliable
Target: MySQL (versions affected by CVE-2016-6662)
No auth needed
Prerequisites: SQL injection vulnerability in the target application · Ability to write files to the MySQL data directory · MySQL service restart required for full exploitation
devstral-2 · analyzed Feb 18, 2026 Full analysis →
nomisec WORKING POC 9 stars
by Ashrafdev · remote-auth
https://github.com/Ashrafdev/MySQL-Remote-Root-Code-Execution

This repository contains a functional exploit for CVE-2016-6662, a MySQL remote root code execution vulnerability. The exploit leverages MySQL's FILE privilege to write a malicious shared library and trigger to a target system, which then executes arbitrary code with root privileges.

Classification
Working Poc 95%
Attack Type
Rce
Complexity
Moderate
Reliability
Reliable
Target: MySQL (versions affected by CVE-2016-6662)
Auth required
Prerequisites: MySQL credentials with FILE privilege · Access to a writable MySQL configuration file · Ability to compile and upload a shared library
devstral-2 · analyzed Feb 18, 2026 Full analysis →
nomisec WORKING POC 1 stars
by boompig · remote
https://github.com/boompig/cve-2016-6662

This repository contains a functional exploit for CVE-2016-6662, a MySQL/MariaDB remote root code execution vulnerability. The exploit leverages weak file permissions to append malicious configuration entries, enabling arbitrary code execution via a preloaded shared library.

Classification
Working Poc 95%
Attack Type
Rce
Complexity
Moderate
Reliability
Reliable
Target: MySQL/MariaDB/Percona (versions affected by CVE-2016-6662)
Auth required
Prerequisites: MySQL user with CREATE TABLE, SELECT, and FILE privileges · Writable my.cnf configuration file
devstral-2 · analyzed Feb 18, 2026 Full analysis →
nomisec WRITEUP 1 stars
by meersjo · poc
https://github.com/meersjo/ansible-mysql-cve-2016-6662

This repository provides an Ansible playbook and a bash script to patch MySQL servers against CVE-2016-6662, a vulnerability that allows attackers to write malicious .so files to the filesystem and modify configurations to load them. The patch modifies mysqld_safe to restrict .so file loading to standard system locations and checks/fixes permissions of MySQL configuration files.

Classification
Writeup 95%
Attack Type
Other
Complexity
Moderate
Reliability
Reliable
Target: MySQL (versions affected by CVE-2016-6662)
Auth required
Prerequisites: Access to MySQL server with sufficient privileges to modify mysqld_safe and configuration files
devstral-2 · analyzed Feb 18, 2026 Full analysis →
nomisec WORKING POC
by LSQUARE14 · poc
https://github.com/LSQUARE14/SQL_to_RCE_Lab

This repository provides a functional lab environment demonstrating CVE-2016-6662, a MySQL Remote Root Code Execution vulnerability. It includes a Dockerized setup with a vulnerable MySQL 5.6 instance and a web application to exploit SQL injection for RCE via the `secure_file_priv` misconfiguration.

Classification
Working Poc 95%
Attack Type
Rce
Complexity
Moderate
Reliability
Reliable
Target: MySQL 5.6 (with secure_file_priv misconfiguration)
Auth required
Prerequisites: MySQL 5.6 with secure_file_priv set to null · Write access to web directory
devstral-2 · analyzed Feb 18, 2026 Full analysis →
nomisec WORKING POC
by KosukeShimofuji · poc
https://github.com/KosukeShimofuji/CVE-2016-6662

This repository contains Ansible playbooks to automate the setup of a vulnerable MySQL environment for CVE-2016-6662, which involves a remote code execution vulnerability in MySQL due to insecure file handling in logging configurations. The playbooks configure both a target (vulnerable MySQL server) and an attacker machine with necessary dependencies.

Classification
Working Poc 90%
Attack Type
Rce
Complexity
Moderate
Reliability
Reliable
Target: MySQL (versions affected by CVE-2016-6662)
Auth required
Prerequisites: Access to a vulnerable MySQL server with write permissions to configuration files · Ability to restart MySQL service · Ansible installed on the attacker machine
devstral-2 · analyzed Feb 18, 2026 Full analysis →
nomisec WRITEUP
by konstantin-kelemen · poc
https://github.com/konstantin-kelemen/mysqld_safe-CVE-2016-6662-patch

This repository provides an Ansible playbook to patch the mysqld_safe script against CVE-2016-6662, a vulnerability allowing arbitrary library loading via LD_PRELOAD. It applies the Percona fix to restrict library paths to system directories.

Classification
Writeup 90%
Attack Type
Lpe
Complexity
Moderate
Reliability
Reliable
Target: MySQL mysqld_safe (versions affected by CVE-2016-6662)
No auth needed
Prerequisites: Access to modify mysqld_safe script · Ansible execution environment
devstral-2 · analyzed Feb 18, 2026 Full analysis →

References (27)

Core 27
Core References
Release Notes, Vendor Advisory x_refsource_confirm
https://mariadb.com/kb/en/mariadb/mariadb-10027-release-notes/
Third Party Advisory vendor-advisory x_refsource_redhat
http://rhn.redhat.com/errata/RHSA-2016-2749.html
Third Party Advisory vendor-advisory x_refsource_redhat
http://rhn.redhat.com/errata/RHSA-2017-0184.html
Third Party Advisory vendor-advisory x_refsource_redhat
http://rhn.redhat.com/errata/RHSA-2016-2131.html
Third Party Advisory vendor-advisory x_refsource_redhat
http://rhn.redhat.com/errata/RHSA-2016-2060.html
Release Notes, Vendor Advisory x_refsource_confirm
https://mariadb.com/kb/en/mariadb/mariadb-10117-release-notes/
Release Notes, Vendor Advisory x_refsource_confirm
https://mariadb.com/kb/en/mariadb/mariadb-5551-release-notes/
Issue Tracking, Vendor Advisory x_refsource_confirm
https://jira.mariadb.org/browse/MDEV-10465
Third Party Advisory, VDB Entry vdb-entry x_refsource_bid
http://www.securityfocus.com/bid/92912
Mailing List, Third Party Advisory mailing-list x_refsource_fulldisc
http://seclists.org/fulldisclosure/2016/Sep/23
Third Party Advisory vendor-advisory x_refsource_gentoo
https://security.gentoo.org/glsa/201701-01
Third Party Advisory vendor-advisory x_refsource_debian
http://www.debian.org/security/2016/dsa-3666
Third Party Advisory vendor-advisory x_refsource_redhat
http://rhn.redhat.com/errata/RHSA-2016-2130.html
Third Party Advisory vendor-advisory x_refsource_redhat
http://rhn.redhat.com/errata/RHSA-2016-2077.html
Third Party Advisory vendor-advisory x_refsource_redhat
http://rhn.redhat.com/errata/RHSA-2016-2927.html
Third Party Advisory vendor-advisory x_refsource_redhat
http://rhn.redhat.com/errata/RHSA-2016-2059.html
Third Party Advisory vendor-advisory x_refsource_redhat
http://rhn.redhat.com/errata/RHSA-2016-2062.html
Third Party Advisory vendor-advisory x_refsource_redhat
http://rhn.redhat.com/errata/RHSA-2016-2595.html
Third Party Advisory, VDB Entry vdb-entry x_refsource_sectrack
http://www.securitytracker.com/id/1036769
Third Party Advisory vendor-advisory x_refsource_redhat
http://rhn.redhat.com/errata/RHSA-2016-2061.html
Mailing List, Third Party Advisory mailing-list x_refsource_mlist
http://www.openwall.com/lists/oss-security/2016/09/12/3
Exploit, Third Party Advisory, VDB Entry exploit x_refsource_exploit-db
https://www.exploit-db.com/exploits/40360/
Third Party Advisory vendor-advisory x_refsource_redhat
http://rhn.redhat.com/errata/RHSA-2016-2928.html
Third Party Advisory vendor-advisory x_refsource_redhat
http://rhn.redhat.com/errata/RHSA-2016-2058.html

Scores

CVSS v3 9.8
EPSS 0.8958
EPSS Percentile 99.6%
Attack Vector NETWORK
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Details

VulnCheck KEV 2024-05-14
CWE
CWE-264
Status published
Products (24)
debian/debian_linux 8.0
mariadb/mariadb 5.5.20 - 5.5.51
oracle/mysql 5.5.0 - 5.5.52
percona/percona_server 5.5 - 5.5.51-38.1
redhat/enterprise_linux 7.0
redhat/enterprise_linux_desktop 6.0
redhat/enterprise_linux_desktop 7.0
redhat/enterprise_linux_server 6.0
redhat/enterprise_linux_server_aus 7.3
redhat/enterprise_linux_server_aus 7.4
... and 14 more
Published Sep 20, 2016
Tracked Since Feb 18, 2026