From 2ae28d7f640ba67ab3ccaaa64260e8246d7f9e92 Mon Sep 17 00:00:00 2001 From: Riccardo Germenia Date: Fri, 17 Jan 2025 12:03:34 +0100 Subject: [PATCH 1/3] fix curves findings in TLS1.2 and prior versions --- testssl.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/testssl.sh b/testssl.sh index 59cfcfd..5e9efde 100755 --- a/testssl.sh +++ b/testssl.sh @@ -10852,6 +10852,14 @@ run_fs() { "${ossl_supported[i]}" && ! "${supported_curve[i]}" && curves_to_test+=":${curves_ossl[i]}" fi done + # Versions of TLS prior to 1.3 close the connection if the client does not support the curve + # used in the certificate. The easiest solution is to move the curves to the end of the list. + # instead of removing them from the ClientHello. + for (( i=low; i < high; i++ )); do + if ! "$HAS_TLS13" || ! "${curves_deprecated[i]}" || [[ "$proto" == "-no_tls1_3" ]]; then + "${supported_curve[i]}" && curves_to_test+=":${curves_ossl[i]}" + fi + done [[ -z "$curves_to_test" ]] && break $OPENSSL s_client $(s_client_options "$proto -cipher "\'${ecdhe_cipher_list:1}\'" -ciphersuites "\'${tls13_cipher_list:1}\'" -curves "${curves_to_test:1}" $STARTTLS $BUGS -connect $NODEIP:$PORT $PROXY $SNI") &>$TMPFILE Date: Mon, 20 Jan 2025 17:27:31 +0100 Subject: [PATCH 2/3] add fix to sockets and move test after original one --- testssl.sh | 81 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 73 insertions(+), 8 deletions(-) diff --git a/testssl.sh b/testssl.sh index 5e9efde..64a386f 100755 --- a/testssl.sh +++ b/testssl.sh @@ -10852,14 +10852,6 @@ run_fs() { "${ossl_supported[i]}" && ! "${supported_curve[i]}" && curves_to_test+=":${curves_ossl[i]}" fi done - # Versions of TLS prior to 1.3 close the connection if the client does not support the curve - # used in the certificate. The easiest solution is to move the curves to the end of the list. - # instead of removing them from the ClientHello. - for (( i=low; i < high; i++ )); do - if ! "$HAS_TLS13" || ! "${curves_deprecated[i]}" || [[ "$proto" == "-no_tls1_3" ]]; then - "${supported_curve[i]}" && curves_to_test+=":${curves_ossl[i]}" - fi - done [[ -z "$curves_to_test" ]] && break $OPENSSL s_client $(s_client_options "$proto -cipher "\'${ecdhe_cipher_list:1}\'" -ciphersuites "\'${tls13_cipher_list:1}\'" -curves "${curves_to_test:1}" $STARTTLS $BUGS -connect $NODEIP:$PORT $PROXY $SNI") &>$TMPFILE $TMPFILE Date: Thu, 20 Feb 2025 15:45:05 +0100 Subject: [PATCH 3/3] remove unnecessary "if" statements and remove break from "if" statements --- testssl.sh | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/testssl.sh b/testssl.sh index 64a386f..49c8d0e 100755 --- a/testssl.sh +++ b/testssl.sh @@ -10873,22 +10873,18 @@ run_fs() { [[ $i -eq $high ]] && break supported_curve[i]=true done - while true; do - # Versions of TLS prior to 1.3 close the connection if the client does not support the curve - # used in the certificate. The easiest solution is to move the curves to the end of the list. - # instead of removing them from the ClientHello. This is only needed if there is no RSA certificate. - if ((! "$HAS_TLS13" || [[ "$proto" == "-no_tls1_3" ]]) && [[ ! "$ecdhe_cipher_list" == *RSA* ]]) || break; then + # Versions of TLS prior to 1.3 close the connection if the client does not support the curve + # used in the certificate. The easiest solution is to move the curves to the end of the list. + # instead of removing them from the ClientHello. This is only needed if there is no RSA certificate. + if (! "$HAS_TLS13" || [[ "$proto" == "-no_tls1_3" ]]) && [[ ! "$ecdhe_cipher_list" == *RSA* ]]; then + while true; do curves_to_test="" for (( i=low; i < high; i++ )); do - if ! "${curves_deprecated[i]}"; then - "${ossl_supported[i]}" && ! "${supported_curve[i]}" && curves_to_test+=":${curves_ossl[i]}" - fi + "${ossl_supported[i]}" && ! "${supported_curve[i]}" && curves_to_test+=":${curves_ossl[i]}" done [[ -z "$curves_to_test" ]] && break for (( i=low; i < high; i++ )); do - if ! "${curves_deprecated[i]}"; then - "${supported_curve[i]}" && curves_to_test+=":${curves_ossl[i]}" - fi + "${supported_curve[i]}" && curves_to_test+=":${curves_ossl[i]}" done $OPENSSL s_client $(s_client_options "$proto -cipher "\'${ecdhe_cipher_list:1}\'" -ciphersuites "\'${tls13_cipher_list:1}\'" -curves "${curves_to_test:1}" $STARTTLS $BUGS -connect $NODEIP:$PORT $PROXY $SNI") &>$TMPFILE