-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Cryptography 35.0.0 fails to parse FreeIPA server CSR #6368
Comments
As discussed on IRC, I think it's correct that this is rejected, based on the rules of DER. It's unfortunate that OpenSSL ever allowed it. It'd be good to figure out what's generating these non-conforming values. And we should probably document this in the changelog. |
The problem is caused by an invalid template in certmonger. Certmonger uses NSS routines to generate a X509v3 extension blob, then pushes the blob into OpenSSL using OpenSSL happily accepts the DER. |
Certmonger issue: https://pagure.io/certmonger/issue/223 FreeIPA issue: https://pagure.io/freeipa/issue/9005 |
According to ITU X.690 standard 202102:
|
Alex found https://letsencrypt.org/docs/a-warm-welcome-to-asn1-and-der/#sequence-encoding
|
I did some testing with crypto libraries. asn1crypto refuses to load the broken CSR, too. pyasn1, https://lapo.it/asn1js/, NSS |
Certmonger used to generate FreeIPA server CSRs with invalid DER. The CSR encodes a critical=FALSE component in X509v3 extensions although FALSE is a default value. DER encoding requires that any component value equal to default is not included. See: pyca#6368 See: https://pagure.io/certmonger/issue/223 See: https://pagure.io/freeipa/issue/9005 Signed-off-by: Christian Heimes <christian@python.org>
Certmonger used to generate FreeIPA server CSRs with invalid DER. The CSR encodes a critical=FALSE component in X509v3 extensions although FALSE is a default value. DER encoding requires that any component value equal to default is not included. See: pyca#6368 See: https://pagure.io/certmonger/issue/223 See: https://pagure.io/freeipa/issue/9005 Signed-off-by: Christian Heimes <christian@python.org>
Certmonger used to generate FreeIPA server CSRs with invalid DER. The CSR encodes a critical=FALSE component in X509v3 extensions although FALSE is a default value. DER encoding requires that any component value equal to default is not included. See: pyca#6368 See: https://pagure.io/certmonger/issue/223 See: https://pagure.io/freeipa/issue/9005 Signed-off-by: Christian Heimes <christian@python.org>
Certmonger used to generate FreeIPA server CSRs with invalid DER. The CSR encodes a critical=FALSE component in X509v3 extensions although FALSE is a default value. DER encoding requires that any component value equal to default is not included. See: pyca#6368 See: https://pagure.io/certmonger/issue/223 See: https://pagure.io/freeipa/issue/9005 Signed-off-by: Christian Heimes <christian@python.org>
I've encountered this issue with several certificates as well. Here's an intermediate CA certificate where the
|
As discussed above, this cert is not actually valid within the definitions of the relevant standards. For us to fully understand the impact here, can you tell us what software was used to issue that cert? Is it still issuing invalid certs? |
Yeah, I agree the cert is not valid. I filed a bug with the issuer. Hopefully their report will provide some hints about how widespread the issue might be. For what it's worth, I checked ~2500 intermediate certs and only the three from SHECA were affected. |
Fantastic, thank you. I've also filed zmap/zlint#639 -- if we can get this added to zlint it should be very helpful in us understanding how prevalent this issue is in the WebPKI. |
A change in cryptography made it no longer able to parse certificates with an explicit "critical=False" (default value) DER field[1], that was done upstream to validate only 100% DER-compliant certificates, but there's no option to toggle this strict behavior, and in this AIA library the goal is to try to avoid being strict in the client side since the alternative would be worse Based on [2] and [3], it's clear that cryptography will no longer accept the "critical=False" field in extensions not even with a parameter to use a more "relaxed" parsing, unless it becomes a frequently recurring issue Therefore, this AIA library no longer requires cryptography, for now it's based on subprocess calls to OpenSSL and nothing else [1] pyca/cryptography#6368 [2] pyca/cryptography#6602 [3] alex/rust-asn1#203
Cryptograhy 35.0.0 fails to parse a CSR generated by FreIPA 4.9 / certmonger. The certificate contains three additional fields that are uncommon:
While writing the bug report, Alex pointed out that the issue is caused by the critical field. The critical field is encoded although the value is equal to the default value. In DER fields should not be encoded if the value matches the default value.
The text was updated successfully, but these errors were encountered: