diff options
| author | Vivek Kumbhar <vkumbhar@mvista.com> | 2024-05-24 13:22:33 +0530 |
|---|---|---|
| committer | Armin Kuster <akuster808@gmail.com> | 2024-05-26 15:22:08 -0400 |
| commit | 3a08bebf43f7284b76d99c5438319e7c03ebba35 (patch) | |
| tree | 2fefd5f95faea2ba7eb2eaf0265b9bc56c18991f /meta-oe | |
| parent | b93ba321e4d53c6924b1aed8aafb0c517792c723 (diff) | |
| download | meta-openembedded-3a08bebf43f7284b76d99c5438319e7c03ebba35.tar.gz | |
nss: Backport fix CVE-2023-0767
Upstream-Status: Backport from [https://hg.mozilla.org/projects/nss/rev/684586ec163ad4fbbf15ea2cd1ee5c2da43036ad]
Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Diffstat (limited to 'meta-oe')
| -rw-r--r-- | meta-oe/recipes-support/nss/nss/CVE-2023-0767.patch | 102 | ||||
| -rw-r--r-- | meta-oe/recipes-support/nss/nss_3.74.bb | 1 |
2 files changed, 103 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..0e0725b5f5 --- /dev/null +++ b/meta-oe/recipes-support/nss/nss/CVE-2023-0767.patch | |||
| @@ -0,0 +1,102 @@ | |||
| 1 | # HG changeset patch | ||
| 2 | # User John M. Schanck <jschanck@mozilla.com> | ||
| 3 | # Date 1675974326 0 | ||
| 4 | # Node ID 684586ec163ad4fbbf15ea2cd1ee5c2da43036ad | ||
| 5 | # Parent 58d7a8a55aea6a363bb8c7a9a7752739c4d32823 | ||
| 6 | Bug 1804640 - improve handling of unknown PKCS#12 safe bag types. r=rrelyea | ||
| 7 | |||
| 8 | Differential Revision: https://phabricator.services.mozilla.com/D167443 | ||
| 9 | |||
| 10 | Upstream-Status: Backport [https://hg.mozilla.org/projects/nss/rev/684586ec163ad4fbbf15ea2cd1ee5c2da43036ad] | ||
| 11 | CVE: CVE-2023-0767 | ||
| 12 | Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com> | ||
| 13 | --- | ||
| 14 | nss/lib/pkcs12/p12d.c | 23 +++++++++++++++-------- | ||
| 15 | nss/lib/pkcs12/p12t.h | 1 + | ||
| 16 | nss/lib/pkcs12/p12tmpl.c | 4 ++-- | ||
| 17 | 3 files changed, 18 insertions(+), 10 deletions(-) | ||
| 18 | |||
| 19 | diff --git a/nss/lib/pkcs12/p12d.c b/nss/lib/pkcs12/p12d.c | ||
| 20 | index 676f33b..decddc5 100644 | ||
| 21 | --- a/nss/lib/pkcs12/p12d.c | ||
| 22 | +++ b/nss/lib/pkcs12/p12d.c | ||
| 23 | @@ -337,31 +337,38 @@ sec_pkcs12_decoder_safe_bag_update(void *arg, const char *data, | ||
| 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 | diff --git a/nss/lib/pkcs12/p12t.h b/nss/lib/pkcs12/p12t.h | ||
| 71 | index b22f0dd..d449afd 100644 | ||
| 72 | --- a/nss/lib/pkcs12/p12t.h | ||
| 73 | +++ b/nss/lib/pkcs12/p12t.h | ||
| 74 | @@ -73,6 +73,7 @@ struct sec_PKCS12SafeBagStr { | ||
| 75 | sec_PKCS12CRLBag *crlBag; | ||
| 76 | sec_PKCS12SecretBag *secretBag; | ||
| 77 | sec_PKCS12SafeContents *safeContents; | ||
| 78 | + SECItem *unknownBag; | ||
| 79 | } safeBagContent; | ||
| 80 | |||
| 81 | sec_PKCS12Attribute **attribs; | ||
| 82 | diff --git a/nss/lib/pkcs12/p12tmpl.c b/nss/lib/pkcs12/p12tmpl.c | ||
| 83 | index 7437cbc..b08384f 100644 | ||
| 84 | --- a/nss/lib/pkcs12/p12tmpl.c | ||
| 85 | +++ b/nss/lib/pkcs12/p12tmpl.c | ||
| 86 | @@ -30,12 +30,12 @@ sec_pkcs12_choose_safe_bag_type(void *src_or_dest, PRBool encoding) | ||
| 87 | |||
| 88 | oiddata = SECOID_FindOID(&safeBag->safeBagType); | ||
| 89 | if (oiddata == NULL) { | ||
| 90 | - return SEC_ASN1_GET(SEC_AnyTemplate); | ||
| 91 | + return SEC_ASN1_GET(SEC_PointerToAnyTemplate); | ||
| 92 | } | ||
| 93 | |||
| 94 | switch (oiddata->offset) { | ||
| 95 | default: | ||
| 96 | - theTemplate = SEC_ASN1_GET(SEC_AnyTemplate); | ||
| 97 | + theTemplate = SEC_ASN1_GET(SEC_PointerToAnyTemplate); | ||
| 98 | break; | ||
| 99 | case SEC_OID_PKCS12_V1_KEY_BAG_ID: | ||
| 100 | theTemplate = SEC_ASN1_GET(SECKEY_PointerToPrivateKeyInfoTemplate); | ||
| 101 | -- | ||
| 102 | 2.34.1 | ||
diff --git a/meta-oe/recipes-support/nss/nss_3.74.bb b/meta-oe/recipes-support/nss/nss_3.74.bb index 26baf669d1..ce4137a67f 100644 --- a/meta-oe/recipes-support/nss/nss_3.74.bb +++ b/meta-oe/recipes-support/nss/nss_3.74.bb | |||
| @@ -34,6 +34,7 @@ SRC_URI = "http://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/${VERSIO | |||
| 34 | file://0001-freebl-add-a-configure-option-to-disable-ARM-HW-cryp.patch \ | 34 | file://0001-freebl-add-a-configure-option-to-disable-ARM-HW-cryp.patch \ |
| 35 | file://0001-Bug-1780432-CVE-2023-5388-Timing-attack-against-RSA-.patch;patchdir=nss \ | 35 | file://0001-Bug-1780432-CVE-2023-5388-Timing-attack-against-RSA-.patch;patchdir=nss \ |
| 36 | file://0001-Bug-1867408-add-a-defensive-check-for-large-ssl_DefS.patch;patchdir=nss \ | 36 | file://0001-Bug-1867408-add-a-defensive-check-for-large-ssl_DefS.patch;patchdir=nss \ |
| 37 | file://CVE-2023-0767.patch \ | ||
| 37 | " | 38 | " |
| 38 | SRC_URI[sha256sum] = "88928811f9f40f87d42e2eaccdf6e454562e51486067f2ddbe90aa47ea6cd056" | 39 | SRC_URI[sha256sum] = "88928811f9f40f87d42e2eaccdf6e454562e51486067f2ddbe90aa47ea6cd056" |
| 39 | 40 | ||
