CVE-2023-21913 - Critical Vulnerability in MySQL Server 8..31 and Prior Versions (Server: Optimizer component)

A recent advisory from Oracle has highlighted the vulnerability CVE-2023-21913, which affects MySQL Server product of Oracle MySQL (component: Server: Optimizer). The supported versions that are impacted include 8..31 and prior. This vulnerability allows high privileged attackers with network access via multiple protocols to compromise the MySQL Server potentially. Successful exploitation of this vulnerability could result in unauthorized ability to cause a hang or frequently repeatable crash (complete DOS) of MySQL Server. The CVSS 3.1 Base Score for this vulnerability is 4.9, with Availability impacts. The CVSS Vector is: (CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:N/I:N/A:H).

In this article, we will discuss the details of this vulnerability, its impact, and how it can be exploited. We will also provide code snippets and original references to better understand the issue.

Vulnerability Details

The vulnerability stems from the Server: Optimizer component of the MySQL Server. The Optimizer is responsible for processing SQL queries and determining the most efficient execution plan for them. Due to an issue in the Optimizer's handling of certain types of queries, an attacker with high privileges can send a specially crafted query to cause a crash or hang in the MySQL server. This can result in a denial of service (DOS) attack.

Exploit Details

To exploit this vulnerability, the attacker must have high privileges on the targeted MySQL Server. This can be achieved by gaining access to the credentials of an account with high privileges. Once the attacker has these privileges, they can create a specially crafted SQL query that will trigger the vulnerability and result in a crash or hang in the MySQL server. The attacker can then run this query over a network connection using multiple protocols, such as MySQL Protocol, TCP/IP, or Unix Socket, depending on the configuration of the server.

Here is a simple example of how such a specially crafted SQL query might look like

SELECT * FROM vulnerable_table WHERE (SELECT sleep(10) FROM vulnerable_table WHERE id=1) = 1;

This example uses the sleep() function to simulate a hang in the MySQL server for 10 seconds. Note that the actual code used for exploitation may be more complex and obfuscated to bypass security mechanisms.

Original References

The vulnerability was first disclosed by Oracle on their Critical Patch Update Advisory - January 2023: Oracle Critical Patch Update Advisory - January 2023.

The CVE identifier for this vulnerability is CVE-2023-21913, and more details can be found at the National Vulnerability Database: CVE-2023-21913 Detail.

Mitigations and Recommendations

MySQL Server administrators should be aware of this vulnerability and take appropriate steps to secure their servers. The following recommendations can help reduce the risk of exploiting this vulnerability:

1. Update MySQL Server to the latest version immediately, as this issue has been fixed in the subsequent releases.
2. Restrict network access to the MySQL server and use firewall rules to limit the exposure of the server to potential attackers.
3. Regularly monitor the server logs for any unusual activity or attempts to exploit this vulnerability.
4. Implement strong authentication mechanisms and restrict high privilege access to the minimum number of users necessary for the operation of the server.

Conclusion

The CVE-2023-21913 vulnerability is a critical issue that affects MySQL Server 8..31 and prior versions, with the potential for causing a complete denial of service (DOS) attack. It is crucial for administrators to be aware of this vulnerability, and take immediate steps to update their server software and implement security best practices to protect their servers from potential exploitation.

Timeline

Published on: 04/18/2023 20:15:00 UTC
Last modified on: 04/27/2023 15:15:00 UTC