Skip to content

Commit f9c0b4e

Browse files
azurelinux-securityBinduSri-6522866jslobodzian
authored
[AutoPR- Security] Patch edk2 for CVE-2026-22795, CVE-2025-69421, CVE-2025-69419, CVE-2025-69420 [HIGH] (#15763)
Co-authored-by: BinduSri-6522866 <v-badabala@microsoft.com> Co-authored-by: jslobodzian <joslobo@microsoft.com>
1 parent 5c8222b commit f9c0b4e

5 files changed

Lines changed: 207 additions & 1 deletion

File tree

SPECS/edk2/CVE-2025-69419.patch

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
From 56d62202357855589885daaa4deb5b97c635a250 Mon Sep 17 00:00:00 2001
2+
From: AllSpark <allspark@microsoft.com>
3+
Date: Mon, 9 Feb 2026 09:14:39 +0000
4+
Subject: [PATCH] Check return code of UTF8_putc in a_strex.c and p12_utl.c;
5+
handle failures gracefully (backport)
6+
7+
Signed-off-by: rpm-build <rpm-build>
8+
Upstream-reference: AI Backport of https://github.com/openssl/openssl/commit/41be0f216404f14457bbf3b9cc488dba60b49296.patch
9+
---
10+
CryptoPkg/Library/OpensslLib/openssl/crypto/asn1/a_strex.c | 6 ++++--
11+
.../Library/OpensslLib/openssl/crypto/pkcs12/p12_utl.c | 5 +++++
12+
2 files changed, 9 insertions(+), 2 deletions(-)
13+
14+
diff --git a/CryptoPkg/Library/OpensslLib/openssl/crypto/asn1/a_strex.c b/CryptoPkg/Library/OpensslLib/openssl/crypto/asn1/a_strex.c
15+
index 4879b33..b852e06 100644
16+
--- a/CryptoPkg/Library/OpensslLib/openssl/crypto/asn1/a_strex.c
17+
+++ b/CryptoPkg/Library/OpensslLib/openssl/crypto/asn1/a_strex.c
18+
@@ -203,8 +203,10 @@ static int do_buf(unsigned char *buf, int buflen,
19+
orflags = CHARTYPE_LAST_ESC_2253;
20+
if (type & BUF_TYPE_CONVUTF8) {
21+
unsigned char utfbuf[6];
22+
- int utflen;
23+
- utflen = UTF8_putc(utfbuf, sizeof(utfbuf), c);
24+
+ int utflen = UTF8_putc(utfbuf, sizeof(utfbuf), c);
25+
+
26+
+ if (utflen < 0)
27+
+ return -1; /* error happened with UTF8 */
28+
for (i = 0; i < utflen; i++) {
29+
/*
30+
* We don't need to worry about setting orflags correctly
31+
diff --git a/CryptoPkg/Library/OpensslLib/openssl/crypto/pkcs12/p12_utl.c b/CryptoPkg/Library/OpensslLib/openssl/crypto/pkcs12/p12_utl.c
32+
index 43b9e3a..4998fcc 100644
33+
--- a/CryptoPkg/Library/OpensslLib/openssl/crypto/pkcs12/p12_utl.c
34+
+++ b/CryptoPkg/Library/OpensslLib/openssl/crypto/pkcs12/p12_utl.c
35+
@@ -207,6 +207,11 @@ char *OPENSSL_uni2utf8(const unsigned char *uni, int unilen)
36+
/* re-run the loop emitting UTF-8 string */
37+
for (asclen = 0, i = 0; i < unilen; ) {
38+
j = bmp_to_utf8(asctmp+asclen, uni+i, unilen-i);
39+
+ /* when UTF8_putc fails */
40+
+ if (j < 0) {
41+
+ OPENSSL_free(asctmp);
42+
+ return NULL;
43+
+ }
44+
if (j == 4) i += 4;
45+
else i += 2;
46+
asclen += j;
47+
--
48+
2.45.4
49+

SPECS/edk2/CVE-2025-69420.patch

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
From 3268f491a18d4567460ebc7e284ce2da9778bf18 Mon Sep 17 00:00:00 2001
2+
From: AllSpark <allspark@microsoft.com>
3+
Date: Mon, 9 Feb 2026 09:13:29 +0000
4+
Subject: [PATCH] Verify ASN1 object's types before accessing sequence in
5+
ess_get_signing_cert/v2 to avoid invalid type access.
6+
7+
Signed-off-by: rpm-build <rpm-build>
8+
Upstream-reference: AI Backport of https://github.com/openssl/openssl/commit/ea8fc4c345fbd749048809c9f7c881ea656b0b94.patch
9+
---
10+
.../Library/OpensslLib/openssl/crypto/ts/ts_rsp_verify.c | 4 ++--
11+
1 file changed, 2 insertions(+), 2 deletions(-)
12+
13+
diff --git a/CryptoPkg/Library/OpensslLib/openssl/crypto/ts/ts_rsp_verify.c b/CryptoPkg/Library/OpensslLib/openssl/crypto/ts/ts_rsp_verify.c
14+
index c2e7abd..156958c 100644
15+
--- a/CryptoPkg/Library/OpensslLib/openssl/crypto/ts/ts_rsp_verify.c
16+
+++ b/CryptoPkg/Library/OpensslLib/openssl/crypto/ts/ts_rsp_verify.c
17+
@@ -262,7 +262,7 @@ static ESS_SIGNING_CERT *ess_get_signing_cert(PKCS7_SIGNER_INFO *si)
18+
ASN1_TYPE *attr;
19+
const unsigned char *p;
20+
attr = PKCS7_get_signed_attribute(si, NID_id_smime_aa_signingCertificate);
21+
- if (!attr)
22+
+ if (attr == NULL || attr->type != V_ASN1_SEQUENCE)
23+
return NULL;
24+
p = attr->value.sequence->data;
25+
return d2i_ESS_SIGNING_CERT(NULL, &p, attr->value.sequence->length);
26+
@@ -274,7 +274,7 @@ static ESS_SIGNING_CERT_V2 *ess_get_signing_cert_v2(PKCS7_SIGNER_INFO *si)
27+
const unsigned char *p;
28+
29+
attr = PKCS7_get_signed_attribute(si, NID_id_smime_aa_signingCertificateV2);
30+
- if (attr == NULL)
31+
+ if (attr == NULL || attr->type != V_ASN1_SEQUENCE)
32+
return NULL;
33+
p = attr->value.sequence->data;
34+
return d2i_ESS_SIGNING_CERT_V2(NULL, &p, attr->value.sequence->length);
35+
--
36+
2.45.4
37+

SPECS/edk2/CVE-2025-69421.patch

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
From 3a1e9f9341230d304e7ce341c651188bd6af93f8 Mon Sep 17 00:00:00 2001
2+
From: AllSpark <allspark@microsoft.com>
3+
Date: Mon, 9 Feb 2026 09:13:55 +0000
4+
Subject: [PATCH] PKCS12_item_decrypt_d2i_ex(): Check oct argument for NULL
5+
6+
Fixes CVE-2025-69421
7+
8+
(cherry picked from commit 2c13bf15286328641a805eb3b7c97e27d42881fb)
9+
10+
Backport: This tree lacks PKCS12_item_decrypt_d2i_ex and ERR_raise, so we add the NULL check in PKCS12_item_decrypt_d2i and report ERR_R_PASSED_NULL_PARAMETER via PKCS12err.
11+
Signed-off-by: rpm-build <rpm-build>
12+
Upstream-reference: AI Backport of https://github.com/openssl/openssl/commit/2c13bf15286328641a805eb3b7c97e27d42881fb.patch
13+
---
14+
.../Library/OpensslLib/openssl/crypto/pkcs12/p12_decr.c | 6 ++++++
15+
1 file changed, 6 insertions(+)
16+
17+
diff --git a/CryptoPkg/Library/OpensslLib/openssl/crypto/pkcs12/p12_decr.c b/CryptoPkg/Library/OpensslLib/openssl/crypto/pkcs12/p12_decr.c
18+
index 3c86058..bb9491c 100644
19+
--- a/CryptoPkg/Library/OpensslLib/openssl/crypto/pkcs12/p12_decr.c
20+
+++ b/CryptoPkg/Library/OpensslLib/openssl/crypto/pkcs12/p12_decr.c
21+
@@ -88,6 +88,12 @@ void *PKCS12_item_decrypt_d2i(const X509_ALGOR *algor, const ASN1_ITEM *it,
22+
void *ret;
23+
int outlen;
24+
25+
+
26+
+ if (oct == NULL) {
27+
+ PKCS12err(PKCS12_F_PKCS12_ITEM_DECRYPT_D2I, ERR_R_PASSED_NULL_PARAMETER);
28+
+ return NULL;
29+
+ }
30+
+
31+
if (!PKCS12_pbe_crypt(algor, pass, passlen, oct->data, oct->length,
32+
&out, &outlen, 0)) {
33+
PKCS12err(PKCS12_F_PKCS12_ITEM_DECRYPT_D2I,
34+
--
35+
2.45.4
36+

SPECS/edk2/CVE-2026-22795.patch

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
From 1bef0f0a772f6b8229d1bcc85187a076394aa468 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: rpm-build <rpm-build>
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 83b3fc9..99f7eb0 100644
25+
--- a/CryptoPkg/Library/OpensslLib/openssl/apps/s_client.c
26+
+++ b/CryptoPkg/Library/OpensslLib/openssl/apps/s_client.c
27+
@@ -2688,8 +2688,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 7ab9838..d90404d 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 f63fbc5..4e0eb1e 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/edk2/edk2.spec

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ ExclusiveArch: x86_64
4545

4646
Name: edk2
4747
Version: %{GITDATE}git%{GITCOMMIT}
48-
Release: 45%{?dist}
48+
Release: 46%{?dist}
4949
Summary: UEFI firmware for 64-bit virtual machines
5050
License: BSD-2-Clause-Patent and OpenSSL and MIT
5151
URL: http://www.tianocore.org
@@ -135,6 +135,10 @@ Patch1005: vendored-openssl-1.1.1-Only-free-the-read-buffers-if-we-re-not-using-
135135
Patch1006: CVE-2022-4304.patch
136136
Patch1007: CVE-2025-3770.patch
137137
Patch1008: CVE-2025-2295.patch
138+
Patch1009: CVE-2025-69419.patch
139+
Patch1010: CVE-2025-69420.patch
140+
Patch1011: CVE-2025-69421.patch
141+
Patch1012: CVE-2026-22795.patch
138142

139143
# python3-devel and libuuid-devel are required for building tools.
140144
# python3-devel is also needed for varstore template generation and
@@ -718,6 +722,9 @@ $tests_ok
718722

719723

720724
%changelog
725+
* Mon Feb 09 2026 Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> - 20230301gitf80f052277c8-46
726+
- Patch for CVE-2026-22795, CVE-2025-69421, CVE-2025-69419, CVE-2025-69420
727+
721728
* Tue Jan 06 2026 Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> - 20230301gitf80f052277c8-45
722729
- Patch for CVE-2025-2295
723730

0 commit comments

Comments
 (0)