[CONC-656] TLS-using MariaDB clients tell MITM attackers if they can be undetectably MITM'ed Created: 2023-07-11 Updated: 2023-09-18 Resolved: 2023-09-02 |
|
| Status: | Closed |
| Project: | MariaDB Connector/C |
| Component/s: | Protocol, TLS/SSL |
| Affects Version/s: | None |
| Fix Version/s: | 3.1.22, 3.3.6 |
| Type: | Bug | Priority: | Major |
| Reporter: | Daniel Lenski | Assignee: | Georg Richter |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
This vulnerability is a subset of CONC-654, but it can be fixed independently of CONC-654. MySQL and MariaDB clients (tested against both 10.2.44 and 11.2.0, as well as MySQL 8.0) send the CLIENT_SSL_VERIFY_SERVER_CERT bit in plaintext in their pre-TLS SSLRequest packet. This information leakage makes it easy for a pervasive MITM attacker to decide whether or not it can undetectably MITM the TLS connection.:
*There is absolutely no reason for the client to reveal in plaintext whether and how it is planning to verify the server's TLS certificate .* The fix here — even before solving CONC-654 more generally — should simply be to strip the CLIENT_SSL_VERIFY_SERVER_CERT bit from the SSLRequest packet before sending it on the wire. Wireshark dissectionsThe Wireshark dissector source for MySQL/MariaDB protocol (https://github.com/wireshark/wireshark/blob/master/epan/dissectors/packet-mysql.c#L96-L114) erroneously identifies the CLIENT_SSL_VERIFY_SERVER_CERT bit as "unused" (not sent on the wire. However, it is indeed sent on the wire in plaintext by MariaDB and MySQL clients. It is the second-most-significant "unused" bit highlighted in the screenshots below. Client packet with CLIENT_SSL_VERIFY_SERVER_CERT=0Client invoked with mariadb --ssl (or mysql --ssl=PREFERRED for MySQL 8.0.33):
Client invoked with mariadb --ssl --ssl-verify-server-cert (or mysql --ssl=VERIFY_IDENTITY for MySQL 8.0.33): Client packet with CLIENT_SSL_VERIFY_SERVER_CERT=1 |