summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVirendra Thakur <virendrak@kpit.com>2023-03-17 16:09:49 +0530
committerArmin Kuster <akuster808@gmail.com>2023-04-06 07:32:11 -0400
commit7b7913fd475b903dd859dc360573d0065c911449 (patch)
treeb86f83df1f2d2706199f0a50ca928c13d9b12818
parent4e0cb3b0409b78e6c427c8947efdf28e314b78b6 (diff)
downloadmeta-openembedded-7b7913fd475b903dd859dc360573d0065c911449.tar.gz
nss: Fix CVE CVE-2023-0767
Add CVE-2023-0767.patch to fix CVE-2023-0767 Signed-off-by: Virendra Thakur <virendrak@kpit.com> Signed-off-by: Bhabu Bindu <bindudaniel1996@gmail.com> Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--meta-oe/recipes-support/nss/nss/CVE-2023-0767.patch124
-rw-r--r--meta-oe/recipes-support/nss/nss_3.51.1.bb1
2 files changed, 125 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/nss/nss/CVE-2023-0767.patch b/meta-oe/recipes-support/nss/nss/CVE-2023-0767.patch
new file mode 100644
index 0000000000..ec3b4a092a
--- /dev/null
+++ b/meta-oe/recipes-support/nss/nss/CVE-2023-0767.patch
@@ -0,0 +1,124 @@
1
2# HG changeset patch
3# User John M. Schanck <jschanck@mozilla.com>
4# Date 1675974326 0
5# Node ID 62f6b3e9024dd72ba3af9ce23848d7573b934f18
6# Parent 52b4b7d3d3ebdb25fbf2cf1c101bfad3721680f4
7Bug 1804640 - improve handling of unknown PKCS#12 safe bag types. r=rrelyea
8
9Differential Revision: https://phabricator.services.mozilla.com/D167443
10
11CVE: CVE-2023-0767
12Upstream-Status: Backport [https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/nss/2:3.35-2ubuntu2.16/nss_3.35-2ubuntu2.16.debian.tar.xz]
13Signed-off-by: Virendra Thakur <virendra.thakur@kpit.com>
14
15diff --git a/nss/lib/pkcs12/p12d.c b/nss/lib/pkcs12/p12d.c
16--- a/nss/lib/pkcs12/p12d.c
17+++ b/nss/lib/pkcs12/p12d.c
18@@ -332,41 +332,48 @@ sec_pkcs12_decoder_safe_bag_update(void
19 unsigned long len, int depth,
20 SEC_ASN1EncodingPart data_kind)
21 {
22 sec_PKCS12SafeContentsContext *safeContentsCtx =
23 (sec_PKCS12SafeContentsContext *)arg;
24 SEC_PKCS12DecoderContext *p12dcx;
25 SECStatus rv;
26
27- /* make sure that we are not skipping the current safeBag,
28- * and that there are no errors. If so, just return rather
29- * than continuing to process.
30- */
31- if (!safeContentsCtx || !safeContentsCtx->p12dcx ||
32- safeContentsCtx->p12dcx->error || safeContentsCtx->skipCurrentSafeBag) {
33+ if (!safeContentsCtx || !safeContentsCtx->p12dcx || !safeContentsCtx->currentSafeBagA1Dcx) {
34 return;
35 }
36 p12dcx = safeContentsCtx->p12dcx;
37
38+ /* make sure that there are no errors and we are not skipping the current safeBag */
39+ if (p12dcx->error || safeContentsCtx->skipCurrentSafeBag) {
40+ goto loser;
41+ }
42+
43 rv = SEC_ASN1DecoderUpdate(safeContentsCtx->currentSafeBagA1Dcx, data, len);
44 if (rv != SECSuccess) {
45 p12dcx->errorValue = PORT_GetError();
46+ p12dcx->error = PR_TRUE;
47+ goto loser;
48+ }
49+
50+ /* The update may have set safeContentsCtx->skipCurrentSafeBag, and we
51+ * may not get another opportunity to clean up the decoder context.
52+ */
53+ if (safeContentsCtx->skipCurrentSafeBag) {
54 goto loser;
55 }
56
57 return;
58
59 loser:
60- /* set the error, and finish the decoder context. because there
61+ /* Finish the decoder context. Because there
62 * is not a way of returning an error message, it may be worth
63 * while to do a check higher up and finish any decoding contexts
64 * that are still open.
65 */
66- p12dcx->error = PR_TRUE;
67 SEC_ASN1DecoderFinish(safeContentsCtx->currentSafeBagA1Dcx);
68 safeContentsCtx->currentSafeBagA1Dcx = NULL;
69 return;
70 }
71
72 /* notify function for decoding safeBags. This function is
73 * used to filter safeBag types which are not supported,
74 * initiate the decoding of nested safe contents, and decode
75diff --git a/nss/lib/pkcs12/p12t.h b/nss/lib/pkcs12/p12t.h
76--- a/nss/lib/pkcs12/p12t.h
77+++ b/nss/lib/pkcs12/p12t.h
78@@ -68,16 +68,17 @@ struct sec_PKCS12SafeBagStr {
79 /* Dependent upon the type of bag being used. */
80 union {
81 SECKEYPrivateKeyInfo *pkcs8KeyBag;
82 SECKEYEncryptedPrivateKeyInfo *pkcs8ShroudedKeyBag;
83 sec_PKCS12CertBag *certBag;
84 sec_PKCS12CRLBag *crlBag;
85 sec_PKCS12SecretBag *secretBag;
86 sec_PKCS12SafeContents *safeContents;
87+ SECItem *unknownBag;
88 } safeBagContent;
89
90 sec_PKCS12Attribute **attribs;
91
92 /* used locally */
93 SECOidData *bagTypeTag;
94 PLArenaPool *arena;
95 unsigned int nAttribs;
96diff --git a/nss/lib/pkcs12/p12tmpl.c b/nss/lib/pkcs12/p12tmpl.c
97--- a/nss/lib/pkcs12/p12tmpl.c
98+++ b/nss/lib/pkcs12/p12tmpl.c
99@@ -25,22 +25,22 @@ sec_pkcs12_choose_safe_bag_type(void *sr
100 if (src_or_dest == NULL) {
101 return NULL;
102 }
103
104 safeBag = (sec_PKCS12SafeBag *)src_or_dest;
105
106 oiddata = SECOID_FindOID(&safeBag->safeBagType);
107 if (oiddata == NULL) {
108- return SEC_ASN1_GET(SEC_AnyTemplate);
109+ return SEC_ASN1_GET(SEC_PointerToAnyTemplate);
110 }
111
112 switch (oiddata->offset) {
113 default:
114- theTemplate = SEC_ASN1_GET(SEC_AnyTemplate);
115+ theTemplate = SEC_ASN1_GET(SEC_PointerToAnyTemplate);
116 break;
117 case SEC_OID_PKCS12_V1_KEY_BAG_ID:
118 theTemplate = SEC_ASN1_GET(SECKEY_PointerToPrivateKeyInfoTemplate);
119 break;
120 case SEC_OID_PKCS12_V1_CERT_BAG_ID:
121 theTemplate = sec_PKCS12PointerToCertBagTemplate;
122 break;
123 case SEC_OID_PKCS12_V1_CRL_BAG_ID:
124
diff --git a/meta-oe/recipes-support/nss/nss_3.51.1.bb b/meta-oe/recipes-support/nss/nss_3.51.1.bb
index 07adea1067..1de2a40094 100644
--- a/meta-oe/recipes-support/nss/nss_3.51.1.bb
+++ b/meta-oe/recipes-support/nss/nss_3.51.1.bb
@@ -42,6 +42,7 @@ SRC_URI = "http://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/${VERSIO
42 file://CVE-2020-25648.patch \ 42 file://CVE-2020-25648.patch \
43 file://CVE-2021-43527.patch \ 43 file://CVE-2021-43527.patch \
44 file://CVE-2022-22747.patch \ 44 file://CVE-2022-22747.patch \
45 file://CVE-2023-0767.patch \
45 " 46 "
46 47
47SRC_URI[md5sum] = "6acaf1ddff69306ae30a908881c6f233" 48SRC_URI[md5sum] = "6acaf1ddff69306ae30a908881c6f233"