Skip to content
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

Improve version negotiation #368

Closed
wants to merge 6 commits into from
Closed

Improve version negotiation #368

wants to merge 6 commits into from

Conversation

ocheron
Copy link
Contributor

@ocheron ocheron commented Jun 29, 2019

While comparing to the RFC I see some items missing regarding extension "supported_versions" and how version is negotiated and verified.

Adds requirement from RFC 8446 section 4.2.1:

   If this extension is not present, servers which are compliant with
   this specification and which also support TLS 1.2 MUST negotiate
   TLS 1.2 or prior as specified in [RFC5246], even if
   ClientHello.legacy_version is 0x0304 or later.
Adds the MUST NOT requirement from RFC 8446 section 4.1.2:

   If a server established a TLS connection with a previous version of
   TLS and receives a TLS 1.3 ClientHello in a renegotiation, it MUST
   retain the previous protocol version.  In particular, it MUST NOT
   negotiate TLS 1.3.

and the following requirement from RFC 8446 section 4.1.3:

   A legacy TLS client performing renegotiation with TLS 1.2 or prior
   and which receives a TLS 1.3 ServerHello during renegotiation MUST
   abort the handshake with a "protocol_version" alert.  Note that
   renegotiation is not possible when TLS 1.3 has been negotiated.
Adds requirement from RFC 8446 section 4.2.1:

   If this extension is present in the ClientHello, servers MUST NOT
   use the ClientHello.legacy_version value for version negotiation
   and MUST use only the "supported_versions" extension to determine
   client preferences.
This is a protocol failure and not just a refusal.  From RFC 8446
section 4.1.2:

   Because TLS 1.3 forbids renegotiation, if a server has negotiated
   TLS 1.3 and receives a ClientHello at any other time, it MUST
   terminate the connection with an "unexpected_message" alert.
Makes compliant with RFC 8446 section 4.2.1:

   Implementations of this specification MUST send this extension in
   the ClientHello containing all versions of TLS which they are
   prepared to negotiate (for this specification, that means minimally
   0x0304, but if previous versions of TLS are allowed to be
   negotiated, they MUST be present as well).
@kazu-yamamoto kazu-yamamoto self-requested a review July 1, 2019 02:34
Copy link
Collaborator

@kazu-yamamoto kazu-yamamoto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

kazu-yamamoto added a commit to kazu-yamamoto/hs-tls that referenced this pull request Jul 1, 2019
@kazu-yamamoto
Copy link
Collaborator

Rebased and merged.

@ocheron ocheron deleted the version-nego branch July 2, 2019 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants