Skip to content

Commit c1bc841

Browse files
authored
Merge pull request #866 from span786/PA-6625-apply-open-ssl-cve-2024-4741-fixes-for-open-ssl-1-1-1
(PA-6625): Applied following CVE-2024-4741 to openssl
2 parents a49f32a + c1ac1b7 commit c1bc841

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

configs/components/openssl-1.1.1.rb

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
pkg.apply_patch 'resources/patches/openssl/CVE-2023-5678.patch'
9191
pkg.apply_patch 'resources/patches/openssl/CVE-2024-0727.patch'
9292
pkg.apply_patch 'resources/patches/openssl/openssl-1.1.1-CVE-2024-2511.patch'
93+
pkg.apply_patch 'resources/patches/openssl/openssl-1.1.1-CVE-2024-4741.patch'
9394

9495
####################
9596
# BUILD REQUIREMENTS
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
Only free the read buffers if we're not using them
2+
3+
If we're part way through processing a record, or the application has
4+
not released all the records then we should not free our buffer because
5+
they are still needed.
6+
7+
CVE-2024-4741
8+
9+
Reviewed-by: Tomas Mraz <[email protected]>
10+
Reviewed-by: Neil Horman <[email protected]>
11+
Reviewed-by: Matt Caswell <[email protected]>
12+
---
13+
ssl/record/rec_layer_s3.c | 9 +++++++++
14+
ssl/record/record.h | 1 +
15+
ssl/ssl_lib.c | 3 +++
16+
3 files changed, 13 insertions(+)
17+
18+
diff --git a/ssl/record/rec_layer_s3.c b/ssl/record/rec_layer_s3.c
19+
index 1db1712a09..525c3abf43 100644
20+
--- a/ssl/record/rec_layer_s3.c
21+
+++ b/ssl/record/rec_layer_s3.c
22+
@@ -81,6 +81,15 @@ int RECORD_LAYER_read_pending(const RECORD_LAYER *rl)
23+
return SSL3_BUFFER_get_left(&rl->rbuf) != 0;
24+
}
25+
26+
+int RECORD_LAYER_data_present(const RECORD_LAYER *rl)
27+
+{
28+
+ if (rl->rstate == SSL_ST_READ_BODY)
29+
+ return 1;
30+
+ if (RECORD_LAYER_processed_read_pending(rl))
31+
+ return 1;
32+
+ return 0;
33+
+}
34+
+
35+
/* Checks if we have decrypted unread record data pending */
36+
int RECORD_LAYER_processed_read_pending(const RECORD_LAYER *rl)
37+
{
38+
diff --git a/ssl/record/record.h b/ssl/record/record.h
39+
index af56206e07..513ab39888 100644
40+
--- a/ssl/record/record.h
41+
+++ b/ssl/record/record.h
42+
@@ -197,6 +197,7 @@ void RECORD_LAYER_release(RECORD_LAYER *rl);
43+
int RECORD_LAYER_read_pending(const RECORD_LAYER *rl);
44+
int RECORD_LAYER_processed_read_pending(const RECORD_LAYER *rl);
45+
int RECORD_LAYER_write_pending(const RECORD_LAYER *rl);
46+
+int RECORD_LAYER_data_present(const RECORD_LAYER *rl);
47+
void RECORD_LAYER_reset_read_sequence(RECORD_LAYER *rl);
48+
void RECORD_LAYER_reset_write_sequence(RECORD_LAYER *rl);
49+
int RECORD_LAYER_is_sslv2_record(RECORD_LAYER *rl);
50+
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
51+
index 47adc3211c..ff2a40e115 100644
52+
--- a/ssl/ssl_lib.c
53+
+++ b/ssl/ssl_lib.c
54+
@@ -5247,6 +5247,9 @@ int SSL_free_buffers(SSL *ssl)
55+
if (RECORD_LAYER_read_pending(rl) || RECORD_LAYER_write_pending(rl))
56+
return 0;
57+
58+
+ if (RECORD_LAYER_data_present(rl))
59+
+ return 0;
60+
+
61+
RECORD_LAYER_release(rl);
62+
return 1;
63+
}

0 commit comments

Comments
 (0)