Skip to contentSkip to conversation

openssl: Security fix for CVE-2024-4741

PATCH New Siddharth 1 participant 1 message Jun 3, 2024

lore
Share & tools
lore

Siddharth

author
#0 lore raw

PATCH v2 1/1 openssl: Security fix for CVE-2024-4741

From: Siddharth Doshi <[email protected]>

Upstream-Status: Backport from [https://github.com/openssl/openssl/commit/c88c3de51020c37e8706bf7a682a162593053aac, https://github.com/openssl/openssl/commit/10171e5b511b700c5ecd4fd3e1086b19c34b1ae3, https://github.com/openssl/openssl/commit/ec87bc54c8ccc13caa29bc7f74ae84d78ffa1f5e, https://github.com/openssl/openssl/commit/d0f5a122ba271c9c848e16970249f61b3fc11b2b, https://github.com/openssl/openssl/commit/d03e6fdf54ea41fb35e0499134eb3a7f831eeeeb]

CVE's Fixed:
CVE-2024-4741:Use After Free with SSL_free_buffers

---
 .../openssl/openssl/CVE-2024-4741_1.patch     |  43 ++++
 .../openssl/openssl/CVE-2024-4741_2.patch     |  52 +++++
 .../openssl/openssl/CVE-2024-4741_3.patch     | 137 ++++++++++++
 .../openssl/openssl/CVE-2024-4741_4.patch     | 124 +++++++++++
 .../openssl/openssl/CVE-2024-4741_5.patch     | 205 ++++++++++++++++++
 .../openssl/openssl_3.2.1.bb                  |   5 +
 6 files changed, 566 insertions(+)
 create mode 100644 meta/recipes-connectivity/openssl/openssl/CVE-2024-4741_1.patch
 create mode 100644 meta/recipes-connectivity/openssl/openssl/CVE-2024-4741_2.patch
 create mode 100644 meta/recipes-connectivity/openssl/openssl/CVE-2024-4741_3.patch
 create mode 100644 meta/recipes-connectivity/openssl/openssl/CVE-2024-4741_4.patch
 create mode 100644 meta/recipes-connectivity/openssl/openssl/CVE-2024-4741_5.patch
meta/recipes-connectivity/openssl/openssl/CVE-2024-4741_1.patch new file +43 -0
new file mode 100644
index 0000000000..6987220c35
@@ -0,0 +1,43 @@
+From fe3eeaab1b2b5c9f9240a5ebafa5057a3211c3d0 Mon Sep 17 00:00:00 2001
+From: Matt Caswell <[email protected]>
+Date: Tue, 23 Apr 2024 16:34:46 +0100
+Subject: [PATCH 1/5] Only free the read buffers if we're not using them
+
+If we're part way through processing a record, or the application has
+not released all the records then we should not free our buffer because
+they are still needed.
+
+CVE-2024-4741
+
+Reviewed-by: Tomas Mraz <[email protected]>
+Reviewed-by: Neil Horman <[email protected]>
+(Merged from https://github.com/openssl/openssl/pull/24395)
+
+(cherry picked from commit 38690cab18de88198f46478565fab423cf534efa)
+
+Upstream-Status: Backport from [https://github.com/openssl/openssl/commit/c88c3de51020c37e8706bf7a682a162593053aac]
+CVE: CVE-2024-4741
+Signed-off-by: Siddharth Doshi <[email protected]>
+---
+ ssl/record/methods/tls_common.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/ssl/record/methods/tls_common.c b/ssl/record/methods/tls_common.c
+index 08e519a..f46da0f 100644
+--- a/ssl/record/methods/tls_common.c
++++ b/ssl/record/methods/tls_common.c
+@@ -2129,7 +2129,10 @@ int tls_free_buffers(OSSL_RECORD_LAYER *rl)
+     /* Read direction */
+ 
+     /* If we have pending data to be read then fail */
+-    if (rl->curr_rec < rl->num_recs || TLS_BUFFER_get_left(&rl->rbuf) != 0)
++    if (rl->curr_rec < rl->num_recs
++            || rl->curr_rec != rl->num_released
++            || TLS_BUFFER_get_left(&rl->rbuf) != 0
++            || rl->rstate == SSL_ST_READ_BODY)
+         return 0;
+ 
+     return tls_release_read_buffer(rl);
+-- 
+2.44.0
+
meta/recipes-connectivity/openssl/openssl/CVE-2024-4741_2.patch new file +52 -0

52 lines not on this page · raw message

meta/recipes-connectivity/openssl/openssl/CVE-2024-4741_3.patch new file +137 -0

137 lines not on this page · raw message

meta/recipes-connectivity/openssl/openssl/CVE-2024-4741_4.patch new file +124 -0

124 lines not on this page · raw message

meta/recipes-connectivity/openssl/openssl/CVE-2024-4741_5.patch new file +205 -0

205 lines not on this page · raw message

meta/recipes-connectivity/openssl/openssl_3.2.1.bb +5 -0
index 9bdf7e1ec6..495f0d7630 100644
@@ -15,6 +15,11 @@ SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \
            file://bti.patch \
            file://CVE-2024-2511.patch \
            file://CVE-2024-4603.patch \
+           file://CVE-2024-4741_1.patch \
+           file://CVE-2024-4741_2.patch \
+           file://CVE-2024-4741_3.patch \
+           file://CVE-2024-4741_4.patch \
+           file://CVE-2024-4741_5.patch \
            "
 
 SRC_URI:append:class-nativesdk = " \
Signature · 1 line
2.34.1