In June 2023, Oracle disclosed a medium-severity vulnerability tracked as CVE-2023-22110 that impacts the MySQL Server, specifically its Optimizer component. This flaw affects all supported MySQL Server versions up to and including 8..33.
Despite its medium base score (CVSS 4.9), this vulnerability is critical in operational environments because it allows a high-privileged attacker to crash or hang the MySQL Server, effectively causing a denial of service (DoS). In this long read, we’ll break down the vulnerability, explore an example exploit scenario, and help you understand how to protect your database.
Attack Complexity: Low (easy to exploit)
- Impact: DoS (crash/hang; availability loss)
- Confidentiality/Integrity Impact: None
- CVSS v3.1 Score: 4.9 (AV:N/AC:L/PR:H/UI:N/S:U/C:N/I:N/A:H)
Official References
- Oracle Critical Patch Update – July 2023
- NIST NVD CVE-2023-22110 record
How Does the Vulnerability Work?
The issue exists in the Optimizer part of MySQL Server. The Optimizer is responsible for planning how a SQL query is executed. A flaw in its code can allow certain, specially crafted SQL queries to trigger a hang or crash of the MySQL process. Generally, this would involve a combination of subqueries, joins, and/or specific optimizer hints that lead the optimizer into an invalid state or infinite loop.
Key Points
- Only users authenticated with high-level privileges (like database admin, or users with full SELECT/INSERT privileges) can exploit this.
It can be exploited remotely via the network, through normal SQL client interfaces.
- The attacker only needs to be authenticated – there’s no need to trick others or escalate privileges.
Proof of Concept (PoC) Exploit Example
While Oracle has not shared the precise technical details, several security researchers have pieced together likely exploit scenarios based on the patch information and MySQL bugs.
The following is a reconstructed, illustrative exploit scenario. Don’t run this in production!
Suppose there is a bug in the way MySQL’s Optimizer handles certain complex subqueries involving GROUP BY and UNION clauses. A privileged user could cause a crash with a query similar to:
-- This is a hypothetical example; adjust for your own test environment!
SELECT
a.*
FROM
(SELECT id FROM test_table GROUP BY id UNION SELECT id FROM test_table_2) AS a
JOIN
(SELECT id FROM test_table GROUP BY id) b
ON
a.id = b.id
WHERE
(SELECT COUNT(*) FROM test_table_2 WHERE id = a.id) > 10;
Why does this work?
This sort of query could trigger a faulty code path in the query optimizer—especially if there are indexes, statistics, or triggers involved that confuse the optimizer’s plan selection. If the optimizer enters an infinite loop or illegal memory operation, the server could crash or hang.
Crash Example (Error Log)
2023-06-04T14:22:38.245384Z [System] [MY-010232] [Server] Crash recovery finished.
2023-06-04T14:22:45.123456Z 7 [ERROR] [MY-013183] [Server] Assertion failure: <source file> line <n>: <some optimizer assertion>
Note: The actual crash signature varies based on the internal bug.
Who is at Risk?
- Any organization running MySQL Server 8..33 or earlier, especially in environments with multiple administrators or automated SQL jobs/scripts.
1. Patch Immediately!
Oracle fixed this bug in MySQL 8..34 and above.
Download the latest release: https://dev.mysql.com/downloads/mysql/
2. Restrict High Privileges
Only grant high privileges (like ALL, SUPER, PROCESS) to trusted accounts. Use the principle of least privilege.
3. Monitor Suspicious Queries
Set up monitoring using MySQL’s general query log or slow log for complex, suspicious queries that could affect the optimizer.
4. Network Segmentation
Isolate database servers behind firewalls; do not expose MySQL ports directly unless necessary.
Conclusion
CVE-2023-22110 is a cautionary tale about how even medium-severity vulnerabilities can cause major headaches. Because it allows any high-privilege user with SQL access to bring down your database server, patching and access control are crucial.
Remember, while this bug doesn’t leak data or corrupt information, it can stop your services dead until you restart the server—a major availability risk for any business relying on MySQL.
References
- Official Oracle Advisory
- NIST NVD Record – CVE-2023-22110
Timeline
Published on: 10/17/2023 22:15:15 UTC
Last modified on: 10/27/2023 15:15:12 UTC