| Bug #119471 | "Bad handshake" during each connection to a replication source server | ||
|---|---|---|---|
| Submitted: | 27 Nov 2025 17:03 | Modified: | 6 May 17:03 |
| Reporter: | action mystique | Email Updates: | |
| Status: | Open | Impact on me: | |
| Category: | MySQL Server: Connection Handling | Severity: | S2 (Serious) |
| Version: | 8.4.7 | OS: | Ubuntu (25.10 questing) |
| Assigned to: | CPU Architecture: | x86 (64 bits) | |
| Tags: | TLSv1.2, TLSv1.3 | ||
[27 Nov 2025 17:03]
action mystique
[25 Jan 9:56]
Daniël van Eeden
> I find it strange that the replica sends a login request with an **empty** username despite being correctly configured for the replication with a non-empty source username. The SSL Handshake is described here: https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_connection_phase.html#sect... The login with empty username you see is a Protocol::SSLRequest and is documented here: https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_connection_phase_packets_p... So basically what happens is this: < Client (replica) connects over TCP, without TLS > S → C Server Greeting S ← C Login Request (Protocol::SSLRequest) No username, connection attributes, etc < Now the TLS handshake happens > S → C Server Greeting S ← C Login Request (Protocol::HandshakeResponse41, with username etc) < conversation continues > Note that Wireshark can decode TLS traffic. For this it needs to be configured with the private key. For Diffie-Hellman based algorithms it will need the session key. So best to avoid those. See also Bug #80709 You may want to: - Try what happens without TLS if that is acceptable for a short time. - Configure Wireshark to decode TLS (https://wiki.wireshark.org/TLS, https://databaseblog.myname.nl/2014/07/decoding-encrypted-mysql-traffic-with.html). Use TLSv1.2 with AES256-SHA or something similar. - Inspect the logs - Try to reproduce this on a test setup, so it is easier to share the pcap and TLS credentials, etc. Note: What MySQL calls SSL is TLS, MySQL never supported SSL.
[25 Jan 9:59]
Daniël van Eeden
I think the TLS part might not be the problem here. Can you share more information about: - The exact version of the primary and replica - The exact CHANGE REPLICATION SOURCE TO statement (but without the actual password) - Any logging and output that might be helpful
[6 May 17:03]
action mystique
> Can you share more information about:
> - The exact version of the primary and replica
> - The exact CHANGE REPLICATION SOURCE TO statement (but without the actual password)
> - Any logging and output that might be helpful
I finally found some time to decrypt the TLS traffic. Downgrading to 1.2 is not as easy as it sounds as I needed to find a suitable cipher (AES256-SHA256 for instance is blocked by mysql 8.4), reconfigure mysql1 and mysql2 and downgrade also some requirements in openssl.cnf (MinProtocol...) in all required parties.
1. /usr/sbin/mysqld Ver 8.4.8-0ubuntu0.25.10.1 for Linux on x86_64 ((Ubuntu))
2. mysql --ssl-ca=/path/to/ssl/ca.pem --ssl-mode=VERIFY_IDENTITY --user=root --host=mysql2-kvm.sdxlive.com --port=3306 '--password=password' '--execute=CHANGE REPLICATION SOURCE TO SOURCE_HOST = "mysql1-kvm.sdxlive.com", SOURCE_PORT = 3306, SOURCE_AUTO_POSITION = 1, SOURCE_SSL = 1, SOURCE_SSL_CA="", SOURCE_SSL_CAPATH = "/etc/ssl/certs", SOURCE_SSL_CERT = "/path/to/ssl/cert", SOURCE_SSL_KEY = "/path/to/ssl/key.pkcs1", SOURCE_SSL_CIPHER = "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES128-GCM-SHA256", SOURCE_SSL_VERIFY_SERVER_CERT = 1, SOURCE_TLS_CIPHERSUITES = "", SOURCE_TLS_VERSION = "TLSv1.2", REQUIRE_ROW_FORMAT = 1, GTID_ONLY = 1;'
3. logging on mysql1 (source):
{ "prio" : 3, "err_code" : 10914, "msg" : "Bad handshake", "time" : "2026-05-06T16:13:29.902858Z", "ts" : 1778084009902, "thread" : 398, "err_symbol" : "ER_ABORTING_USER_CONNECTION", "SQL_state" : "HY000", "subsystem" : "Server", "label" : "Note" }
I was able to decrypt the TLS traffic between the replica and the source:
1. all packets: https://drive.google.com/file/d/1dwiIwDp6n1cW9C0m5tWpY-h9ESWJWphw/view?usp=sharing
2. client hello from the replica to the source during the TLS handshake: https://drive.google.com/file/d/1CohbqAhXQlvXsBjtD84EPke_bGRRnflI/view?usp=sharing
There is a suspicious "Version: TLS 1.0" which may be the cause of the rejection from the source with a "handshake failure".
