Skip to content

crypto/x509: Verify returns incorrect chains for some situations #16800

Description

@ramoas
  1. What version of Go are you using?
    This was first observed with Go 1.5.3, and still exists as of Go 1.7. From cursory historical code inspection, this problem looks like it has existed well before Go 1.5.3.

  2. What operating system and processor architecture are you using?
    Linux AMD64

  3. What did you do?

    (A) Verifying TLS server cert from a trusted CA hierarchy: https://play.golang.org/p/6L_GA0ZkcD

    • This example simulates what happens when a Go TLS client talks to a TLS server that is sending the root cert as part of the server cert's chain. Even though sending the root is not a TLS best practice, such TLS servers are still quite common on the public Internet.

      (B) Verifying TLS server cert that is self-signed: https://play.golang.org/p/ycS8K__AwJ
    • This example simulates what is more likely to happen in an enterprise / private environment. Obviously, the Go TLS client must not be using InsecureSkipVerify. Either the TLS server's self-signed cert must be explicitly set as one of the roots in the options passed to x509.Verify or the system's roots must be modified to include the self-signed cert.
  4. What did you expect to see?

    (A) I expect to see only one verified chain: [Leaf] -> [Intermediate] -> [Root]

    (B) I expect to see only one verified chain: [Root]

  5. What did you see instead?

    (A) I see two verified chains:

    1. correct: [Leaf] -> [Intermediate] -> [Root]
    2. *not* correct: [Leaf] -> [Intermediate] -> [Root] -> [Root]


    (B) I see one verified chain that is not correct: [Root] -> [Root]

The cause for both (A) and (B) seems to stem from x509.buildChains.

(B) should be fully addressed by yesterday's fix (https://go-review.googlesource.com/#/c/27393/2/src/crypto/x509/verify.go) by @agl for Issue #16763.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions