@@ -16907,25 +16907,11 @@ run_ccs_injection(){
1690716907 return $ret
1690816908}
1690916909
16910- sub_session_ticket_tls() {
16911- local tls_proto="$1"
16912- local sessticket_tls=""
16913- #FIXME: we likely have done this already before (either @ run_server_defaults() or at least the output
16914- # from a previous handshake) --> would save 1x connect. We have TLS_TICKET but not yet the ticket itself #FIXME
16915- #ATTENTION: we DO NOT use SNI here as we assume ticketbleed is a vulnerability of the TLS stack. If we'd do SNI here, we'd also need
16916- # it in the ClientHello of run_ticketbleed() otherwise the ticket will be different and the whole thing won't work!
16917- #
16918- sessticket_tls="$($OPENSSL s_client $(s_client_options "$BUGS $tls_proto $PROXY $SNI -connect $NODEIP:$PORT") </dev/null 2>$ERRFILE | awk '/TLS session ticket:/,/^$/' | awk '!/TLS session ticket/')"
16919- sessticket_tls="$(sed -e 's/^.* - /x/g' -e 's/ .*$//g' <<< "$sessticket_tls" | tr '\n' ',')"
16920- sed -e 's/ /,x/g' -e 's/-/,x/g' <<< "$sessticket_tls"
16921-
16922- }
16923-
1692416910
1692516911# see https://blog.filippo.io/finding-ticketbleed/ | https://filippo.io/ticketbleed/
1692616912run_ticketbleed() {
1692716913 local tls_hexcode tls_proto=""
16928- local session_tckt_tls=""
16914+ local sessticket_tls="" session_tckt_tls=""
1692916915 local -i len_ch=300 # fixed len of prepared clienthello below
1693016916 local sid="x00,x0B,xAD,xC0,xDE,x00," # some arbitrary bytes
1693116917 local len_sid="$(( ${#sid} / 4))"
@@ -16961,27 +16947,52 @@ run_ticketbleed() {
1696116947 return 0
1696216948 fi
1696316949
16964- if [[ 0 -eq $(has_server_protocol tls1 ) ]]; then
16965- tls_hexcode="x03, x01 "; tls_proto="-tls1 "
16950+ if [[ 0 -eq $(has_server_protocol tls1_2 ) ]]; then
16951+ tls_hexcode="x03, x03 "; tls_proto="-tls1_2 "
1696616952 elif [[ 0 -eq $(has_server_protocol tls1_1) ]]; then
1696716953 tls_hexcode="x03, x02"; tls_proto="-tls1_1"
16968- elif [[ 0 -eq $(has_server_protocol tls1_2 ) ]]; then
16969- tls_hexcode="x03, x03 "; tls_proto="-tls1_2 "
16954+ elif [[ 0 -eq $(has_server_protocol tls1 ) ]]; then
16955+ tls_hexcode="x03, x01 "; tls_proto="-tls1 "
1697016956 elif [[ 0 -eq $(has_server_protocol ssl3) ]]; then
1697116957 tls_hexcode="x03, x00"; tls_proto="-ssl3"
1697216958 else # no protocol for some reason defined, determine TLS versions offered with a new handshake
1697316959 "$HAS_TLS13" && tls_proto="-no_tls1_3"
1697416960 $OPENSSL s_client $(s_client_options "$STARTTLS $BUGS $tls_proto -connect $NODEIP:$PORT $PROXY") >$TMPFILE 2>$ERRFILE </dev/null
16961+ sclient_connect_successful $? "$TMPFILE"
16962+ if [$? -ne 0 ]]; then
16963+ prln_warning "Cannot test for ticketbleed. Your OpenSSL cannot connect to $NODEIP:$PORT"
16964+ fileout "$jsonID" "WARN" "Cannot test for ticketbleed. Your OpenSSL cannot connect to $NODEIP:$PORT."
16965+ return 1
16966+ fi
1697516967 case "$(get_protocol $TMPFILE)" in
1697616968 *1.2) tls_hexcode="x03, x03"; tls_proto="-tls1_2" ; add_proto_offered tls1_2 yes ;;
1697716969 *1.1) tls_hexcode="x03, x02"; tls_proto="-tls1_1" ; add_proto_offered tls1_1 yes ;;
1697816970 TLSv1) tls_hexcode="x03, x01"; tls_proto="-tls1" ; add_proto_offered tls1 yes ;;
1697916971 SSLv3) tls_hexcode="x03, x00"; tls_proto="-ssl3" ; add_proto_offered ssl3 yes ;;
1698016972 esac
1698116973 fi
16974+ if ! sclient_supported "$tls_proto"; then
16975+ prln_local_problem "Cannot test for ticketbleed. $OPENSSL doesn't support \"s_client $tls_proto\"."
16976+ fileout "$jsonID" "WARN" "Cannot test for ticketbleed. $OPENSSL doesn't support \"s_client $tls_proto\"."
16977+ return 1
16978+ fi
1698216979 debugme echo "using protocol $tls_hexcode"
1698316980
16984- session_tckt_tls="$(sub_session_ticket_tls "$tls_proto")"
16981+ #FIXME: we likely have done this already before (either @ run_server_defaults() or at least the output
16982+ # from a previous handshake) --> would save 1x connect. We have TLS_TICKET but not yet the ticket itself #FIXME
16983+ #ATTENTION: we DO NOT use SNI here as we assume ticketbleed is a vulnerability of the TLS stack. If we'd do SNI here, we'd also need
16984+ # it in the ClientHello of run_ticketbleed() otherwise the ticket will be different and the whole thing won't work!
16985+ #
16986+ $OPENSSL s_client $(s_client_options "$BUGS $tls_proto $PROXY $SNI -connect $NODEIP:$PORT") </dev/null >$TMPFILE 2>$ERRFILE
16987+ sclient_connect_successful $? "$TMPFILE"
16988+ if [[ $? -ne 0 ]]; then
16989+ prln_warning "$OPENSSL unable to connect to $NODEIP:$PORT when testing for ticketbleed."
16990+ fileout "$jsonID" "WARN" "$OPENSSL unable to connect to $NODEIP:$PORT when testing for ticketbleed."
16991+ return 1
16992+ fi
16993+ sessticket_tls="$(awk '/TLS session ticket:/,/^$/' "$TMPFILE" | awk '!/TLS session ticket/')"
16994+ sessticket_tls="$(sed -e 's/^.* - /x/g' -e 's/ .*$//g' <<< "$sessticket_tls" | tr '\n' ',')"
16995+ session_tckt_tls="$(sed -e 's/ /,x/g' -e 's/-/,x/g' <<< "$sessticket_tls")"
1698516996 if [[ "$session_tckt_tls" == "," ]]; then
1698616997 pr_svrty_best "not vulnerable (OK)"
1698716998 outln ", no session tickets"
0 commit comments