Skip to contentSkip to conversation

gnutls: Fix CVE-2019-3829 and CVE-2019-3836

PATCH New [email protected] 1 participant 1 message Oct 8, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gnutls: Fix CVE-2019-3829 and CVE-2019-3836

From: Dan Tran <[email protected]>

---
 .../gnutls/gnutls/CVE-2019-3829_p1.patch      |  39 +
 .../gnutls/gnutls/CVE-2019-3829_p2.patch      | 871 ++++++++++++++++++
 .../gnutls/gnutls/CVE-2019-3829_p3.patch      |  36 +
 .../gnutls/gnutls/CVE-2019-3836.patch         |  35 +
 meta/recipes-support/gnutls/gnutls_3.6.4.bb   |   4 +
 5 files changed, 985 insertions(+)
 create mode 100644 meta/recipes-support/gnutls/gnutls/CVE-2019-3829_p1.patch
 create mode 100644 meta/recipes-support/gnutls/gnutls/CVE-2019-3829_p2.patch
 create mode 100644 meta/recipes-support/gnutls/gnutls/CVE-2019-3829_p3.patch
 create mode 100644 meta/recipes-support/gnutls/gnutls/CVE-2019-3836.patch
meta/recipes-support/gnutls/gnutls/CVE-2019-3829_p1.patch new file +39 -0
new file mode 100644
index 0000000000..823869e85e
@@ -0,0 +1,39 @@
+From 367688c05988bc7257d7e1801c5acf17ef7e854d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Tim=20R=C3=BChsen?= <[email protected]>
+Date: Tue, 12 Feb 2019 15:09:11 +0100
+Subject: [PATCH 1/3] Automatically NULLify after gnutls_free()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This method prevents direct use-after-free and
+double-free issues.
+
+Signed-off-by: Tim Rühsen <[email protected]>
+
+CVE: CVE-2019-3829
+Upstream-Status: Backport
+[https://gitlab.com/gnutls/gnutls/commit/d39778e43d1674cb3ab3685157fd299816d535c0]
+
+Signed-off-by: Dan Tran <[email protected]>
+---
+ lib/includes/gnutls/gnutls.h.in | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/lib/includes/gnutls/gnutls.h.in b/lib/includes/gnutls/gnutls.h.in
+index 49990b5f5..fa77fd0df 100644
+--- a/lib/includes/gnutls/gnutls.h.in
++++ b/lib/includes/gnutls/gnutls.h.in
+@@ -2132,6 +2132,10 @@ extern _SYM_EXPORT gnutls_realloc_function gnutls_realloc;
+ extern _SYM_EXPORT gnutls_calloc_function gnutls_calloc;
+ extern _SYM_EXPORT gnutls_free_function gnutls_free;
+ 
++#ifdef GNUTLS_INTERNAL_BUILD
++#define gnutls_free(a) gnutls_free((void *) (a)), a=NULL
++#endif
++
+ extern _SYM_EXPORT char *(*gnutls_strdup) (const char *);
+ 
+ /* a variant of memset that doesn't get optimized out */
+-- 
+2.22.0.vfs.1.1.57.gbaf16c8
meta/recipes-support/gnutls/gnutls/CVE-2019-3829_p2.patch new file +871 -0

871 lines not on this page · raw message

meta/recipes-support/gnutls/gnutls/CVE-2019-3829_p3.patch new file +36 -0
new file mode 100644
index 0000000000..d27ea4a918
@@ -0,0 +1,36 @@
+From bf616850cf20af2bec3d68b82e6ac610ee8fc404 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Tim=20R=C3=BChsen?= <[email protected]>
+Date: Tue, 12 Feb 2019 15:20:23 +0100
+Subject: [PATCH 3/3] gnutls_x509_crt_init: Fix dereference of NULL pointer
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Tim Rühsen <[email protected]>
+
+CVE: CVE-2019-3829
+Upstream-Status: Backport
+[https://gitlab.com/gnutls/gnutls/commit/6b5cbc9ea5bdca704bdbe2f8fb551f720d634bc6]
+
+Signed-off-by: Dan Tran <[email protected]>
+---
+ lib/x509/x509.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/x509/x509.c b/lib/x509/x509.c
+index c149881f6..cc232ea50 100644
+--- a/lib/x509/x509.c
++++ b/lib/x509/x509.c
+@@ -224,8 +224,8 @@ int gnutls_x509_crt_init(gnutls_x509_crt_t * cert)
+ 	if (result < 0) {
+ 		gnutls_assert();
+ 		asn1_delete_structure(&tmp->cert);
+-		gnutls_free(tmp);
+ 		gnutls_subject_alt_names_deinit(tmp->san);
++		gnutls_free(tmp);
+ 		return result;
+ 	}
+ 
+-- 
+2.22.0.vfs.1.1.57.gbaf16c8
+
meta/recipes-support/gnutls/gnutls/CVE-2019-3836.patch new file +35 -0
new file mode 100644
index 0000000000..4aeb689347
@@ -0,0 +1,35 @@
+From c68195f0ff65144d7e0c32f4de5f264c4012983a Mon Sep 17 00:00:00 2001
+From: Daiki Ueno <[email protected]>
+Date: Mon, 25 Mar 2019 16:06:39 +0100
+Subject: [PATCH] handshake: add missing initialization of local variable
+
+Resolves: #704
+
+Signed-off-by: Daiki Ueno <[email protected]>
+Signed-off-by: Nikos Mavrogiannopoulos <[email protected]>
+
+CVE: CVE-2019-3836
+Upstream-Status: Backport
+[https://gitlab.com/gnutls/gnutls/commit/96e07075e8f105b13e76b11e493d5aa2dd937226]
+
+Signed-off-by: Dan Tran <[email protected]>
+---
+ lib/handshake-tls13.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/lib/handshake-tls13.c b/lib/handshake-tls13.c
+index 06c7c01d2..82689b5d8 100644
+--- a/lib/handshake-tls13.c
++++ b/lib/handshake-tls13.c
+@@ -534,6 +534,8 @@ _gnutls13_recv_async_handshake(gnutls_session_t session)
+ 		return gnutls_assert_val(GNUTLS_E_UNEXPECTED_PACKET);
+ 
+ 	do {
++		_gnutls_handshake_buffer_init(&hsk);
++
+ 		/* the received handshake message has already been pushed into
+ 		 * handshake buffers. As we do not need to use the handshake hash
+ 		 * buffers we call the lower level receive functions */
+-- 
+2.22.0.vfs.1.1.57.gbaf16c8
+
meta/recipes-support/gnutls/gnutls_3.6.4.bb +4 -0
index 6d2a11df34..30873f00db 100644
@@ -19,6 +19,10 @@ SHRT_VER = "${@d.getVar('PV').split('.')[0]}.${@d.getVar('PV').split('.')[1]}"
 
 SRC_URI = "https://www.gnupg.org/ftp/gcrypt/gnutls/v${SHRT_VER}/gnutls-${PV}.tar.xz \
            file://arm_eabi.patch \
+           file://CVE-2019-3829_p1.patch \
+           file://CVE-2019-3829_p2.patch \
+           file://CVE-2019-3829_p3.patch \
+           file://CVE-2019-3836.patch \
 "
 
 SRC_URI[md5sum] = "63363d1c00601f4d11a5cadc8b5e0799"
Signature · 1 line
2.17.1