When NSS enounters a cert (e.g. via a call to CERT_NewTempCertificate,
and perhaps via other calls as well) that has the same issuer name and
serial number as a cert already known to NSS (e.g. in a token or the cert DB),
NSS treats the new cert as a duplicate of the known cert, even if the two
certs are not identical. The two certs are assumed to be identical because
they contain the same issuer and serial number. No comparison is made to
ensure that they actually are fully identical.
NSS should compare the newly encountered cert with the previously known one.
If they are the same, then NSS should continue to treat the new cert as a
duplicate of the old one (because it is). If they are not the same, NSS
should fail to "import" the new cert (or whatever operation it is performing)
and should return an error code that signifies that the new cert has a
duplicated issuer name and serial number.
This change may need to be made in many places in NSS, such as when a cert
is added to the cert cache, or to the temporary store of certs, or to the
cert DB inside the soft token. I do not know all the places where this needs
to be done. Hopefully Bob and Ian can help enumerate them all.
In today's meeting, we agreed that this bug should be P1 for NSS 3.7.
The motivation for this bug is to reduce the amount of time spent diagnosing
errors caused by certs with duplicated issuer and serial numbers. Such
certs are not issued by competent CAs. But the complaints about problems
arising from such certs have recently become onerous.
Assigned the bug to Ian.
Created attachment 106971 [details] [diff] [review]
block import of different certs with same issuer/sn as existing certs
Both certutil and pk12util went through CERT_NewTempCertificate, and the error
was caught there. I changed a line in libpkcs12 to pick up the correct error
code. I imagine most cases will be handled this way, as the only other way to
create a cert from a DER is to use the deprecated __CERT_DecodeDERCertificate.
Just to be safe, I changed certutil to call DecodeDER and then PK11_Import, the
error was caught in that code path in the same way.
Thanks for the patch, Ian. One comment:
Let's not call this new error SEC_ERROR_CERT_ALREADY_EXISTS.
That's going to cause misunderstanding.
Let's call it SEC_ERROR_DUPLICATE_ISSUER_AND_SERIAL or
SEC_ERROR_REUSED_ISSUER_AND_SERIAL or something similar.
Created attachment 107023 [details] [diff] [review]
rename error code
I checked the second patch in to the tip.
Above, your wrote that you've checked the patch into the trunk.
Is this bug fixed now?
*** Bug 99422 has been marked as a duplicate of this bug. ***
Yes, it is.
Ok. Scenerio for you.
Our IMAP mailserver uses the same SSL Cert for both SMTP and IMAP (it's the same
box, same CN). Since 1.3a, we've been unable to use SMTP TLS if we've connected
to IMAP via TLS.
Did this patch potentially cause this issue?
*** Bug 39495 has been marked as a duplicate of this bug. ***