Skip to content

Commit 4dd84d2

Browse files
committed
(PA-6378) Address a low-severity vulnerability, CVE-2024-2511
1 parent 53ff454 commit 4dd84d2

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed

configs/components/openssl-3.0.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@
8585
end
8686
end
8787

88+
pkg.apply_patch 'resources/patches/openssl/CVE-2024-2511.patch'
89+
8890
####################
8991
# BUILD REQUIREMENTS
9092
####################
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
2+
index 81a9f0728d..92bfaa3b02 100644
3+
--- a/ssl/ssl_lib.c
4+
+++ b/ssl/ssl_lib.c
5+
@@ -3717,9 +3717,10 @@ void ssl_update_cache(SSL *s, int mode)
6+
7+
/*
8+
* If the session_id_length is 0, we are not supposed to cache it, and it
9+
- * would be rather hard to do anyway :-)
10+
+ * would be rather hard to do anyway :-). Also if the session has already
11+
+ * been marked as not_resumable we should not cache it for later reuse.
12+
*/
13+
- if (s->session->session_id_length == 0)
14+
+ if (s->session->session_id_length == 0 || s->session->not_resumable)
15+
return;
16+
17+
/*
18+
diff --git a/ssl/ssl_sess.c b/ssl/ssl_sess.c
19+
index d836b33ed0..75adbd9e52 100644
20+
--- a/ssl/ssl_sess.c
21+
+++ b/ssl/ssl_sess.c
22+
@@ -152,16 +152,11 @@ SSL_SESSION *SSL_SESSION_new(void)
23+
return ss;
24+
}
25+
26+
-SSL_SESSION *SSL_SESSION_dup(const SSL_SESSION *src)
27+
-{
28+
- return ssl_session_dup(src, 1);
29+
-}
30+
-
31+
/*
32+
* Create a new SSL_SESSION and duplicate the contents of |src| into it. If
33+
* ticket == 0 then no ticket information is duplicated, otherwise it is.
34+
*/
35+
-SSL_SESSION *ssl_session_dup(const SSL_SESSION *src, int ticket)
36+
+static SSL_SESSION *ssl_session_dup_intern(const SSL_SESSION *src, int ticket)
37+
{
38+
SSL_SESSION *dest;
39+
40+
@@ -285,6 +280,27 @@ SSL_SESSION *ssl_session_dup(const SSL_SESSION *src, int ticket)
41+
return NULL;
42+
}
43+
44+
+SSL_SESSION *SSL_SESSION_dup(const SSL_SESSION *src)
45+
+{
46+
+ return ssl_session_dup_intern(src, 1);
47+
+}
48+
+
49+
+/*
50+
+ * Used internally when duplicating a session which might be already shared.
51+
+ * We will have resumed the original session. Subsequently we might have marked
52+
+ * it as non-resumable (e.g. in another thread) - but this copy should be ok to
53+
+ * resume from.
54+
+ */
55+
+SSL_SESSION *ssl_session_dup(const SSL_SESSION *src, int ticket)
56+
+{
57+
+ SSL_SESSION *sess = ssl_session_dup_intern(src, ticket);
58+
+
59+
+ if (sess != NULL)
60+
+ sess->not_resumable = 0;
61+
+
62+
+ return sess;
63+
+}
64+
+
65+
const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s, unsigned int *len)
66+
{
67+
if (len)
68+
diff --git a/ssl/statem/statem_srvr.c b/ssl/statem/statem_srvr.c
69+
index a9e67f9d32..6c942e6bce 100644
70+
--- a/ssl/statem/statem_srvr.c
71+
+++ b/ssl/statem/statem_srvr.c
72+
@@ -2338,9 +2338,8 @@ int tls_construct_server_hello(SSL *s, WPACKET *pkt)
73+
* so the following won't overwrite an ID that we're supposed
74+
* to send back.
75+
*/
76+
- if (s->session->not_resumable ||
77+
- (!(s->ctx->session_cache_mode & SSL_SESS_CACHE_SERVER)
78+
- && !s->hit))
79+
+ if (!(s->ctx->session_cache_mode & SSL_SESS_CACHE_SERVER)
80+
+ && !s->hit)
81+
s->session->session_id_length = 0;
82+
83+
if (usetls13) {

0 commit comments

Comments
 (0)