[openssl/openssl] 4ada43: Fix SSL_select_next_proto

Matt Caswell noreply at github.com
Thu Jun 27 09:42:54 UTC 2024


  Branch: refs/heads/openssl-3.1
  Home:   https://github.com/openssl/openssl
  Commit: 4ada436a1946cbb24db5ab4ca082b69c1bc10f37
      https://github.com/openssl/openssl/commit/4ada436a1946cbb24db5ab4ca082b69c1bc10f37
  Author: Matt Caswell <matt at openssl.org>
  Date:   2024-06-27 (Thu, 27 Jun 2024)

  Changed paths:
    M ssl/ssl_lib.c

  Log Message:
  -----------
  Fix SSL_select_next_proto

Ensure that the provided client list is non-NULL and starts with a valid
entry. When called from the ALPN callback the client list should already
have been validated by OpenSSL so this should not cause a problem. When
called from the NPN callback the client list is locally configured and
will not have already been validated. Therefore SSL_select_next_proto
should not assume that it is correctly formatted.

We implement stricter checking of the client protocol list. We also do the
same for the server list while we are about it.

CVE-2024-5535

Reviewed-by: Neil Horman <nhorman at openssl.org>
Reviewed-by: Tomas Mraz <tomas at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24718)


  Commit: 4279c89a726025c758db3dafb263b17e52211304
      https://github.com/openssl/openssl/commit/4279c89a726025c758db3dafb263b17e52211304
  Author: Matt Caswell <matt at openssl.org>
  Date:   2024-06-27 (Thu, 27 Jun 2024)

  Changed paths:
    M ssl/statem/extensions_clnt.c

  Log Message:
  -----------
  More correctly handle a selected_len of 0 when processing NPN

In the case where the NPN callback returns with SSL_TLEXT_ERR_OK, but
the selected_len is 0 we should fail. Previously this would fail with an
internal_error alert because calling OPENSSL_malloc(selected_len) will
return NULL when selected_len is 0. We make this error detection more
explicit and return a handshake failure alert.

Follow on from CVE-2024-5535

Reviewed-by: Neil Horman <nhorman at openssl.org>
Reviewed-by: Tomas Mraz <tomas at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24718)


  Commit: 889ed19ba25abebd2690997acd6d4791cbe5c493
      https://github.com/openssl/openssl/commit/889ed19ba25abebd2690997acd6d4791cbe5c493
  Author: Matt Caswell <matt at openssl.org>
  Date:   2024-06-27 (Thu, 27 Jun 2024)

  Changed paths:
    M doc/man3/SSL_CTX_set_alpn_select_cb.pod

  Log Message:
  -----------
  Clarify the SSL_select_next_proto() documentation

We clarify the input preconditions and the expected behaviour in the event
of no overlap.

Follow on from CVE-2024-5535

Reviewed-by: Neil Horman <nhorman at openssl.org>
Reviewed-by: Tomas Mraz <tomas at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24718)


  Commit: ad1318efa2cfdf43ed49d23c4a815f4754604b97
      https://github.com/openssl/openssl/commit/ad1318efa2cfdf43ed49d23c4a815f4754604b97
  Author: Matt Caswell <matt at openssl.org>
  Date:   2024-06-27 (Thu, 27 Jun 2024)

  Changed paths:
    M test/sslapitest.c

  Log Message:
  -----------
  Add a test for SSL_select_next_proto

Follow on from CVE-2024-5535

Reviewed-by: Neil Horman <nhorman at openssl.org>
Reviewed-by: Tomas Mraz <tomas at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24718)


  Commit: c54e56fc8ab19e9d07c284d6c7c6bf293f7520d2
      https://github.com/openssl/openssl/commit/c54e56fc8ab19e9d07c284d6c7c6bf293f7520d2
  Author: Matt Caswell <matt at openssl.org>
  Date:   2024-06-27 (Thu, 27 Jun 2024)

  Changed paths:
    M test/helpers/handshake.c
    M test/ssl-tests/08-npn.cnf
    M test/ssl-tests/08-npn.cnf.in
    M test/ssl-tests/09-alpn.cnf
    M test/ssl-tests/09-alpn.cnf.in

  Log Message:
  -----------
  Allow an empty NPN/ALPN protocol list in the tests

