From 8ac9ad185c0889af0bfb2fcd90a6987cb972eb0a Mon Sep 17 00:00:00 2001 From: Sona Sarmadi Date: Mon, 26 Sep 2016 12:18:19 +0200 Subject: openssl: Security fix CVE-2016-6302 affects openssl < 1.0.2i Reference: https://www.openssl.org/news/secadv/20160922.txt Signed-off-by: Armin Kuster Signed-off-by: Sona Sarmadi Signed-off-by: Adrian Dudau --- .../openssl/openssl/CVE-2016-6302.patch | 53 ++++++++++++++++++++++ .../openssl/openssl_1.0.2h.bbappend | 1 + 2 files changed, 54 insertions(+) create mode 100644 recipes-connectivity/openssl/openssl/CVE-2016-6302.patch diff --git a/recipes-connectivity/openssl/openssl/CVE-2016-6302.patch b/recipes-connectivity/openssl/openssl/CVE-2016-6302.patch new file mode 100644 index 0000000..a72ee70 --- /dev/null +++ b/recipes-connectivity/openssl/openssl/CVE-2016-6302.patch @@ -0,0 +1,53 @@ +From baaabfd8fdcec04a691695fad9a664bea43202b6 Mon Sep 17 00:00:00 2001 +From: "Dr. Stephen Henson" +Date: Tue, 23 Aug 2016 18:14:54 +0100 +Subject: [PATCH] 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 + +Upstream-Status: Backport +CVE: CVE-2016-6302 +Signed-off-by: Armin Kuster + +--- + ssl/t1_lib.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +Index: openssl-1.0.2h/ssl/t1_lib.c +=================================================================== +--- openssl-1.0.2h.orig/ssl/t1_lib.c ++++ openssl-1.0.2h/ssl/t1_lib.c +@@ -3397,9 +3397,7 @@ static int tls_decrypt_ticket(SSL *s, co + 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); +@@ -3433,6 +3431,13 @@ static int tls_decrypt_ticket(SSL *s, co + 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 diff --git a/recipes-connectivity/openssl/openssl_1.0.2h.bbappend b/recipes-connectivity/openssl/openssl_1.0.2h.bbappend index eb369e4..e07690f 100644 --- a/recipes-connectivity/openssl/openssl_1.0.2h.bbappend +++ b/recipes-connectivity/openssl/openssl_1.0.2h.bbappend @@ -7,4 +7,5 @@ SRC_URI += "file://CVE-2016-2178.patch \ file://CVE-2016-2181_p2.patch \ file://CVE-2016-2181_p3.patch \ file://CVE-2016-2182.patch \ + file://CVE-2016-6302.patch \ " -- cgit v1.2.3-54-g00ecf