Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-7859

SSL hostname verification fails for long subject names

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 5.5(EOL), 10.0(EOL)
    • 5.5.43, 10.0.18, 10.1.5
    • SSL
    • None

    Description

      The SSL hostname verification code currently fails to validate server certificates with a long Subject DN. This is due to a fixed sized buffer in the ssl_verify_server_cert function in sql-common/client.c. While this buffer length is adequate for most certificates, it is not long enough to handle the extra attributes in the Subject of EV certificates, for example...

      /1.3.6.1.4.1.311.60.2.1.3=US/1.3.6.1.4.1.311.60.2.1.2=Delaware
      /businessCategory=Private Organization/serialNumber=2158113
      /C=US/postalCode=94043/ST=California/L=Mountain View
      /street=350 Ellis Street/O=Symantec Corporation
      /OU=Cloud Platform Engineering/CN=iaasdb.dvt2.symcpe.net

      The above Subject is 276 characters long and the CN at the end gets truncated by the static buffer size, thus the function returns a verification failure error.

      $ mysql --ssl-ca=ca.pem --ssl-verify-server-cert -h iaasdb.dvt2.symcpe.net -u dbuser -p
      Enter password:
      ERROR 2026 (HY000): SSL connection error: SSL certificate validation failure

      I have attached a patch that expands the buffer from 256 bytes to 1024 bytes, which will resolve the issue for all but the longest of certificate Subjects. The present method for finding the CommonName is a bad way to do things and should be overhauled, but fixing that issue is outside of the scope of this bug.

      I am currently using the CentOS 7 packaged client which is version 5.5.41, but I have looked through the GitHub repository and the issue seems to exist in all current versions. The patch is based on the 5.5.42 source.

      Attachments

        Activity

          jkfritcher Jason Fritcher created issue -
          serg Sergei Golubchik made changes -
          Field Original Value New Value
          Affects Version/s 5.5.41 [ 17600 ]
          serg Sergei Golubchik made changes -
          Affects Version/s 10.0 [ 16000 ]
          Affects Version/s 5.5.41 [ 17600 ]
          serg Sergei Golubchik made changes -
          Affects Version/s 5.5 [ 15800 ]
          elenst Elena Stepanova made changes -
          Fix Version/s 10.0 [ 16000 ]
          Fix Version/s 5.5 [ 15800 ]
          Assignee Sergei Golubchik [ serg ]
          Summary SSL hostname verification fails for long subject names [PATCH] SSL hostname verification fails for long subject names
          serg Sergei Golubchik made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          serg Sergei Golubchik made changes -
          Summary [PATCH] SSL hostname verification fails for long subject names SSL hostname verification fails for long subject names
          serg Sergei Golubchik made changes -
          Status In Progress [ 3 ] Stalled [ 10000 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 10.0.18 [ 18702 ]
          Fix Version/s 10.1.5 [ 18813 ]
          Fix Version/s 5.5.43 [ 18601 ]
          Fix Version/s 5.5 [ 15800 ]
          Fix Version/s 10.0 [ 16000 ]
          Resolution Fixed [ 1 ]
          Status Stalled [ 10000 ] Closed [ 6 ]
          ratzpo Rasmus Johansson (Inactive) made changes -
          Workflow MariaDB v2 [ 60265 ] MariaDB v3 [ 61732 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 61732 ] MariaDB v4 [ 148956 ]

          People

            serg Sergei Golubchik
            jkfritcher Jason Fritcher
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.