Skip to content

Commit b9271ba

Browse files
authored
Fix infinite loop in run_pfs()
This commit fixes an infinite loop in run_pfs() that occurs in cases in which $OPENSSL supports TLS 1.3 and the server supports all of the non-TLS 1.3 FS ciphers that $OPENSSL supports but not all of the TLS 1.3 ciphers that $OPENSSL supports. The problem is that testing for supported ciphers using $OPENSSL, testing should stop if there are no more ciphers to test (because all of the ciphers supported by $OPENSSL have been determined to be supported by the server). However, currently testing only stops if both the list of TLS 1.3 ciphers and non-TLS 1.3 ciphers is empty. In the problematic case, only the list of non-TLS 1.3 ciphers is empty. Instead of stopping, s_client_options() is called with a -cipher option with an empty list, and s_client_options() simply removes the -cipher option from the command, resulting in a call to $OPENSSL s_client with a full list of non-TLS 1.3 ciphers. Since this call succeeds, the loop continues. This commit fixes the problem by stopping TLS 1.3 ClientHello testing when the list of TLS 1.3 ciphers is empty and stopping non-TLS 1.3 ClientHello testing when the list of non-TLS 1.3 ciphers is empty.
1 parent abdd51d commit b9271ba

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

testssl.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9711,7 +9711,12 @@ run_pfs() {
97119711
fi
97129712
fi
97139713
done
9714-
[[ -z "$ciphers_to_test" ]] && [[ -z "$tls13_ciphers_to_test" ]] && break
9714+
if "$HAS_TLS13"; then
9715+
[[ "$proto" == -no_ssl2 ]] && [[ -z "$tls13_ciphers_to_test" ]] && break
9716+
[[ "$proto" == -no_tls1_3 ]] && [[ -z "$ciphers_to_test" ]] && break
9717+
else
9718+
[[ -z "$ciphers_to_test" ]] && break
9719+
fi
97159720
$OPENSSL s_client $(s_client_options "$proto -cipher "\'${ciphers_to_test:1}\'" -ciphersuites "\'${tls13_ciphers_to_test:1}\'" $STARTTLS $BUGS -connect $NODEIP:$PORT $PROXY $SNI") &>$TMPFILE </dev/null
97169721
sclient_connect_successful $? $TMPFILE || break
97179722
pfs_cipher=$(get_cipher $TMPFILE)

0 commit comments

Comments
 (0)