# CVE-2016-6662: Privilege escalation in n/a

> Local attackers can escalate privileges to root and execute arbitrary code by manipulating MySQL configuration files via the general_log_file setting.

- **Severity:** Critical 9.8 (`CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 20 Sep 2016
- **Updated:** 6 Aug 2024
- **Also known as:** ALPINE-CVE-2016-6662, DLA-624-1, DSA-3666-1, GHSA-76m2-pqh7-www3, RHSA-2016:2058, RHSA-2016:2059, RHSA-2016:2060, RHSA-2016:2061, RHSA-2016:2062, RHSA-2016:2077, SUSE-SU-2016:2395-1, SUSE-SU-2016:2404-1, UBUNTU-CVE-2016-6662, USN-3078-1

## What is CVE-2016-6662?

CVE-2016-6662 is a critical vulnerability in Debian Debian Linux, published on 20 Sep 2016. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official 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.

Weakness: CWE-264

## Which versions are affected by CVE-2016-6662?

It affects 12 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `mariadb-galera` | Red Hat:openstack:5::el6 | All versions | 0:5.5.42-1.1.el6ost |
| `mariadb-galera-common` | Red Hat:openstack:5::el6 | All versions | 0:5.5.42-1.1.el6ost |
| `mariadb-galera-debuginfo` | Red Hat:openstack:5::el6 | All versions | 0:5.5.42-1.1.el6ost |
| `mariadb-galera-server` | Red Hat:openstack:5::el6 | All versions | 0:5.5.42-1.1.el6ost |
| `mariadb-galera` | Red Hat:openstack:5::el7 | All versions | 1:5.5.42-1.2.el7ost |
| `mariadb-galera-common` | Red Hat:openstack:5::el7 | All versions | 1:5.5.42-1.2.el7ost |
| `mariadb-galera-debuginfo` | Red Hat:openstack:5::el7 | All versions | 1:5.5.42-1.2.el7ost |
| `mariadb-galera-server` | Red Hat:openstack:5::el7 | All versions | 1:5.5.42-1.2.el7ost |
| `mariadb-galera` | Red Hat:openstack:6::el7 | All versions | 1:5.5.42-1.2.el7ost |
| `mariadb-galera-common` | Red Hat:openstack:6::el7 | All versions | 1:5.5.42-1.2.el7ost |
| `mariadb-galera-debuginfo` | Red Hat:openstack:6::el7 | All versions | 1:5.5.42-1.2.el7ost |
| `mariadb-galera-server` | Red Hat:openstack:6::el7 | All versions | 1:5.5.42-1.2.el7ost |
| `mariadb-galera` | Red Hat:openstack:7::el7 | All versions | 1:5.5.42-5.el7ost |
| `mariadb-galera-common` | Red Hat:openstack:7::el7 | All versions | 1:5.5.42-5.el7ost |
| `mariadb-galera-debuginfo` | Red Hat:openstack:7::el7 | All versions | 1:5.5.42-5.el7ost |
| `mariadb-galera-server` | Red Hat:openstack:7::el7 | All versions | 1:5.5.42-5.el7ost |
| `mariadb-galera` | Red Hat:openstack:8::el7 | All versions | 1:5.5.42-5.el7ost |
| `mariadb-galera-common` | Red Hat:openstack:8::el7 | All versions | 1:5.5.42-5.el7ost |
| `mariadb-galera-debuginfo` | Red Hat:openstack:8::el7 | All versions | 1:5.5.42-5.el7ost |
| `mariadb-galera-server` | Red Hat:openstack:8::el7 | All versions | 1:5.5.42-5.el7ost |
| `mariadb-galera` | Red Hat:openstack:9::el7 | All versions | 1:5.5.42-5.el7ost |
| `mariadb-galera-common` | Red Hat:openstack:9::el7 | All versions | 1:5.5.42-5.el7ost |
| `mariadb-galera-debuginfo` | Red Hat:openstack:9::el7 | All versions | 1:5.5.42-5.el7ost |
| `mariadb-galera-server` | Red Hat:openstack:9::el7 | All versions | 1:5.5.42-5.el7ost |
| `mariadb` | SUSE:Linux Enterprise Desktop 12 SP1 | All versions | 10.0.27-12.1 |
| `mariadb` | SUSE:Linux Enterprise Server 12 SP1 | All versions | 10.0.27-12.1 |
| `mariadb` | SUSE:Linux Enterprise Server 12-LTSS | All versions | 10.0.27-20.13.1 |
| `mariadb` | SUSE:Linux Enterprise Server for SAP Applications 12 | All versions | 10.0.27-20.13.1 |
| `mariadb` | SUSE:Linux Enterprise Server for SAP Applications 12 SP1 | All versions | 10.0.27-12.1 |
| `mariadb` | SUSE:Linux Enterprise Software Development Kit 12 SP1 | All versions | 10.0.27-12.1 |
| `mariadb` | SUSE:Linux Enterprise Workstation Extension 12 SP1 | All versions | 10.0.27-12.1 |

Products: Debian Debian Linux, Mariadb Mariadb, Oracle Mysql, Percona Percona Server, Redhat Enterprise Linux, Redhat Enterprise Linux Desktop, Redhat Enterprise Linux Server, Redhat Enterprise Linux Server Aus, Redhat Enterprise Linux Server Eus, Redhat Enterprise Linux Server Tus, Redhat Enterprise Linux Workstation, Redhat Openstack.

## How do I fix CVE-2016-6662?

Apply the vendor's patch.

## Is CVE-2016-6662 being exploited?

There is no known exploitation of CVE-2016-6662 in the wild and no public exploit code.

Public exploit code:

- From SQL injection to root shell with CVE-2016-6662 by MaYaSeVeN (github_poc): https://github.com/MAYASEVEN/CVE-2016-6662
- 0ldSQL_MySQL_RCE_exploit.py (ver. 1.0) (CVE-2016-6662) MySQL Remote Root Code Execution / Privesc PoC Exploit    For testing purposes only. Do no harm. (github_poc): https://github.com/Ashrafdev/MySQL-Remote-Root-Code-Execution
- Simple ansible playbook to patch mysql servers against CVE-2016-6662 (github_poc): https://github.com/meersjo/ansible-mysql-cve-2016-6662
- https://github.com/boompig/cve-2016-6662 (github_poc): https://github.com/boompig/cve-2016-6662
- MySQL / MariaDB / PerconaDB 5.5.51/5.6.32/5.7.14 - Code Execution / Privilege Escalation (exploitdb)
- MySQL server CVE-2016-6662 patch playbook (github_poc): https://github.com/konstantin-kelemen/mysqld_safe-CVE-2016-6662-patch

## Other vulnerabilities in Debian Debian Linux

- [CVE-2015-3306](https://insights.sbomify.com/CVE-2015-3306/): ProFTPD Improper Access Control (critical 10.0, exploited in the wild)
- [CVE-2025-49113](https://insights.sbomify.com/CVE-2025-49113/): RoundCube Webmail Deserialization of Untrusted Data (critical 9.9, exploited in the wild)
- [CVE-2026-24061](https://insights.sbomify.com/CVE-2026-24061/): GNU InetUtils Argument Injection (critical 9.8, exploited in the wild)
- [CVE-2025-39682](https://insights.sbomify.com/CVE-2025-39682/): Linux Kernel Improper Check for Unusual or Exceptional Conditions (critical 9.8, exploited in the wild)
- [CVE-2024-9680](https://insights.sbomify.com/CVE-2024-9680/): Mozilla Firefox Use-After-Free (critical 9.8, exploited in the wild)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2016-6662 and fix it if it is affected.

What it is: CVE-2016-6662 is a critical vulnerability in Debian Debian Linux, published on 20 Sep 2016. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2016-6662 in the wild and no public exploit code.

Affected product: Debian Debian Linux. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2016-6662/ (Markdown: https://insights.sbomify.com/CVE-2016-6662/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2016-6662
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2016-6662
- OSV: https://osv.dev/vulnerability/CVE-2016-6662

---
From sbomify Insights: https://insights.sbomify.com/CVE-2016-6662/
Summaries are generated and may contain mistakes; the official description above is the record.
