-
Notifications
You must be signed in to change notification settings - Fork 18k
crypto/x509: Incorrect TBSCertificateList.Issuer field when using non-pkix.Name-encodable Issuer #53754
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 @golang/security |
Yup, because pkix.TBSCertificateList cannot be changed we'll need to transition to using an internal (private) type that just uses an Feel free to send a CL if you'd like, but since we are currently in the release freeze we won't be able to land it until the tree re-opens in August. |
Per discussion with Roland Shoemaker, this updates x509.CreateRevocationList to mirror the behavior of x509.CreateCertificate, creating an internal struct for the ASN.1 encoding of the CRL. This allows us to switch the Issuer field type to asn1.RawValue, bypassing the round-tripping issues of pkix.Name in most scenarios. Per linked ticket, this resolves issues where a non-Go created certificate can be used to create CRLs which aren't correctly attested to that certificate. In rare cases where the CRL issuer is validated against the certificate's issuer (such as the linked JDK example), this can result in failing to check this CRL for the candidate certificate. Resolves: golang#53754 Signed-off-by: Alexander Scheel <[email protected]>
Per discussion with Roland Shoemaker, this updates x509.CreateRevocationList to mirror the behavior of x509.CreateCertificate, creating an internal struct for the ASN.1 encoding of the CRL. This allows us to switch the Issuer field type to asn1.RawValue, bypassing the round-tripping issues of pkix.Name in most scenarios. Per linked ticket, this resolves issues where a non-Go created certificate can be used to create CRLs which aren't correctly attested to that certificate. In rare cases where the CRL issuer is validated against the certificate's issuer (such as the linked JDK example), this can result in failing to check this CRL for the candidate certificate. Resolves: golang#53754 Signed-off-by: Alexander Scheel <[email protected]>
Per discussion with Roland Shoemaker, this updates x509.CreateRevocationList to mirror the behavior of x509.CreateCertificate, creating an internal struct for the ASN.1 encoding of the CRL. This allows us to switch the Issuer field type to asn1.RawValue, bypassing the round-tripping issues of pkix.Name in most scenarios. Per linked ticket, this resolves issues where a non-Go created certificate can be used to create CRLs which aren't correctly attested to that certificate. In rare cases where the CRL issuer is validated against the certificate's issuer (such as the linked JDK example), this can result in failing to check this CRL for the candidate certificate. Fixes golang#53754 Signed-off-by: Alexander Scheel <[email protected]>
Per discussion with Roland Shoemaker, this updates x509.CreateRevocationList to mirror the behavior of x509.CreateCertificate, creating an internal struct for the ASN.1 encoding of the CRL. This allows us to switch the Issuer field type to asn1.RawValue, bypassing the round-tripping issues of pkix.Name in most scenarios. Per linked ticket, this resolves issues where a non-Go created certificate can be used to create CRLs which aren't correctly attested to that certificate. In rare cases where the CRL issuer is validated against the certificate's issuer (such as the linked JDK example), this can result in failing to check this CRL for the candidate certificate. Fixes golang#53754 Signed-off-by: Alexander Scheel <[email protected]>
Per discussion with Roland Shoemaker, this updates x509.CreateRevocationList to mirror the behavior of x509.CreateCertificate, creating an internal struct for the ASN.1 encoding of the CRL. This allows us to switch the Issuer field type to asn1.RawValue, bypassing the round-tripping issues of pkix.Name in most scenarios. Per linked ticket, this resolves issues where a non-Go created certificate can be used to create CRLs which aren't correctly attested to that certificate. In rare cases where the CRL issuer is validated against the certificate's issuer (such as the linked JDK example), this can result in failing to check this CRL for the candidate certificate. Fixes golang#53754
Change https://go.dev/cl/418834 mentions this issue: |
Hey @rolandshoemaker! Congrats on the 1.19 GA :-) Any chance I could get some eyes on the patch set? Thanks! |
@rolandshoemaker Bumping this, any chance you could look at the attached CL? |
Per discussion with Roland Shoemaker, this updates x509.CreateRevocationList to mirror the behavior of x509.CreateCertificate, creating an internal struct for the ASN.1 encoding of the CRL. This allows us to switch the Issuer field type to asn1.RawValue, bypassing the round-tripping issues of pkix.Name in most scenarios. Per linked ticket, this resolves issues where a non-Go created certificate can be used to create CRLs which aren't correctly attested to that certificate. In rare cases where the CRL issuer is validated against the certificate's issuer (such as the linked JDK example), this can result in failing to check this CRL for the candidate certificate. Addresses review feedback by Roland Shoemaker on 2022/11/01. Fixes golang#53754 Signed-off-by: Alexander Scheel <[email protected]>
Thank you for the reviews @rolandshoemaker and @bradfitz!! Glad this'll make 1.20 :-) |
Per discussion with Roland Shoemaker, this updates x509.CreateRevocationList to mirror the behavior of x509.CreateCertificate, creating an internal struct for the ASN.1 encoding of the CRL. This allows us to switch the Issuer field type to asn1.RawValue, bypassing the round-tripping issues of pkix.Name in most scenarios. Per linked ticket, this resolves issues where a non-Go created certificate can be used to create CRLs which aren't correctly attested to that certificate. In rare cases where the CRL issuer is validated against the certificate's issuer (such as the linked JDK example), this can result in failing to check this CRL for the candidate certificate. Fixes golang#53754 Change-Id: If0adc053c081d6fb0b1ce47324c877eb2429a51f GitHub-Last-Rev: 033115d GitHub-Pull-Request: golang#53985 Reviewed-on: https://go-review.googlesource.com/c/go/+/418834 Reviewed-by: Roland Shoemaker <[email protected]> Reviewed-by: Bryan Mills <[email protected]> Run-TryBot: Roland Shoemaker <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Auto-Submit: Roland Shoemaker <[email protected]>
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
)?Not relevant.
go env
OutputWhat did you do?
Go has historically had issues round-tripping certificates with its
pkix.Name
field. This has lead to the introduction ofRawSubject
/RawIssuer
onx509.Certificate
(see #40876 and others). This is correctly handled during signing, e.g., here.In #50674, better support was added to the CRL for the raw Issuer field, but both
x509.CreateRevocationList(...)
andx509.Certificate.CreateCRL(...)
still re-use the (incorrectly) parsedpkix.Name
over theRawSubject
form.See also related Hashicorp Vault issues:
For example:
https://go.dev/play/p/Ht0mgZcMn7w
and
https://go.dev/play/p/0nMCWyMrXs6
What did you expect to see?
Subject of the issuer should be correctly preserved in the CRL's Issuer field.
What did you see instead?
The Email address was incorrectly elided from the CRL's Issuer field and the types were converted from UTF8 to PrintableString in the second example.
I was originally thinking it would be sufficient to round-trip from
issuer.RawSubject
into apkix.RDNSequence
, but this doesn't solve the UTF8 issue:Notably, some implementations like OpenSSL will treat the two as unequal still due to different type encodings.
Additionally, other implementations like OpenJDK will fail to consider this CRL for checking revocation status. I believe .NET and Microsoft's AIA-based verification behaves similarly, but fails closed rather than open.
I think this means we'd have to rework away from using
pkix.TBSCertificateList
to another type similar totbsCertificate
in order to useasn1.RawValue
? Let me know if that's the right approach and I can file a PR for that.The text was updated successfully, but these errors were encountered: