-
Notifications
You must be signed in to change notification settings - Fork 18k
crypto/x509: ParseCRL allows revocation serial number that is a non-positive integer #73433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
cc @FiloSottile @rolandshoemaker @cpu @golang/security |
Is this different from #73029? |
Hello, developer. I initiated this report because I am unsure whether the CRL Number and Revoked serial use the same parameter type. |
I think it's reasonable to tighten this up, but |
Without any deep attachment to a particular outcome, here's a WIP in case it helps discussion: https://go-review.googlesource.com/c/go/+/666695
I convinced myself a new GODEBUG is required here in order to properly reflect the version that the behavior changed, and to not muddy the waters with the metric associated for the |
This seems correct to me. |
This seems like a bad idea, as it would put CAs who misissue a certificate with a non-positive serial number between a rock and a hard place. If they revoke the certificate, their CRL won't be parseable by a major implementation by default. If they don't revoke the certificate, they would be violating the BRs and may also be putting RPs which accept certificates with non-positive serial numbers at risk (consider that the certificate may also have more serious problems, like improper DCV). Given that the prohibition against non-positive serial numbers is in Section 4, which describes certificates, and there is no corresponding prohibition in Section 5, which describes CRLs, it's not clear to me that it's even a violation of RFC 5280 for CAs to put non-positive serial numbers in a CRL's revokedCertificates sequence. (It's true that Section 5 refers to "the ASN.1 in Section 4.1" for the definition of Even if it were a violation of RFC 5280, I don't think the usual arguments in favor of strict parsing apply here. Non-positive serial numbers are still syntactically valid ASN.1 INTEGERs, so it's unlikely Go would interpret them differently from other implementations. Preventing badness from spreading in the ecosystem is better enforced during certificate parsing. Enforcing it in CRL parsing doesn't discourage CAs from issuing certificates with non-positive serial numbers; it just discourages CAs from revoking them. Are there arguments in favor of this that I'm overlooking? |
Hm, this is a good point that I didn't consider. We don't really support doing anything with CRLs currently (as in, using them for revocation checking in crypto/x509 itself) but plausibly other people could be implementing that themselves. We probably shouldn't be preventing malformed certificates from being included in CRLs. Similarly we probably shouldn't be preventing CRLs from being created with said serials. Really wish CRLs hadn't used serial as the identifier, but whatever. |
As mentioned I don't feel strongly here and did always intend to leave an escape hatch for including malformed serials in the CRL. However, I am swayed by the argument that making it opt-in could perversely incentivize a CA to not revoke a certificate it would have otherwise. Seems like the consensus is to close as WONTFIX? |
Go version
go version go1.24.2 linux/amd64
Output of
go env
in your module/workspace:What did you do?
Hello developer, Go successfully parsed a CRL file with revoked certificate serial numbers 0 and -36 without any errors. According to RFC5280, the certificate serial number must be a positive integer.
What did you see happen?
Go successfully parsed a CRL file with revoked certificate serial numbers 0 and -36 without any errors.
What did you expect to see?
Test Case:
go_certs.zip
The text was updated successfully, but these errors were encountered: