PKCS7 decoder context digest algorithms can go out-of-sync with digest array
Categories
(NSS :: Libraries, defect, P2)
Tracking
(nss 3.123, firefox-esr115 wontfix, firefox-esr140 wontfix, firefox149 wontfix, firefox150 wontfix, firefox151 fixed)
People
(Reporter: keeler, Assigned: djackson)
References
Details
(Keywords: sec-moderate, Whiteboard: [adv-main151+r])
Attachments
(1 external file, 1 obsolete file)
SEC_PKCS7SignedData has SECAlgorithmID **digestAlgorithms; and SECItem **digests;. The former is intended to describe each algorithm that created the latter. sec_pkcs7_decoder_start_digests has this code[0]:
/*
* Create a digest context for each algorithm.
*/
for (i = 0; i < digcnt; i++) {
SECAlgorithmID *algid = digestalgs[i];
SECOidTag oidTag = SECOID_FindOIDTag(&(algid->algorithm));
const SECHashObject *digobj = HASH_GetHashObjectByOidTag(oidTag);
void *digcx;
/*
* Skip any algorithm we do not even recognize; obviously,
* this could be a problem, but if it is critical then the
* result will just be that the signature does not verify.
* We do not necessarily want to error out here, because
* the particular algorithm may not actually be important,
* but we cannot know that until later.
*/
if (digobj == NULL) {
p7dcx->worker.digcnt--;
continue;
}
The wildly incorrect line p7dcx->worker.digcnt--; is being removed in bug 1964722, but even so, this can result in digests being shorter than (and in general not matching up with) digestAlgorithms, which can probably cause problems.
[0] https://searchfox.org/nss/rev/cd2ce1a24014a9afaff0df7b484f6065d845de7a/lib/pkcs7/p7decode.c#262-282
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Comment 1•1 year ago
|
||
I've made it an S2 conservatively.
| Reporter | ||
Comment 2•1 year ago
|
||
I believe the only way to reach this in Firefox is to manually import a client certificate.
| Reporter | ||
Updated•11 months ago
|
| Assignee | ||
Updated•7 months ago
|
| Assignee | ||
Comment 4•7 months ago
|
||
| Assignee | ||
Comment 5•7 months ago
|
||
Pushed by djackson@mozilla.com:
https://hg.mozilla.org/projects/nss/rev/f03be1025fb2
Align PKCS7 digest array with digestAlgorithms r=nss-reviewers,rrelyea
| Assignee | ||
Comment 8•7 months ago
|
||
Will land tests later on
Updated•7 months ago
|
Updated•7 months ago
|
Comment 9•7 months ago
|
||
Comment on attachment 9563863 [details]
(secure)
Revision D291857 was moved to bug 2032562. Setting attachment 9563863 [details] to obsolete.
Comment 10•7 months ago
|
||
Tests will land in Bug 2032562.
Updated•7 months ago
|
Updated•7 months ago
|
Updated•6 months ago
|
Updated•2 months ago
|
Description
•