Fix bug in CVE-2011-4619: check we have really received a client hello
authorDr. Stephen Henson <steve@openssl.org>
Thu, 16 Feb 2012 15:25:39 +0000 (15:25 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Thu, 16 Feb 2012 15:25:39 +0000 (15:25 +0000)
before rejecting multiple SGC restarts.

CHANGES
ssl/s3_srvr.c

diff --git a/CHANGES b/CHANGES
index 43961e0aa154a770e7f3a298fdf758c7fb5303ff..1c44009afd58062fe1a6cb499401d25cd6baa52f 100644 (file)
--- a/CHANGES
+++ b/CHANGES
        Add command line options to s_client/s_server.
      [Steve Henson]
 
+ Changes between 1.0.0g and 1.0.0h [xx XXX xxxx]
+
+  *) Fix CVE-2011-4619: make sure we really are receiving a 
+     client hello before rejecting multiple SGC restarts. Thanks to
+     Ivan Nestlerode <inestlerode@us.ibm.com> for discovering this bug.
+     [Steve Henson]
+
  Changes between 1.0.0f and 1.0.0g [18 Jan 2012]
 
   *) Fix for DTLS DoS issue introduced by fix for CVE-2011-4109.
index a60e4d699c99015881710fdebc76c0e599fb5b89..5944d8c484824a9147f6c6f7ede2d872f966e3dd 100644 (file)
@@ -870,14 +870,6 @@ int ssl3_check_client_hello(SSL *s)
        int ok;
        long n;
 
-       /* We only allow the client to restart the handshake once per
-        * negotiation. */
-       if (s->s3->flags & SSL3_FLAGS_SGC_RESTART_DONE)
-               {
-               SSLerr(SSL_F_SSL3_CHECK_CLIENT_HELLO, SSL_R_MULTIPLE_SGC_RESTARTS);
-               return -1;
-               }
-
        /* this function is called when we really expect a Certificate message,
         * so permit appropriate message length */
        n=s->method->ssl_get_message(s,
@@ -890,6 +882,13 @@ int ssl3_check_client_hello(SSL *s)
        s->s3->tmp.reuse_message = 1;
        if (s->s3->tmp.message_type == SSL3_MT_CLIENT_HELLO)
                {
+               /* We only allow the client to restart the handshake once per
+                * negotiation. */
+               if (s->s3->flags & SSL3_FLAGS_SGC_RESTART_DONE)
+                       {
+                       SSLerr(SSL_F_SSL3_CHECK_CLIENT_HELLO, SSL_R_MULTIPLE_SGC_RESTARTS);
+                       return -1;
+                       }
                /* Throw away what we have done so far in the current handshake,
                 * which will now be aborted. (A full SSL_clear would be too much.) */
 #ifndef OPENSSL_NO_DH