Closed
Bug 1057123
Opened 11 years ago
Closed 11 years ago
mozilla::pkix: allow end-entity certificates to assert keyCertSign in some cases
Categories
(Core :: Security: PSM, defect)
Core
Security: PSM
Tracking
()
RESOLVED
FIXED
mozilla35
People
(Reporter: keeler, Assigned: keeler)
References
Details
Attachments
(2 files, 2 obsolete files)
|
76.03 KB,
patch
|
briansmith
:
review+
Sylvestre
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
|
75.76 KB,
patch
|
keeler
:
review+
Sylvestre
:
approval-mozilla-beta+
|
Details | Diff | Splinter Review |
Similarly to bug 1034124, when an end-entity certificate has a key usage extension that asserts keyCertSign, it is technically invalid. However, for compatibility reasons, this error should be overridable.
Do do this, we should add a new error (MOZILLA_PKIX_ERROR_END_ENTITY_ASSERTS_KEY_CERT_SIGN or something) and use it in the appropriate place in pkixcheck.cpp (see the patch in bug 1040446). Then, we should make that error overridable by modifying NSSErrorsService.cpp (see the patch in bug 1034124). To test, generate a certificate with this problem in generate_certs.sh and add a test to test_cert_overrides.js.
Comment 1•11 years ago
|
||
I suggest that we just replace the check that an end-entity certificate's KU doesn't contain keyCertSign with a comment saying that we allow end-entity certificates (certificates without basicConstraints.cA set to true) to claim keyCertSign for compatibility reasons, but it doesn't matter because we only trust certificates with basicConstraints.cA set to true as CAs.
| Assignee | ||
Comment 2•11 years ago
|
||
Ok - I turned the check into a comment.
(It looks like none of the key usage tests we had exercised this situation, so I added some tests. Unfortunately, because the generator scripts don't support an add-only mode (i.e. don't regenerate existing certificates), this patch is much larger than it needs to be.)
Comment 3•11 years ago
|
||
David, don't you need to update the gtest pkixcheck_CheckKeyUsage_tests.cpp too?
Flags: needinfo?(dkeeler)
| Assignee | ||
Updated•11 years ago
|
Attachment #8483111 -
Attachment is obsolete: true
Attachment #8483111 -
Flags: review?(brian)
| Assignee | ||
Comment 5•11 years ago
|
||
Attachment #8483143 -
Flags: review?(brian)
Comment 6•11 years ago
|
||
Comment on attachment 8483143 [details] [diff] [review]
patch v2
Review of attachment 8483143 [details] [diff] [review]:
-----------------------------------------------------------------
::: security/pkix/lib/pkixcheck.cpp
@@ +154,5 @@
> + // extension (Section 4.2.1.9) MUST also be asserted."
> + // However, we allow end-entity certificates (i.e. certificates without
> + // basicConstraints.cA set to TRUE) to claim keyCertSign for compatibility
> + // reasons. This does not compromise security because we only allow
> + // certificates with basicConstraints.cA set to TRUE to act as CAs.
I suggest that if requiredKeyUsageIfPresent == keyCertSign and endEntityOrCA == MustBeEndEntity, then we should fail with ERR_INADEQUATE_KEY_USAGE, i.e.:
// your comment
if (requiredKeyUsage == KeyUsage::keyCertSign &&
endEntityOrCA != EndEntityOrCA::MustBeCA) {
return Result::ERROR_INADEQUATE_KEY_USAGE;
}
::: security/pkix/test/gtest/pkixcheck_CheckKeyUsage_tests.cpp
@@ -199,5 @@
> -TEST_F(pkixcheck_CheckKeyUsage, keyCertSign)
> -{
> - NAMED_SIMPLE_KU(good, 2, 0x04);
> - ASSERT_BAD(CheckKeyUsage(EndEntityOrCA::MustBeEndEntity, &good,
> - KeyUsage::keyCertSign));
I think that this result should still be the same. The only thing that should be different is the result of CheckKeyUsage(EndEntityOrCA::MusteEndEntity, &good, Keyusage::someOtherKeyUsage) for an encoded key usage that includes someOtherKeyUsage AND keyCertSign.
Attachment #8483143 -
Flags: review?(brian) → review-
Comment 7•11 years ago
|
||
| Assignee | ||
Comment 8•11 years ago
|
||
I think what you outlined in comment 6 sounds like a good solution.
Attachment #8483143 -
Attachment is obsolete: true
Attachment #8483641 -
Flags: review?(brian)
Updated•11 years ago
|
Attachment #8483641 -
Flags: review?(brian) → review+
| Assignee | ||
Comment 9•11 years ago
|
||
Thanks for the review. Updating summary to more accurately describe the goal of this bug.
https://tbpl.mozilla.org/?tree=Try&rev=9166806dc1d3
Summary: allow overrides for when an end-entity certificate has a key usage extension that asserts keyCertSign → mozilla::pkix: allow end-entity certificates to assert keyCertSign in some cases
| Assignee | ||
Comment 10•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla35
| Assignee | ||
Comment 13•11 years ago
|
||
Approval Request Comment
[Feature/regressing bug #]: mozilla::pkix (enabled by default in 31, not disable-able in 33)
[User impact if declined]: users won't be able to access HP CommandView servers (see duplicate bugs)
[Describe test coverage new/current, TBPL]: has tests
[Risks and why]: low
[String/UUID change made/needed]: none
Attachment #8493895 -
Flags: review+
Attachment #8493895 -
Flags: approval-mozilla-beta?
| Assignee | ||
Comment 14•11 years ago
|
||
[Tracking Requested - why for this release]: mozilla::pkix compatibility bug (see comment 13)
status-firefox33:
--- → affected
status-firefox34:
--- → affected
status-firefox35:
--- → fixed
tracking-firefox33:
--- → ?
tracking-firefox34:
--- → ?
| Assignee | ||
Comment 15•11 years ago
|
||
Comment on attachment 8483641 [details] [diff] [review]
patch v3
Approval Request Comment
see comment 13
Attachment #8483641 -
Flags: approval-mozilla-aurora?
Updated•11 years ago
|
Updated•11 years ago
|
Attachment #8493895 -
Flags: approval-mozilla-beta? → approval-mozilla-beta+
Updated•11 years ago
|
Attachment #8483641 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Comment 16•11 years ago
|
||
You need to log in
before you can comment on or make changes to this bug.
Description
•