Allow ourselves to configure an empty NPN/ALPN protocol list and test what
happens if we do.

Follow on from CVE-2024-5535

Reviewed-by: Neil Horman <nhorman at openssl.org>
Reviewed-by: Tomas Mraz <tomas at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24718)


  Commit: 087501b4f572825e27ca8cc2c5874fcf6fd47cf7
      https://github.com/openssl/openssl/commit/087501b4f572825e27ca8cc2c5874fcf6fd47cf7
  Author: Matt Caswell <matt at openssl.org>
  Date:   2024-06-27 (Thu, 27 Jun 2024)

  Changed paths:
    M ssl/statem/extensions_srvr.c

  Log Message:
  -----------
  Correct return values for tls_construct_stoc_next_proto_neg

Return EXT_RETURN_NOT_SENT in the event that we don't send the extension,
rather than EXT_RETURN_SENT. This actually makes no difference at all to
the current control flow since this return value is ignored in this case
anyway. But lets make it correct anyway.

Follow on from CVE-2024-5535

Reviewed-by: Neil Horman <nhorman at openssl.org>
Reviewed-by: Tomas Mraz <tomas at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24718)


  Commit: 017e54183b95617825fb9316d618c154a34c634e
      https://github.com/openssl/openssl/commit/017e54183b95617825fb9316d618c154a34c634e
  Author: Matt Caswell <matt at openssl.org>
  Date:   2024-06-27 (Thu, 27 Jun 2024)

  Changed paths:
    M ssl/statem/extensions_clnt.c

  Log Message:
  -----------
  Add ALPN validation in the client

The ALPN protocol selected by the server must be one that we originally
advertised. We should verify that it is.

Follow on from CVE-2024-5535

Reviewed-by: Neil Horman <nhorman at openssl.org>
Reviewed-by: Tomas Mraz <tomas at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24718)


  Commit: 0453bf5a7ac60ab01c8bb713d8cc2a94324aa88c
      https://github.com/openssl/openssl/commit/0453bf5a7ac60ab01c8bb713d8cc2a94324aa88c
  Author: Matt Caswell <matt at openssl.org>
  Date:   2024-06-27 (Thu, 27 Jun 2024)

  Changed paths:
    M test/sslapitest.c

  Log Message:
  -----------
  Add explicit testing of ALN and NPN in sslapitest

We already had some tests elsewhere - but this extends that testing with
additional tests.

Follow on from CVE-2024-5535

Reviewed-by: Neil Horman <nhorman at openssl.org>
Reviewed-by: Tomas Mraz <tomas at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24718)


  Commit: a201030901de9f9a48b34c38f6922fb0b272f26f
      https://github.com/openssl/openssl/commit/a201030901de9f9a48b34c38f6922fb0b272f26f
  Author: Matt Caswell <matt at openssl.org>
  Date:   2024-06-27 (Thu, 27 Jun 2024)

  Changed paths:
    A test/recipes/70-test_npn.t
    M util/perl/TLSProxy/Message.pm
    A util/perl/TLSProxy/NextProto.pm
    M util/perl/TLSProxy/Proxy.pm

  Log Message:
  -----------
  Add a test for an empty NextProto message

It is valid according to the spec for a NextProto message to have no
protocols listed in it. The OpenSSL implementation however does not allow
us to create such a message. In order to check that we work as expected
when communicating with a client that does generate such messages we have
to use a TLSProxy test.

Follow on from CVE-2024-5535

Reviewed-by: Neil Horman <nhorman at openssl.org>
Reviewed-by: Tomas Mraz <tomas at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24718)


Compare: https://github.com/openssl/openssl/compare/93991bf3de49...a201030901de

To unsubscribe from these emails, change your notification settings at https://github.com/openssl/openssl/settings/notifications


More information about the openssl-commits mailing list