Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
-
None
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.:
- If the MITM attacker sees that the client is not going to verify the server's certificate, it can insert itself as a two-sided TLS-using MITM attacker (à la mitmproxy), which will allow it to read all of the client/server traffic, with high confidence that this situation will not be detected by the client.
- If the MITM attacker sees that the client is going to verify the server's certificate, it can infer that the client will detect and abort the connection if the server's certificate does not match the client's expectation. The MITM attacker can use this to "lay low".
*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 dissections
The 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=0
Client 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
Attachments
Issue Links
- is part of
-
CONC-654 Client improperly sends identifying information in plaintext prior to TLS handshake
- Open
- relates to
-
MDEV-28634 Client's --ssl-* options (without --ssl-verify-server-cert) are silently ignored if TLS is not possible
- Closed