[openssl-commits] [openssl] OpenSSL_1_0_1-stable update

Matt Caswell matt at openssl.org
Tue Aug 23 22:37:21 UTC 2016


The branch OpenSSL_1_0_1-stable has been updated
       via  1bbe48ab149893a78bf99c8eb8895c928900a16f (commit)
      from  3612ff6fcec0e3d1f2a598135fe12177c0419582 (commit)


- Log -----------------------------------------------------------------
commit 1bbe48ab149893a78bf99c8eb8895c928900a16f
Author: Dr. Stephen Henson <steve at openssl.org>
Date:   Tue Aug 23 18:14:54 2016 +0100

    Sanity check ticket length.
    
    If a ticket callback changes the HMAC digest to SHA512 the existing
    sanity checks are not sufficient and an attacker could perform a DoS
    attack with a malformed ticket. Add additional checks based on
    HMAC size.
    
    Thanks to Shi Lei for reporting this bug.
    
    CVE-2016-6302
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (cherry picked from commit baaabfd8fdcec04a691695fad9a664bea43202b6)

-----------------------------------------------------------------------

Summary of changes:
 ssl/t1_lib.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c
index d961e4a..7680491 100644
--- a/ssl/t1_lib.c
+++ b/ssl/t1_lib.c
@@ -2273,9 +2273,7 @@ static int tls_decrypt_ticket(SSL *s, const unsigned char *etick,
     HMAC_CTX hctx;
     EVP_CIPHER_CTX ctx;
     SSL_CTX *tctx = s->initial_ctx;
-    /* Need at least keyname + iv + some encrypted data */
-    if (eticklen < 48)
-        return 2;
+
     /* Initialize session ticket encryption and HMAC contexts */
     HMAC_CTX_init(&hctx);
     EVP_CIPHER_CTX_init(&ctx);
@@ -2309,6 +2307,13 @@ static int tls_decrypt_ticket(SSL *s, const unsigned char *etick,
     if (mlen < 0) {
         goto err;
     }
+    /* Sanity check ticket length: must exceed keyname + IV + HMAC */
+    if (eticklen <= 16 + EVP_CIPHER_CTX_iv_length(&ctx) + mlen) {
+        HMAC_CTX_cleanup(&hctx);
+        EVP_CIPHER_CTX_cleanup(&ctx);
+        return 2;
+    }
+
     eticklen -= mlen;
     /* Check HMAC of encrypted ticket */
     if (HMAC_Update(&hctx, etick, eticklen) <= 0


More information about the openssl-commits mailing list