diff --git a/testssl.sh b/testssl.sh index 3e81b63..4282ef1 100755 --- a/testssl.sh +++ b/testssl.sh @@ -65,7 +65,7 @@ readonly PS4='${LINENO}> ${FUNCNAME[0]:+${FUNCNAME[0]}(): }' # make sure that temporary files are cleaned up after use in ANY case trap "cleanup" QUIT EXIT -readonly VERSION="2.6rc2" +readonly VERSION="2.6rc3" readonly SWCONTACT="dirk aet testssl dot sh" echo $VERSION | egrep -q "dev|rc" && \ SWURL="https://testssl.sh/dev/" || @@ -149,6 +149,7 @@ OSSL_VER_MINOR=0 OSSL_VER_APPENDIX="none" HAS_DH_BITS=true HAS_SSL2=true #TODO: in the future we'll do the fastest possible test (openssl s_client -ssl2 is currently faster than sockets) +HAS_SSL3=true PORT=443 # unless otherwise auto-determined, see below NODE="" NODEIP="" @@ -166,6 +167,7 @@ IPS="" SERVICE="" # is the server running an HTTP server, SMTP, POP or IMAP? URI="" STARTTLS_PROTOCOL="" +ALLPROTOS="" OPTIMAL_PROTO="" # we need this for IIS6 (sigh) and OpenSSL 1.02, otherwise some handshakes # will fail, see https://github.com/PeterMosmans/openssl/issues/19#issuecomment-100897892 @@ -515,7 +517,7 @@ Referer: $referer Connection: close EOF -) &>$HEADERFILE & +) >$HEADERFILE 2>$ERRFILE & if wait_kill $! $HEADER_MAXSLEEP; then if ! egrep -iaq "XML|HTML|DOCTYPE|HTTP|Connection" $HEADERFILE; then pr_litemagenta " likely HTTP header requests failed (#lines: $(wc -l < $HEADERFILE | sed 's/ //g'))." @@ -1343,7 +1345,9 @@ run_protocols() { local supported_no_ciph1="supported but couldn't detect a cipher (may need debugging)" local supported_no_ciph2="supported but couldn't detect a cipher" - pr_blue "--> Testing protocols "; + outln; pr_blue "--> Testing protocols "; + + #FIXME: use ALLPROTOS here if $SSL_NATIVE; then using_sockets=false @@ -3127,7 +3131,7 @@ Referer: $referer Connection: close EOF -) &>$HEADERFILE_BREACH & +) >$HEADERFILE_BREACH 2>$ERRFILE & if wait_kill $! $HEADER_MAXSLEEP; then result=$(grep -a '^Content-Encoding' $HEADERFILE_BREACH | sed -e 's/^Content-Encoding//' -e 's/://' -e 's/ //g') result=$(echo $result | tr -cd '\40-\176') @@ -3184,7 +3188,7 @@ run_tls_fallback_scsv() { local -i ret=0 [ $VULN_COUNT -le $VULN_THRESHLD ] && outln && pr_blue "--> Testing for TLS_FALLBACK_SCSV Protection" && outln "\n" - pr_bold " TLS_FALLBACK_SCSV"; out " (RFC 7507) " + pr_bold " TLS_FALLBACK_SCSV"; out " (RFC 7507), experim. " # This isn't a vulnerability check per se, but checks for the existence of # the countermeasure to protect against protocol downgrade attacks. @@ -3194,30 +3198,40 @@ run_tls_fallback_scsv() { local_problem "$OPENSSL lacks TLS_FALLBACK_SCSV support" return 4 fi + #TODO: this need some tuning: a) if one protocol is supported only it has practcally no value (theoretical it's interesting though) + # b) for IIS6 + openssl 1.0.2 this won't work + # c) best to make sure that we hit a specific protocol, see https://alpacapowered.wordpress.com/2014/10/20/ssl-poodle-attack-what-is-this-scsv-thingy/ + # d) minor: we should do "-stae" here - # ...and do the test - $OPENSSL s_client $STARTTLS -connect $NODEIP:$PORT $PROXY $SNI -no_tls1_2 -fallback_scsv &>$TMPFILE /dev/null $TMPFILE Testing for FREAK attack" && outln "\n" - pr_bold " FREAK"; out " (CVE-2015-0204), experimental " + pr_bold " FREAK"; out " (CVE-2015-0204) " no_supported_ciphers=$(count_ciphers $(actually_supported_ciphers $exportrsa_cipher_list)) #echo "========= ${PIPESTATUS[*]} @@ -3290,7 +3304,15 @@ run_logjam() { $OPENSSL s_client $STARTTLS -cipher $exportdhe_cipher_list -connect $NODEIP:$PORT $PROXY $SNI &>$TMPFILE &1 | grep -aq "unknown option" || \ HAS_SSL2=true && \ HAS_SSL2=false + $OPENSSL s_client -ssl3 2>&1 | grep -aq "unknown option" || \ + HAS_SSL3=true && \ + HAS_SSL3=false return 0 } @@ -4185,6 +4210,7 @@ determine_service() { close_socket datebanner "Testing" + outln if [[ -z "$1" ]]; then # for starttls we want another check # determine protocol which works (needed for IIS6). If we don't have IIS6, 1st try will succeed --> better because we use the variable @@ -4267,12 +4293,8 @@ display_rdns_etc() { datebanner() { local tojour="$(date +%F) $(date +%R)" - outln pr_reverse "$1 now ($tojour) ---> $NODEIP:$PORT ($NODE) <---"; outln "\n" - if [[ "$1" == "Testing" ]]; then - display_rdns_etc - fi - outln + [[ "$1" == "Testing" ]] && display_rdns_etc } # one line with $1 over whole screen width @@ -4713,6 +4735,7 @@ lets_roll() { ${do_allciphers} && { run_allciphers; ret=$(($? + ret)); } ${do_cipher_per_proto} && { run_cipher_per_proto; ret=$(($? + ret)); } + outln datebanner "Done" return $ret @@ -4794,4 +4817,4 @@ fi exit $ret -# $Id: testssl.sh,v 1.359 2015/08/26 18:06:52 dirkw Exp $ +# $Id: testssl.sh,v 1.360 2015/08/27 09:25:11 dirkw Exp $