crypto/x509: CreateRevocationList over-enforces KeyUsage check #59669
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Attempt to use
x509.CreateRevocationList(...)
with an ITU X.509 compliant certificate lacking theKeyUsage
extension.What did you expect to see?
CRL creation succeed.
What did you see instead?
CRL creation failed due to this check:
go/src/crypto/x509/x509.go
Lines 2299 to 2301 in 0853f8c
Additional Information
While RFC 5280 is unclear about the behavior when the attribute is missing, it is clear that the extension MUST be added:
Per @maxb in Vault#20137, this line about requiring the KeyUsage extension was added in RFC 3280's rewrite of RFC 2459.
However, the broader ITU X.509 standard writes (on printed page 73/pdf page 83):
meaning the behavior without this extension is quite clear (outside of PKIX space).
Additionally, it is unclear why Go would enforce this on CRL creation time: it seems more usefully to be a client-side check for CRL validity, than a CA generation enforcement mechanism. NSS appears to handle this behavior correctly (thanks @stevendpclark for the reference), but we're having a hard time finding a reference for OpenSSL at the moment.
(There's probably an aside here about few people actually doing verification of CRLs -- most people presume they're transmitted over a pseudo-secure and/or simply fail to verify them altogether. And likely string together whatever pipeline they want to fetch it into their validating software (e.g., web server for mTLS cert auth)... But that's another discussion for another time...) :-)
Proposal
I'd propose eliding this check if the issuer certificates lacks KU altogether, but otherwise persist it. This mirrors the behavior of ITU X.509, minimally violates RFC 5280, and aligns with NSS's behavior.
This would be aligned with earlier precedence.
See also: #11087
See also: #49414
The text was updated successfully, but these errors were encountered: