Skip to contentSkip to conversation

nss: patch CVE-2024-11704

PATCH New Peter Marko 1 participant 4 messages Nov 26

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/4 nss: patch CVE-2024-11704

From: Peter Marko <[email protected]>

Pick patch referencing [1].

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1899402

---
 .../nss/nss/CVE-2024-11704.patch              | 30 +++++++++++++++++++
 meta-oe/recipes-support/nss/nss_3.98.bb       |  1 +
 2 files changed, 31 insertions(+)
 create mode 100644 meta-oe/recipes-support/nss/nss/CVE-2024-11704.patch
meta-oe/recipes-support/nss/nss/CVE-2024-11704.patch new file +30 -0
new file mode 100644
index 0000000000..0f8c4dc447
@@ -0,0 +1,30 @@
+From 355276751baea8b557e1c850fd6eb044fa11f52a Mon Sep 17 00:00:00 2001
+From: Kai Engert <[email protected]>
+Date: Thu, 26 Sep 2024 21:22:17 +0200
+Subject: [PATCH] Bug 1899402 - Correctly destroy bulkkey in error scenario.
+ r=jschanck
+
+Differential Revision: https://phabricator.services.mozilla.com/D223837
+
+--HG--
+extra : rebase_source : d06a6bb8d51bb844c814c5ee682a1b24de3e2e69
+
+CVE: CVE-2024-11704
+Upstream-Status: Backport [https://github.com/mozilla/nss/commit/355276751baea8b557e1c850fd6eb044fa11f52a]
+Signed-off-by: Peter Marko <[email protected]>
+---
+ nss/lib/pkcs7/p7decode.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/nss/lib/pkcs7/p7decode.c b/nss/lib/pkcs7/p7decode.c
+index 7a01f3671..02be982f6 100644
+--- a/nss/lib/pkcs7/p7decode.c
++++ b/nss/lib/pkcs7/p7decode.c
+@@ -542,6 +542,7 @@ sec_pkcs7_decoder_start_decrypt(SEC_PKCS7DecoderContext *p7dcx, int depth,
+      * We are done with (this) bulkkey now.
+      */
+     PK11_FreeSymKey(bulkkey);
++    bulkkey = NULL;
+ 
+     if (decryptobj == NULL) {
+         p7dcx->error = PORT_GetError();
meta-oe/recipes-support/nss/nss_3.98.bb +1 -0
index 8cff9372f1..d180346b39 100644
@@ -37,6 +37,7 @@ SRC_URI = "http://ftp.mozilla.org/pub/security/nss/releases/${VERSION_DIR}/src/$
            file://CVE-2026-2781.patch \
            file://0008-Bug-2083709-Remove-eMudhra-emSign-Root-CA-C1-and-emS.patch \
            file://0009-Bug-2084101-Remove-eMudhra-emSign-Root-CA-G3-from-NS.patch \
+           file://CVE-2024-11704.patch \
            "
 SRC_URI[sha256sum] = "f549cc33d35c0601674bfacf7c6ad683c187595eb4125b423238d3e9aa4209ce"
 
#1 lore raw

PATCH v2 2/4 nss: patch CVE-2024-11705

From: Peter Marko <[email protected]>

Pick patch referencing [1].
It was modified because hunk 1 was only introduced in [2] not et available in version 3.98.

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1921768
[2] https://github.com/mozilla/nss/commit/9adf6e998915668f86d38436ed494ec7a468a9de

---
 .../nss/nss/CVE-2024-11705.patch              | 43 +++++++++++++++++++
 meta-oe/recipes-support/nss/nss_3.98.bb       |  1 +
 2 files changed, 44 insertions(+)
 create mode 100644 meta-oe/recipes-support/nss/nss/CVE-2024-11705.patch
meta-oe/recipes-support/nss/nss/CVE-2024-11705.patch new file +43 -0
new file mode 100644
index 0000000000..707f4b08dd
@@ -0,0 +1,43 @@
+From c59fad13330727ff65ce015055bc28cece4e38f7 Mon Sep 17 00:00:00 2001
+From: John Schanck <[email protected]>
+Date: Mon, 30 Sep 2024 17:01:39 +0000
+Subject: [PATCH] Bug 1921768 - allow null phKey in NSC_DeriveKey. r=rrelyea
+
+Differential Revision: https://phabricator.services.mozilla.com/D224134
+
+--HG--
+extra : moz-landing-system : lando
+
+CVE: CVE-2024-11705
+Upstream-Status: Backport [https://github.com/mozilla/nss/commit/c59fad13330727ff65ce015055bc28cece4e38f7]
+Signed-off-by: Peter Marko <[email protected]>
+---
+ nss/lib/softoken/pkcs11c.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/nss/lib/softoken/pkcs11c.c b/nss/lib/softoken/pkcs11c.c
+index f06c2b43c..76665e5a4 100644
+--- a/nss/lib/softoken/pkcs11c.c
++++ b/nss/lib/softoken/pkcs11c.c
+@@ -7273,8 +7273,9 @@ NSC_DeriveKey(CK_SESSION_HANDLE hSession,
+     /*
+      * now lets create an object to hang the attributes off of
+      */
+-    if (phKey)
++    if (phKey) {
+         *phKey = CK_INVALID_HANDLE;
++    }
+ 
+     key = sftk_NewObject(slot); /* fill in the handle later */
+     if (key == NULL) {
+@@ -8820,7 +8821,9 @@ NSC_DeriveKey(CK_SESSION_HANDLE hSession,
+         crv = sftk_handleObject(key, session);
+         session->lastOpWasFIPS = key->isFIPS;
+         sftk_FreeSession(session);
+-        *phKey = key->handle;
++        if (phKey) {
++            *phKey = key->handle;
++        }
+         sftk_FreeObject(key);
+     }
+     return crv;
meta-oe/recipes-support/nss/nss_3.98.bb +1 -0
index d180346b39..8be7072ee5 100644
@@ -38,6 +38,7 @@ SRC_URI = "http://ftp.mozilla.org/pub/security/nss/releases/${VERSION_DIR}/src/$
            file://0008-Bug-2083709-Remove-eMudhra-emSign-Root-CA-C1-and-emS.patch \
            file://0009-Bug-2084101-Remove-eMudhra-emSign-Root-CA-G3-from-NS.patch \
            file://CVE-2024-11704.patch \
+           file://CVE-2024-11705.patch \
            "
 SRC_URI[sha256sum] = "f549cc33d35c0601674bfacf7c6ad683c187595eb4125b423238d3e9aa4209ce"
 
#2 lore raw

PATCH v2 3/4 nss: patch CVE-2024-11706

In reply to Peter Marko

From: Peter Marko <[email protected]>

Pick patch referencing [1].

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1923767

---
 .../nss/nss/CVE-2024-11706.patch              | 35 +++++++++++++++++++
 meta-oe/recipes-support/nss/nss_3.98.bb       |  1 +
 2 files changed, 36 insertions(+)
 create mode 100644 meta-oe/recipes-support/nss/nss/CVE-2024-11706.patch
meta-oe/recipes-support/nss/nss/CVE-2024-11706.patch new file +35 -0
new file mode 100644
index 0000000000..6ec92052ad
@@ -0,0 +1,35 @@
+From aa9e1c7cd91cc1d4c205bc73bfc40855ec0af2f9 Mon Sep 17 00:00:00 2001
+From: John Schanck <[email protected]>
+Date: Mon, 21 Oct 2024 21:22:36 +0000
+Subject: [PATCH] Bug 1923767 - pk12util: improve error handling in
+ p12U_ReadPKCS12File. r=nss-reviewers,nkulatova
+
+Differential Revision: https://phabricator.services.mozilla.com/D225165
+
+--HG--
+extra : moz-landing-system : lando
+
+CVE: CVE-2024-11706
+Upstream-Status: Backport [https://github.com/mozilla/nss/commit/aa9e1c7cd91cc1d4c205bc73bfc40855ec0af2f9]
+Signed-off-by: Peter Marko <[email protected]>
+---
+ nss/cmd/pk12util/pk12util.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/nss/cmd/pk12util/pk12util.c b/nss/cmd/pk12util/pk12util.c
+index f84002ca0..2baab969f 100644
+--- a/nss/cmd/pk12util/pk12util.c
++++ b/nss/cmd/pk12util/pk12util.c
+@@ -449,10 +449,10 @@ p12U_ReadPKCS12File(SECItem *uniPwp, char *in_file, PK11SlotInfo *slot,
+ 
+     /* revert the option setting */
+     if (forceUnicode != pk12uForceUnicode) {
+-        rv = NSS_OptionSet(__NSS_PKCS12_DECODE_FORCE_UNICODE, pk12uForceUnicode);
+-        if (rv != SECSuccess) {
++        if (SECSuccess != NSS_OptionSet(__NSS_PKCS12_DECODE_FORCE_UNICODE, pk12uForceUnicode)) {
+             SECU_PrintError(progName, "PKCS12 decoding failed to set option");
+             pk12uErrno = PK12UERR_DECODEVERIFY;
++            rv = SECFailure;
+         }
+     }
+     /* rv has been set at this point */
meta-oe/recipes-support/nss/nss_3.98.bb +1 -0
index 8be7072ee5..9bebd1c6c4 100644
@@ -39,6 +39,7 @@ SRC_URI = "http://ftp.mozilla.org/pub/security/nss/releases/${VERSION_DIR}/src/$
            file://0009-Bug-2084101-Remove-eMudhra-emSign-Root-CA-G3-from-NS.patch \
            file://CVE-2024-11704.patch \
            file://CVE-2024-11705.patch \
+           file://CVE-2024-11706.patch \
            "
 SRC_URI[sha256sum] = "f549cc33d35c0601674bfacf7c6ad683c187595eb4125b423238d3e9aa4209ce"
 
#3 lore raw

PATCH v2 4/4 nss: patch CVE-2024-7531

In reply to Peter Marko

From: Peter Marko <[email protected]>

Pick patch referencing [1].

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1905691

---
 .../nss/nss/CVE-2024-7531.patch               | 69 +++++++++++++++++++
 meta-oe/recipes-support/nss/nss_3.98.bb       |  1 +
 2 files changed, 70 insertions(+)
 create mode 100644 meta-oe/recipes-support/nss/nss/CVE-2024-7531.patch
meta-oe/recipes-support/nss/nss/CVE-2024-7531.patch new file +69 -0
new file mode 100644
index 0000000000..38135295a8
@@ -0,0 +1,69 @@
+From e9e4ca24ff6f8b118853db8fc1f9dd4d7653e229 Mon Sep 17 00:00:00 2001
+From: Anna Weine <[email protected]>
+Date: Wed, 17 Jul 2024 16:16:57 +0000
+Subject: [PATCH] Bug 1905691 - ChaChaXor to return after the function
+ r=nss-reviewers,jschanck
+
+Differential Revision: https://phabricator.services.mozilla.com/D215892
+
+--HG--
+extra : moz-landing-system : lando
+
+CVE: CVE-2024-7531
+Upstream-Status: Backport [https://github.com/mozilla/nss/commit/e9e4ca24ff6f8b118853db8fc1f9dd4d7653e229]
+Signed-off-by: Peter Marko <[email protected]>
+---
+ nss/lib/freebl/chacha20poly1305.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/nss/lib/freebl/chacha20poly1305.c b/nss/lib/freebl/chacha20poly1305.c
+index a83f76df0..47aa18ba8 100644
+--- a/nss/lib/freebl/chacha20poly1305.c
++++ b/nss/lib/freebl/chacha20poly1305.c
+@@ -210,12 +210,14 @@ ChaCha20Xor(uint8_t *output, uint8_t *block, uint32_t len, uint8_t *k,
+ #ifndef NSS_DISABLE_AVX2
+     if (avx2_support()) {
+         Hacl_Chacha20_Vec256_chacha20_encrypt_256(len, output, block, k, nonce, ctr);
++        return;
+     }
+ #endif
+ 
+ #ifndef NSS_DISABLE_SSE3
+     if (ssse3_support() && sse4_1_support() && avx_support()) {
+         Hacl_Chacha20_Vec128_chacha20_encrypt_128(len, output, block, k, nonce, ctr);
++        return;
+     }
+ #endif
+ 
+@@ -223,10 +225,12 @@ ChaCha20Xor(uint8_t *output, uint8_t *block, uint32_t len, uint8_t *k,
+     !defined(NSS_DISABLE_ALTIVEC) && !defined(NSS_DISABLE_CRYPTO_VSX)
+     if (ppc_crypto_support()) {
+         chacha20vsx(len, output, block, k, nonce, ctr);
+-    } else
++        return;
++    }
+ #endif
+     {
+         Hacl_Chacha20_chacha20_encrypt(len, output, block, k, nonce, ctr);
++        return;
+     }
+ }
+ #endif /* NSS_DISABLE_CHACHAPOLY */
+@@ -446,8 +450,6 @@ ChaCha20Poly1305_Encrypt(const ChaCha20Poly1305Context *ctx,
+         goto finish;
+     }
+ #endif
+-
+-    else
+ #elif defined(__powerpc64__) && defined(__LITTLE_ENDIAN__) && \
+     !defined(NSS_DISABLE_ALTIVEC) && !defined(NSS_DISABLE_CRYPTO_VSX)
+     if (ppc_crypto_support()) {
+@@ -455,7 +457,7 @@ ChaCha20Poly1305_Encrypt(const ChaCha20Poly1305Context *ctx,
+             (uint8_t *)ctx->key, (uint8_t *)nonce, adLen, (uint8_t *)ad, inputLen,
+             (uint8_t *)input, output, outTag);
+         goto finish;
+-    } else
++    }
+ #endif
+     {
+         Hacl_Chacha20Poly1305_32_aead_encrypt(
meta-oe/recipes-support/nss/nss_3.98.bb +1 -0
index 9bebd1c6c4..34a24bb74d 100644
@@ -40,6 +40,7 @@ SRC_URI = "http://ftp.mozilla.org/pub/security/nss/releases/${VERSION_DIR}/src/$
            file://CVE-2024-11704.patch \
            file://CVE-2024-11705.patch \
            file://CVE-2024-11706.patch \
+           file://CVE-2024-7531.patch \
            "
 SRC_URI[sha256sum] = "f549cc33d35c0601674bfacf7c6ad683c187595eb4125b423238d3e9aa4209ce"