Skip to content

Commit 0cdfe1d

Browse files
azurelinux-securityKanishk Bansal
andauthored
[AutoPR- Security] Patch hvloader for CVE-2026-22796, CVE-2025-68160, CVE-2025-69418 [MEDIUM] (#15656)
Co-authored-by: Kanishk Bansal <kanbansal@microsoft.com>
1 parent e4d0609 commit 0cdfe1d

5 files changed

Lines changed: 247 additions & 2 deletions

File tree

SPECS-SIGNED/hvloader-signed/hvloader-signed.spec

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Summary: Signed HvLoader.efi for %{buildarch} systems
77
Name: hvloader-signed-%{buildarch}
88
Version: 1.0.1
9-
Release: 16%{?dist}
9+
Release: 17%{?dist}
1010
License: MIT
1111
Vendor: Microsoft Corporation
1212
Distribution: Mariner
@@ -69,6 +69,9 @@ popd
6969
/boot/efi/HvLoader.efi
7070

7171
%changelog
72+
* Mon Feb 02 2026 Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> - 1.0.1-17
73+
- Bump release for consistency with hvloader spec.
74+
7275
* Tue Jan 06 2026 Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> - 1.0.1-16
7376
- Bump release for consistency with hvloader spec.
7477

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
From ee8b48af7a053a62baba11a21e08c0cfba4b695b 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+
MIME-Version: 1.0
6+
Content-Type: text/plain; charset=UTF-8
7+
Content-Transfer-Encoding: 8bit
8+
9+
When a FIO_f_linebuffer is part of a bio chain, and the next BIO
10+
preforms short writes, the remainder of the unwritten buffer is copied
11+
unconditionally to the internal buffer ctx->obuf, which may not be
12+
sufficiently sized to handle the remaining data, resulting in a buffer
13+
overflow.
14+
15+
Fix it by only copying data when ctx->obuf has space, flushing to the
16+
next BIO to increase available storage if needed.
17+
18+
Fixes openssl/srt#48
19+
20+
Fixes CVE-2025-68160
21+
22+
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
23+
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
24+
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
25+
Reviewed-by: Tomas Mraz <tomas@openssl.org>
26+
MergeDate: Mon Jan 26 19:41:40 2026
27+
(cherry picked from commit b21663c35a6f0ed4c8de06855bdc7a6a21f00c2f)
28+
Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com>
29+
Upstream-reference: https://github.com/openssl/openssl/commit/475c466ef2fbd8fc1df6fae1c3eed9c813fc8ff6.patch
30+
---
31+
.../OpensslLib/openssl/crypto/bio/bf_lbuf.c | 32 +++++++++++++++----
32+
1 file changed, 26 insertions(+), 6 deletions(-)
33+
34+
diff --git a/CryptoPkg/Library/OpensslLib/openssl/crypto/bio/bf_lbuf.c b/CryptoPkg/Library/OpensslLib/openssl/crypto/bio/bf_lbuf.c
35+
index 72f99018..34dd0357 100644
36+
--- a/CryptoPkg/Library/OpensslLib/openssl/crypto/bio/bf_lbuf.c
37+
+++ b/CryptoPkg/Library/OpensslLib/openssl/crypto/bio/bf_lbuf.c
38+
@@ -191,14 +191,34 @@ static int linebuffer_write(BIO *b, const char *in, int inl)
39+
while (foundnl && inl > 0);
40+
/*
41+
* We've written as much as we can. The rest of the input buffer, if
42+
- * any, is text that doesn't and with a NL and therefore needs to be
43+
- * saved for the next trip.
44+
+ * any, is text that doesn't end with a NL and therefore we need to try
45+
+ * free up some space in our obuf so we can make forward progress.
46+
*/
47+
- if (inl > 0) {
48+
- memcpy(&(ctx->obuf[ctx->obuf_len]), in, inl);
49+
- ctx->obuf_len += inl;
50+
- num += inl;
51+
+ while (inl > 0) {
52+
+ size_t avail = (size_t)ctx->obuf_size - (size_t)ctx->obuf_len;
53+
+ size_t to_copy;
54+
+
55+
+ if (avail == 0) {
56+
+ /* Flush buffered data to make room */
57+
+ i = BIO_write(b->next_bio, ctx->obuf, ctx->obuf_len);
58+
+ if (i <= 0) {
59+
+ BIO_copy_next_retry(b);
60+
+ return num > 0 ? num : i;
61+
+ }
62+
+ if (i < ctx->obuf_len)
63+
+ memmove(ctx->obuf, ctx->obuf + i, ctx->obuf_len - i);
64+
+ ctx->obuf_len -= i;
65+
+ continue;
66+
+ }
67+
+
68+
+ to_copy = inl > (int)avail ? avail : (size_t)inl;
69+
+ memcpy(&(ctx->obuf[ctx->obuf_len]), in, to_copy);
70+
+ ctx->obuf_len += (int)to_copy;
71+
+ in += to_copy;
72+
+ inl -= (int)to_copy;
73+
+ num += (int)to_copy;
74+
}
75+
+
76+
return num;
77+
}
78+
79+
--
80+
2.45.4
81+
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
From 7b4ea5f9ec9330d4b26e74e83feb9e03949e3c43 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+
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
24+
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
25+
Reviewed-by: Tomas Mraz <tomas@openssl.org>
26+
MergeDate: Mon Jan 26 19:48:35 2026
27+
(cherry picked from commit be9375d5d45dfaf897b56ef148a0b58402491fcb)
28+
Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com>
29+
Upstream-reference: https://github.com/openssl/openssl/commit/52d23c86a54adab5ee9f80e48b242b52c4cc2347.patch
30+
---
31+
.../Library/OpensslLib/openssl/crypto/modes/ocb128.c | 10 ++++++++--
32+
1 file changed, 8 insertions(+), 2 deletions(-)
33+
34+
diff --git a/CryptoPkg/Library/OpensslLib/openssl/crypto/modes/ocb128.c b/CryptoPkg/Library/OpensslLib/openssl/crypto/modes/ocb128.c
35+
index b39a55a1..2ef39826 100644
36+
--- a/CryptoPkg/Library/OpensslLib/openssl/crypto/modes/ocb128.c
37+
+++ b/CryptoPkg/Library/OpensslLib/openssl/crypto/modes/ocb128.c
38+
@@ -342,7 +342,7 @@ int CRYPTO_ocb128_encrypt(OCB128_CONTEXT *ctx,
39+
40+
if (num_blocks && all_num_blocks == (size_t)all_num_blocks
41+
&& ctx->stream != NULL) {
42+
- size_t max_idx = 0, top = (size_t)all_num_blocks;
43+
+ size_t max_idx = 0, top = (size_t)all_num_blocks, processed_bytes = 0;
44+
45+
/*
46+
* See how many L_{i} entries we need to process data at hand
47+
@@ -356,6 +356,9 @@ int CRYPTO_ocb128_encrypt(OCB128_CONTEXT *ctx,
48+
ctx->stream(in, out, num_blocks, ctx->keyenc,
49+
(size_t)ctx->sess.blocks_processed + 1, ctx->sess.offset.c,
50+
(const unsigned char (*)[16])ctx->l, ctx->sess.checksum.c);
51+
+ processed_bytes = num_blocks * 16;
52+
+ in += processed_bytes;
53+
+ out += processed_bytes;
54+
} else {
55+
/* Loop through all full blocks to be encrypted */
56+
for (i = ctx->sess.blocks_processed + 1; i <= all_num_blocks; i++) {
57+
@@ -434,7 +437,7 @@ int CRYPTO_ocb128_decrypt(OCB128_CONTEXT *ctx,
58+
59+
if (num_blocks && all_num_blocks == (size_t)all_num_blocks
60+
&& ctx->stream != NULL) {
61+
- size_t max_idx = 0, top = (size_t)all_num_blocks;
62+
+ size_t max_idx = 0, top = (size_t)all_num_blocks, processed_bytes = 0;
63+
64+
/*
65+
* See how many L_{i} entries we need to process data at hand
66+
@@ -448,6 +451,9 @@ int CRYPTO_ocb128_decrypt(OCB128_CONTEXT *ctx,
67+
ctx->stream(in, out, num_blocks, ctx->keydec,
68+
(size_t)ctx->sess.blocks_processed + 1, ctx->sess.offset.c,
69+
(const unsigned char (*)[16])ctx->l, ctx->sess.checksum.c);
70+
+ processed_bytes = num_blocks * 16;
71+
+ in += processed_bytes;
72+
+ out += processed_bytes;
73+
} else {
74+
OCB_BLOCK tmp;
75+
76+
--
77+
2.45.4
78+
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
From 73b2e98599a813f617b20d5860e2587b385b4aff 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] Ensure ASN1 types are checked before use.
5+
6+
Some of these were fixed by LibreSSL in commit https://github.com/openbsd/src/commit/aa1f637d454961d22117b4353f98253e984b3ba8
7+
this fix includes the other fixes in that commit, as well as fixes for others found by a scan
8+
for a similar unvalidated access paradigm in the tree.
9+
10+
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
11+
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
12+
Reviewed-by: Tomas Mraz <tomas@openssl.org>
13+
(Merged from https://github.com/openssl/openssl/pull/29582)
14+
15+
Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com>
16+
Upstream-reference: https://github.com/openssl/openssl/commit/572844beca95068394c916626a6d3a490f831a49.patch
17+
---
18+
CryptoPkg/Library/OpensslLib/openssl/apps/s_client.c | 3 ++-
19+
.../OpensslLib/openssl/crypto/pkcs12/p12_kiss.c | 10 ++++++++--
20+
.../Library/OpensslLib/openssl/crypto/pkcs7/pk7_doit.c | 2 ++
21+
3 files changed, 12 insertions(+), 3 deletions(-)
22+
23+
diff --git a/CryptoPkg/Library/OpensslLib/openssl/apps/s_client.c b/CryptoPkg/Library/OpensslLib/openssl/apps/s_client.c
24+
index 00effc80..6e8cc6e9 100644
25+
--- a/CryptoPkg/Library/OpensslLib/openssl/apps/s_client.c
26+
+++ b/CryptoPkg/Library/OpensslLib/openssl/apps/s_client.c
27+
@@ -2698,8 +2698,9 @@ int s_client_main(int argc, char **argv)
28+
goto end;
29+
}
30+
atyp = ASN1_generate_nconf(genstr, cnf);
31+
- if (atyp == NULL) {
32+
+ if (atyp == NULL || atyp->type != V_ASN1_SEQUENCE) {
33+
NCONF_free(cnf);
34+
+ ASN1_TYPE_free(atyp);
35+
BIO_printf(bio_err, "ASN1_generate_nconf failed\n");
36+
goto end;
37+
}
38+
diff --git a/CryptoPkg/Library/OpensslLib/openssl/crypto/pkcs12/p12_kiss.c b/CryptoPkg/Library/OpensslLib/openssl/crypto/pkcs12/p12_kiss.c
39+
index 7ab98385..d90404dd 100644
40+
--- a/CryptoPkg/Library/OpensslLib/openssl/crypto/pkcs12/p12_kiss.c
41+
+++ b/CryptoPkg/Library/OpensslLib/openssl/crypto/pkcs12/p12_kiss.c
42+
@@ -183,11 +183,17 @@ static int parse_bag(PKCS12_SAFEBAG *bag, const char *pass, int passlen,
43+
ASN1_BMPSTRING *fname = NULL;
44+
ASN1_OCTET_STRING *lkid = NULL;
45+
46+
- if ((attrib = PKCS12_SAFEBAG_get0_attr(bag, NID_friendlyName)))
47+
+ if ((attrib = PKCS12_SAFEBAG_get0_attr(bag, NID_friendlyName))) {
48+
+ if (attrib->type != V_ASN1_BMPSTRING)
49+
+ return 0;
50+
fname = attrib->value.bmpstring;
51+
+ }
52+
53+
- if ((attrib = PKCS12_SAFEBAG_get0_attr(bag, NID_localKeyID)))
54+
+ if ((attrib = PKCS12_SAFEBAG_get0_attr(bag, NID_localKeyID))) {
55+
+ if (attrib->type != V_ASN1_OCTET_STRING)
56+
+ return 0;
57+
lkid = attrib->value.octet_string;
58+
+ }
59+
60+
switch (PKCS12_SAFEBAG_get_nid(bag)) {
61+
case NID_keyBag:
62+
diff --git a/CryptoPkg/Library/OpensslLib/openssl/crypto/pkcs7/pk7_doit.c b/CryptoPkg/Library/OpensslLib/openssl/crypto/pkcs7/pk7_doit.c
63+
index f63fbc50..4e0eb1e8 100644
64+
--- a/CryptoPkg/Library/OpensslLib/openssl/crypto/pkcs7/pk7_doit.c
65+
+++ b/CryptoPkg/Library/OpensslLib/openssl/crypto/pkcs7/pk7_doit.c
66+
@@ -1092,6 +1092,8 @@ ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk)
67+
ASN1_TYPE *astype;
68+
if ((astype = get_attribute(sk, NID_pkcs9_messageDigest)) == NULL)
69+
return NULL;
70+
+ if (astype->type != V_ASN1_OCTET_STRING)
71+
+ return NULL;
72+
return astype->value.octet_string;
73+
}
74+
75+
--
76+
2.45.4
77+

SPECS/hvloader/hvloader.spec

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Summary: HvLoader.efi is an EFI application for loading an external hypervisor loader.
55
Name: hvloader
66
Version: 1.0.1
7-
Release: 16%{?dist}
7+
Release: 17%{?dist}
88
License: MIT
99
Vendor: Microsoft Corporation
1010
Distribution: Mariner
@@ -37,6 +37,9 @@ Patch19: CVE-2024-38796.patch
3737
Patch20: CVE-2025-3770.patch
3838
Patch21: CVE-2025-2296.patch
3939
Patch22: CVE-2025-2295.patch
40+
Patch23: CVE-2025-68160.patch
41+
Patch24: CVE-2025-69418.patch
42+
Patch25: CVE-2026-22796.patch
4043

4144
BuildRequires: bc
4245
BuildRequires: gcc
@@ -82,6 +85,9 @@ cp ./Build/MdeModule/RELEASE_GCC5/X64/MdeModulePkg/Application/%{name_github}-%{
8285
/boot/efi/HvLoader.efi
8386

8487
%changelog
88+
* Mon Feb 02 2026 Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> - 1.0.1-17
89+
- Patch for CVE-2026-22796, CVE-2025-68160, CVE-2025-69418
90+
8591
* Tue Jan 06 2026 Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> - 1.0.1-16
8692
- Patch for CVE-2025-2295
8793

0 commit comments

Comments
 (0)