-
Notifications
You must be signed in to change notification settings - Fork 18k
crypto/x509: ParseCertificate allows unsorted SET
values in RDNs
#73743
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
Labels
BugReport
Issues describing a possible bug in the Go implementation.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Comments
Looking at the example you provided, i think that this is more related to Looking at the parsing code for RDNs, it does not check the ordering of the Lines 141 to 181 in 045b5c1
But is also seems like func TestTest(t *testing.T) {
const rdsSeq = "MBYxFDAIBgNVBAoMAUIwCAYDVQQKDAFB"
bytes, err := base64.RawStdEncoding.DecodeString(rdsSeq)
if err != nil {
t.Fatal(err)
}
var rdns RDNSequence
_, err = Unmarshal(bytes, &rdns)
if err != nil {
t.Fatal(err)
}
t.Log(rdns) // [[{2.5.4.10 B} {2.5.4.10 A}]]
} |
SET
valuesSET
values in RDNs
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
BugReport
Issues describing a possible bug in the Go implementation.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Go version
go version go1.24.3 linux/amd64
Output of
go env
in your module/workspace:What did you do?
Playground: https://go.dev/play/p/OoaeG_APMGI
What did you see happen?
Golang unmarshals incorrectly-sorted ASN.1 SET values. The example certificate has a multi-valued RDN that is incorrectly sorted. This is invalid DER and should not have been parsed.
What did you expect to see?
Golang should have errored when parsing the certificate.
See https://www.itu.int/rec/T-REC-X.690-202102-I/en, section 11.6:
The text was updated successfully, but these errors were encountered: