Skip to content

Commit 3efa245

Browse files
CBL-Mariner-Botcorvus-callidusjslobodzian
authored
Co-authored-by: corvus-callidus <lyrydber@microsoft.com> Co-authored-by: jslobodzian <joslobo@microsoft.com>
1 parent be30df0 commit 3efa245

14 files changed

+518
-26
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
From 0a2ecb95993b588d2156dd6527459cc3983aabd5 Mon Sep 17 00:00:00 2001
2+
From: Andrew Dinh <andrewd@openssl.org>
3+
Date: Thu, 8 Jan 2026 01:24:30 +0900
4+
Subject: [PATCH] Add NULL check to PKCS12_item_decrypt_d2i_ex
5+
6+
Address CVE-2025-69421
7+
8+
Add NULL check for oct parameter
9+
---
10+
crypto/pkcs12/p12_decr.c | 5 +++++
11+
1 file changed, 5 insertions(+)
12+
13+
diff --git a/crypto/pkcs12/p12_decr.c b/crypto/pkcs12/p12_decr.c
14+
index 606713b9ee..1614da4404 100644
15+
--- a/crypto/pkcs12/p12_decr.c
16+
+++ b/crypto/pkcs12/p12_decr.c
17+
@@ -146,6 +146,11 @@ void *PKCS12_item_decrypt_d2i_ex(const X509_ALGOR *algor, const ASN1_ITEM *it,
18+
void *ret;
19+
int outlen = 0;
20+
21+
+ if (oct == NULL) {
22+
+ ERR_raise(ERR_LIB_PKCS12, ERR_R_PASSED_NULL_PARAMETER);
23+
+ return NULL;
24+
+ }
25+
+
26+
if (!PKCS12_pbe_crypt_ex(algor, pass, passlen, oct->data, oct->length,
27+
&out, &outlen, 0, libctx, propq))
28+
return NULL;
29+
--
30+
2.52.0
31+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
From 04a93ac145041e3ef0121a2688cf7c1b23780519 Mon Sep 17 00:00:00 2001
2+
From: Igor Ustinov <igus68@gmail.com>
3+
Date: Thu, 8 Jan 2026 14:02:54 +0100
4+
Subject: [PATCH] Check the received uncompressed certificate length to prevent
5+
excessive pre-decompression allocation.
6+
7+
The patch was proposed by Tomas Dulka and Stanislav Fort (Aisle Research).
8+
9+
Fixes: CVE-2025-66199
10+
---
11+
ssl/statem/statem_lib.c | 6 ++++++
12+
1 file changed, 6 insertions(+)
13+
14+
diff --git a/ssl/statem/statem_lib.c b/ssl/statem/statem_lib.c
15+
index 9e0c853c0d..f82d8dcdac 100644
16+
--- a/ssl/statem/statem_lib.c
17+
+++ b/ssl/statem/statem_lib.c
18+
@@ -2877,6 +2877,12 @@ MSG_PROCESS_RETURN tls13_process_compressed_certificate(SSL_CONNECTION *sc,
19+
goto err;
20+
}
21+
22+
+ /* Prevent excessive pre-decompression allocation */
23+
+ if (expected_length > sc->max_cert_list) {
24+
+ SSLfatal(sc, SSL_AD_ILLEGAL_PARAMETER, SSL_R_EXCESSIVE_MESSAGE_SIZE);
25+
+ goto err;
26+
+ }
27+
+
28+
if (PACKET_remaining(pkt) != comp_length || comp_length == 0) {
29+
SSLfatal(sc, SSL_AD_DECODE_ERROR, SSL_R_BAD_DECOMPRESSION);
30+
goto err;
31+
--
32+
2.52.0
33+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
From 190ba58c0a1d995d4da8b017054d4b74d138291c Mon Sep 17 00:00:00 2001
2+
From: Igor Ustinov <igus68@gmail.com>
3+
Date: Mon, 12 Jan 2026 12:13:35 +0100
4+
Subject: [PATCH 1/3] Correct handling of AEAD-encrypted CMS with inadmissibly
5+
long IV
6+
7+
Fixes CVE-2025-15467
8+
---
9+
crypto/evp/evp_lib.c | 5 ++---
10+
1 file changed, 2 insertions(+), 3 deletions(-)
11+
12+
diff --git a/crypto/evp/evp_lib.c b/crypto/evp/evp_lib.c
13+
index 9eae1d421c..58fa7ce43b 100644
14+
--- a/crypto/evp/evp_lib.c
15+
+++ b/crypto/evp/evp_lib.c
16+
@@ -228,10 +228,9 @@ int evp_cipher_get_asn1_aead_params(EVP_CIPHER_CTX *c, ASN1_TYPE *type,
17+
if (type == NULL || asn1_params == NULL)
18+
return 0;
19+
20+
- i = ossl_asn1_type_get_octetstring_int(type, &tl, NULL, EVP_MAX_IV_LENGTH);
21+
- if (i <= 0)
22+
+ i = ossl_asn1_type_get_octetstring_int(type, &tl, iv, EVP_MAX_IV_LENGTH);
23+
+ if (i <= 0 || i > EVP_MAX_IV_LENGTH)
24+
return -1;
25+
- ossl_asn1_type_get_octetstring_int(type, &tl, iv, i);
26+
27+
memcpy(asn1_params->iv, iv, i);
28+
asn1_params->iv_len = i;
29+
--
30+
2.52.0
31+
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
From 1a556ff619473af9e179b202284a961590d5a2bd Mon Sep 17 00:00:00 2001
2+
From: Norbert Pocs <norbertp@openssl.org>
3+
Date: Thu, 8 Jan 2026 15:04:54 +0100
4+
Subject: [PATCH] Fix OCB AES-NI/HW stream path unauthenticated/unencrypted
5+
trailing bytes
6+
MIME-Version: 1.0
7+
Content-Type: text/plain; charset=UTF-8
8+
Content-Transfer-Encoding: 8bit
9+
10+
When ctx->stream (e.g., AES‑NI or ARMv8 CE) is available, the fast path
11+
encrypts/decrypts full blocks but does not advance in/out pointers. The
12+
tail-handling code then operates on the base pointers, effectively reprocessing
13+
the beginning of the buffer while leaving the actual trailing bytes
14+
unencrypted (encryption) or using the wrong plaintext (decryption). The
15+
authentication checksum excludes the true tail.
16+
17+
CVE-2025-69418
18+
19+
Fixes: https://github.com/openssl/srt/issues/58
20+
21+
Signed-off-by: Norbert Pocs <norbertp@openssl.org>
22+
---
23+
crypto/modes/ocb128.c | 10 ++++++++--
24+
1 file changed, 8 insertions(+), 2 deletions(-)
25+
26+
diff --git a/crypto/modes/ocb128.c b/crypto/modes/ocb128.c
27+
index ce72baf6da..8a5d7c7db0 100644
28+
--- a/crypto/modes/ocb128.c
29+
+++ b/crypto/modes/ocb128.c
30+
@@ -337,7 +337,7 @@ int CRYPTO_ocb128_encrypt(OCB128_CONTEXT *ctx,
31+
32+
if (num_blocks && all_num_blocks == (size_t)all_num_blocks
33+
&& ctx->stream != NULL) {
34+
- size_t max_idx = 0, top = (size_t)all_num_blocks;
35+
+ size_t max_idx = 0, top = (size_t)all_num_blocks, processed_bytes = 0;
36+
37+
/*
38+
* See how many L_{i} entries we need to process data at hand
39+
@@ -351,6 +351,9 @@ int CRYPTO_ocb128_encrypt(OCB128_CONTEXT *ctx,
40+
ctx->stream(in, out, num_blocks, ctx->keyenc,
41+
(size_t)ctx->sess.blocks_processed + 1, ctx->sess.offset.c,
42+
(const unsigned char (*)[16])ctx->l, ctx->sess.checksum.c);
43+
+ processed_bytes = num_blocks * 16;
44+
+ in += processed_bytes;
45+
+ out += processed_bytes;
46+
} else {
47+
/* Loop through all full blocks to be encrypted */
48+
for (i = ctx->sess.blocks_processed + 1; i <= all_num_blocks; i++) {
49+
@@ -429,7 +432,7 @@ int CRYPTO_ocb128_decrypt(OCB128_CONTEXT *ctx,
50+
51+
if (num_blocks && all_num_blocks == (size_t)all_num_blocks
52+
&& ctx->stream != NULL) {
53+
- size_t max_idx = 0, top = (size_t)all_num_blocks;
54+
+ size_t max_idx = 0, top = (size_t)all_num_blocks, processed_bytes = 0;
55+
56+
/*
57+
* See how many L_{i} entries we need to process data at hand
58+
@@ -443,6 +446,9 @@ int CRYPTO_ocb128_decrypt(OCB128_CONTEXT *ctx,
59+
ctx->stream(in, out, num_blocks, ctx->keydec,
60+
(size_t)ctx->sess.blocks_processed + 1, ctx->sess.offset.c,
61+
(const unsigned char (*)[16])ctx->l, ctx->sess.checksum.c);
62+
+ processed_bytes = num_blocks * 16;
63+
+ in += processed_bytes;
64+
+ out += processed_bytes;
65+
} else {
66+
OCB_BLOCK tmp;
67+
68+
--
69+
2.52.0
70+
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
From fb41a020b838f8145d07586275053568469a999c Mon Sep 17 00:00:00 2001
2+
From: Neil Horman <nhorman@openssl.org>
3+
Date: Wed, 7 Jan 2026 11:52:09 -0500
4+
Subject: [PATCH] Fix heap buffer overflow in BIO_f_linebuffer
5+
6+
When a FIO_f_linebuffer is part of a bio chain, and the next BIO
7+
preforms short writes, the remainder of the unwritten buffer is copied
8+
unconditionally to the internal buffer ctx->obuf, which may not be
9+
sufficiently sized to handle the remaining data, resulting in a buffer
10+
overflow.
11+
12+
Fix it by only copying data when ctx->obuf has space, flushing to the
13+
next BIO to increase available storage if needed.
14+
15+
Fixes CVE-2025-68160
16+
---
17+
crypto/bio/bf_lbuf.c | 32 ++++++++++++++++++++++++++------
18+
1 file changed, 26 insertions(+), 6 deletions(-)
19+
20+
diff --git a/crypto/bio/bf_lbuf.c b/crypto/bio/bf_lbuf.c
21+
index eed3dc4..ce71231 100644
22+
--- a/crypto/bio/bf_lbuf.c
23+
+++ b/crypto/bio/bf_lbuf.c
24+
@@ -186,14 +186,34 @@ static int linebuffer_write(BIO *b, const char *in, int inl)
25+
while (foundnl && inl > 0);
26+
/*
27+
* We've written as much as we can. The rest of the input buffer, if
28+
- * any, is text that doesn't and with a NL and therefore needs to be
29+
- * saved for the next trip.
30+
+ * any, is text that doesn't end with a NL and therefore we need to try
31+
+ * free up some space in our obuf so we can make forward progress.
32+
*/
33+
- if (inl > 0) {
34+
- memcpy(&(ctx->obuf[ctx->obuf_len]), in, inl);
35+
- ctx->obuf_len += inl;
36+
- num += inl;
37+
+ while (inl > 0) {
38+
+ size_t avail = (size_t)ctx->obuf_size - (size_t)ctx->obuf_len;
39+
+ size_t to_copy;
40+
+
41+
+ if (avail == 0) {
42+
+ /* Flush buffered data to make room */
43+
+ i = BIO_write(b->next_bio, ctx->obuf, ctx->obuf_len);
44+
+ if (i <= 0) {
45+
+ BIO_copy_next_retry(b);
46+
+ return num > 0 ? num : i;
47+
+ }
48+
+ if (i < ctx->obuf_len)
49+
+ memmove(ctx->obuf, ctx->obuf + i, ctx->obuf_len - i);
50+
+ ctx->obuf_len -= i;
51+
+ continue;
52+
+ }
53+
+
54+
+ to_copy = inl > (int)avail ? avail : (size_t)inl;
55+
+ memcpy(&(ctx->obuf[ctx->obuf_len]), in, to_copy);
56+
+ ctx->obuf_len += (int)to_copy;
57+
+ in += to_copy;
58+
+ inl -= (int)to_copy;
59+
+ num += (int)to_copy;
60+
}
61+
+
62+
return num;
63+
}
64+
65+
--
66+
2.45.4
67+
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
From 6453d278557c8719233793730ec500c84aea55d9 Mon Sep 17 00:00:00 2001
2+
From: Bob Beck <beck@openssl.org>
3+
Date: Wed, 7 Jan 2026 11:29:48 -0700
4+
Subject: [PATCH] Verify ASN1 object's types before attempting to access them
5+
as a particular type
6+
7+
Issue was reported in ossl_ess_get_signing_cert but is also present in
8+
ossl_ess_get_signing_cert_v2.
9+
10+
Fixes: https://github.com/openssl/srt/issues/61
11+
Fixes CVE-2025-69420
12+
---
13+
crypto/ts/ts_rsp_verify.c | 4 ++--
14+
1 file changed, 2 insertions(+), 2 deletions(-)
15+
16+
diff --git a/crypto/ts/ts_rsp_verify.c b/crypto/ts/ts_rsp_verify.c
17+
index 3876e30f47..40dab687d1 100644
18+
--- a/crypto/ts/ts_rsp_verify.c
19+
+++ b/crypto/ts/ts_rsp_verify.c
20+
@@ -209,7 +209,7 @@ static ESS_SIGNING_CERT *ossl_ess_get_signing_cert(const PKCS7_SIGNER_INFO *si)
21+
const unsigned char *p;
22+
23+
attr = PKCS7_get_signed_attribute(si, NID_id_smime_aa_signingCertificate);
24+
- if (attr == NULL)
25+
+ if (attr == NULL || attr->type != V_ASN1_SEQUENCE)
26+
return NULL;
27+
p = attr->value.sequence->data;
28+
return d2i_ESS_SIGNING_CERT(NULL, &p, attr->value.sequence->length);
29+
@@ -221,7 +221,7 @@ static ESS_SIGNING_CERT_V2 *ossl_ess_get_signing_cert_v2(const PKCS7_SIGNER_INFO
30+
const unsigned char *p;
31+
32+
attr = PKCS7_get_signed_attribute(si, NID_id_smime_aa_signingCertificateV2);
33+
- if (attr == NULL)
34+
+ if (attr == NULL || attr->type != V_ASN1_SEQUENCE)
35+
return NULL;
36+
p = attr->value.sequence->data;
37+
return d2i_ESS_SIGNING_CERT_V2(NULL, &p, attr->value.sequence->length);
38+
--
39+
2.52.0
40+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
From 7da6afe3dac7d65b30f87f2c5d305b6e699bc5dc Mon Sep 17 00:00:00 2001
2+
From: Daniel Kubec <kubec@openssl.org>
3+
Date: Fri, 9 Jan 2026 14:33:24 +0100
4+
Subject: [PATCH] ossl_quic_get_cipher_by_char(): Add a NULL guard before
5+
dereferencing SSL_CIPHER
6+
7+
Fixes CVE-2025-15468
8+
---
9+
ssl/quic/quic_impl.c | 2 ++
10+
1 file changed, 2 insertions(+)
11+
12+
diff --git a/ssl/quic/quic_impl.c b/ssl/quic/quic_impl.c
13+
index 87c1370a8d..89c108a973 100644
14+
--- a/ssl/quic/quic_impl.c
15+
+++ b/ssl/quic/quic_impl.c
16+
@@ -5222,6 +5222,8 @@ const SSL_CIPHER *ossl_quic_get_cipher_by_char(const unsigned char *p)
17+
{
18+
const SSL_CIPHER *ciph = ssl3_get_cipher_by_char(p);
19+
20+
+ if (ciph == NULL)
21+
+ return NULL;
22+
if ((ciph->algorithm2 & SSL_QUIC) == 0)
23+
return NULL;
24+
25+
--
26+
2.52.0
27+
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
From 6fb47957bfb0aef2deaa7df7aebd4eb52ffe20ce Mon Sep 17 00:00:00 2001
2+
From: Igor Ustinov <igus68@gmail.com>
3+
Date: Mon, 12 Jan 2026 12:15:42 +0100
4+
Subject: [PATCH 2/3] Some comments to clarify functions usage
5+
6+
---
7+
crypto/asn1/evp_asn1.c | 20 ++++++++++++++++++++
8+
1 file changed, 20 insertions(+)
9+
10+
diff --git a/crypto/asn1/evp_asn1.c b/crypto/asn1/evp_asn1.c
11+
index 382576364b..e73bda64e3 100644
12+
--- a/crypto/asn1/evp_asn1.c
13+
+++ b/crypto/asn1/evp_asn1.c
14+
@@ -60,6 +60,12 @@ static ossl_inline void asn1_type_init_oct(ASN1_OCTET_STRING *oct,
15+
oct->flags = 0;
16+
}
17+
18+
+/*
19+
+ * This function copies 'anum' to 'num' and the data of 'oct' to 'data'.
20+
+ * If the length of 'data' > 'max_len', copies only the first 'max_len'
21+
+ * bytes, but returns the full length of 'oct'; this allows distinguishing
22+
+ * whether all the data was copied.
23+
+ */
24+
static int asn1_type_get_int_oct(ASN1_OCTET_STRING *oct, int32_t anum,
25+
long *num, unsigned char *data, int max_len)
26+
{
27+
@@ -106,6 +112,13 @@ int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, unsigned char *data,
28+
return 0;
29+
}
30+
31+
+/*
32+
+ * This function decodes an int-octet sequence and copies the integer to 'num'
33+
+ * and the data of octet to 'data'.
34+
+ * If the length of 'data' > 'max_len', copies only the first 'max_len'
35+
+ * bytes, but returns the full length of 'oct'; this allows distinguishing
36+
+ * whether all the data was copied.
37+
+ */
38+
int ASN1_TYPE_get_int_octetstring(const ASN1_TYPE *a, long *num,
39+
unsigned char *data, int max_len)
40+
{
41+
@@ -162,6 +175,13 @@ int ossl_asn1_type_set_octetstring_int(ASN1_TYPE *a, long num,
42+
return 0;
43+
}
44+
45+
+/*
46+
+ * This function decodes an octet-int sequence and copies the data of octet
47+
+ * to 'data' and the integer to 'num'.
48+
+ * If the length of 'data' > 'max_len', copies only the first 'max_len'
49+
+ * bytes, but returns the full length of 'oct'; this allows distinguishing
50+
+ * whether all the data was copied.
51+
+ */
52+
int ossl_asn1_type_get_octetstring_int(const ASN1_TYPE *a, long *num,
53+
unsigned char *data, int max_len)
54+
{
55+
--
56+
2.52.0
57+

0 commit comments

Comments
 (0)