447
447
pid=$!
448
448
if wait_kill $pid $HEADER_MAXSLEEP ; then
449
449
if ! egrep -iaq " XML|HTML|DOCTYPE|HTTP|Connection" $HEADERFILE ; then
450
- pr_litemagenta " likely HTTP header requests failed (#lines: $( wc -l < $HEADERFILE ) )."
450
+ pr_litemagenta " likely HTTP header requests failed (#lines: $( wc -l < $HEADERFILE | sed ' s/ //g ' ) )."
451
451
outln " Rerun with DEBUG=1 and inspect \" http_header.txt\" \n"
452
452
debugme cat $HEADERFILE
453
453
ret=7
@@ -639,7 +639,7 @@ cookieflags() { # ARG1: Path, ARG2: path
639
639
pr_bold " Cookie(s) "
640
640
grep -ai ' ^Set-Cookie' $HEADERFILE > $TMPFILE
641
641
if [ $? -eq 0 ]; then
642
- nr_cookies=$( wc -l < $TMPFILE )
642
+ nr_cookies=$( wc -l < $TMPFILE | sed ' s/ //g ' )
643
643
out " $nr_cookies issued: "
644
644
if [ $nr_cookies -gt 1 ] ; then
645
645
negative_word=" NONE"
@@ -743,14 +743,14 @@ prettyprint_local() {
743
743
neat_header
744
744
745
745
if [ -z " $1 " ]; then
746
- $OPENSSL ciphers -V ' ALL:COMPLEMENTOFALL:@STRENGTH' | while read hexcode dash ciph sslvers kx auth enc mac export ; do
746
+ $OPENSSL ciphers -V ' ALL:COMPLEMENTOFALL:@STRENGTH' | while read hexcode dash ciph sslvers kx auth enc mac export ; do # -V doesn't work with openssl < 1.0
747
747
normalize_ciphercode $hexcode
748
748
neat_list $HEXC $ciph $kx $enc
749
749
outln
750
750
done
751
751
else
752
752
for arg in $( echo $@ | sed ' s/,/ /g' ) ; do
753
- $OPENSSL ciphers -V ' ALL:COMPLEMENTOFALL:@STRENGTH' | while read hexcode dash ciph sslvers kx auth enc mac export ; do
753
+ $OPENSSL ciphers -V ' ALL:COMPLEMENTOFALL:@STRENGTH' | while read hexcode dash ciph sslvers kx auth enc mac export ; do # -V doesn't work with openssl < 1.0
754
754
normalize_ciphercode $hexcode
755
755
neat_list $HEXC $ciph $kx $enc | grep -wai " $arg "
756
756
done
@@ -859,9 +859,9 @@ neat_header(){
859
859
neat_list (){
860
860
kx=$( echo $3 | sed ' s/Kx=//g' )
861
861
enc=$( echo $4 | sed ' s/Enc=//g' )
862
- strength=$( echo $enc | sed -e ' s/.*(//' -e ' s/)//' ) # strength = encryption bits
863
- strength=$( echo $strength | sed -e ' s/ChaCha20-Poly1305/ly1305/g' ) # workaround for empty bits ChaCha20-Poly1305
864
- enc=$( echo $enc | sed -e ' s/(.*)//g' -e ' s/ChaCha20-Poly1305/ChaCha20-Po/g' ) # workaround for empty bits ChaCha20-Poly1305
862
+ strength=$( echo $enc | sed -e ' s/.*(//' -e ' s/)//' ) # strength = encryption bits
863
+ strength=$( echo $strength | sed -e ' s/ChaCha20-Poly1305/ly1305/g' ) # workaround for empty bits ChaCha20-Poly1305
864
+ enc=$( echo $enc | sed -e ' s/(.*)//g' -e ' s/ChaCha20-Poly1305/ChaCha20-Po/g' ) # workaround for empty bits ChaCha20-Poly1305
865
865
echo " $export " | grep -iq export && strength=" $strength ,export"
866
866
if [ -r " $MAP_RFC_FNAME " ]; then
867
867
printf -- " %-7s %-30s %-10s %-11s%-11s${MAP_RFC_FNAME: + % -48s}${SHOW_EACH_C: + } " " $1 " " $2 " " $kx " " $enc " " $strength " " $( show_rfc_style $HEXC ) "
@@ -937,7 +937,7 @@ cipher_per_proto(){
937
937
outln " -ssl2 SSLv2\n -ssl3 SSLv3\n -tls1 TLS 1\n -tls1_1 TLS 1.1\n -tls1_2 TLS 1.2" | while read proto proto_text; do
938
938
locally_supported " $proto " " $proto_text " || continue
939
939
outln
940
- $OPENSSL ciphers $proto -V ' ALL:COMPLEMENTOFALL:@STRENGTH' | while read hexcode n ciph sslvers kx auth enc mac export ; do
940
+ $OPENSSL ciphers $proto -V ' ALL:COMPLEMENTOFALL:@STRENGTH' | while read hexcode n ciph sslvers kx auth enc mac export ; do # -V doesn't work with openssl < 1.0
941
941
$OPENSSL s_client -cipher $ciph $proto $STARTTLS -connect $NODEIP :$PORT $SNI & > $TMPFILE < /dev/null
942
942
ret=$?
943
943
if [ $ret -ne 0 ] && [ " $SHOW_EACH_C " -eq 0 ]; then
@@ -1498,7 +1498,7 @@ pfs() {
1498
1498
outln
1499
1499
pr_blue " --> Testing (perfect) forward secrecy, (P)FS" ; outln " -- omitting 3DES, RC4 and Null Encryption here"
1500
1500
1501
- $OPENSSL ciphers -V " $pfs_ciphers " > $TMPFILE 2> /dev/null
1501
+ $OPENSSL ciphers -V " $pfs_ciphers " > $TMPFILE 2> /dev/null # -V doesn't work with openssl < 1.0
1502
1502
if [ $? -ne 0 ] ; then
1503
1503
number_pfs=$( wc -l < $TMPFILE | sed ' s/ //g' )
1504
1504
if [ " $number_pfs " -le " $CLIENT_MIN_PFS " ] ; then
@@ -1539,7 +1539,7 @@ pfs() {
1539
1539
fi
1540
1540
fi
1541
1541
outln
1542
- done < <( $OPENSSL ciphers -V " $pfs_ciphers " )
1542
+ done < <( $OPENSSL ciphers -V " $pfs_ciphers " ) # -V doesn't work with openssl < 1.0
1543
1543
# ^^^^^ posix redirect as shopt will either segfault or doesn't work with old bash versions
1544
1544
debugme echo $none
1545
1545
@@ -1809,7 +1809,7 @@ sslv2_sockets() {
1809
1809
pr_greenln " not offered (OK)"
1810
1810
ret=0 ;;
1811
1811
3) # everything else
1812
- lines=$( hexdump -C " $SOCK_REPLY_FILE " 2> /dev/null | wc -l)
1812
+ lines=$( hexdump -C " $SOCK_REPLY_FILE " 2> /dev/null | wc -l | sed ' s/ //g ' )
1813
1813
[[ " $DEBUG " -ge 2 ]] && out " ($lines lines) "
1814
1814
if [[ " $lines " -gt 1 ]] ; then
1815
1815
ciphers_detected=$(( $V2_HELLO_CIPHERSPEC_LENGTH / 3 ))
@@ -1967,7 +1967,7 @@ tls_sockets() {
1967
1967
save=$?
1968
1968
1969
1969
# see https://secure.wand.net.nz/trac/libprotoident/wiki/SSL
1970
- lines=$( hexdump -C " $SOCK_REPLY_FILE " 2> /dev/null | wc -l)
1970
+ lines=$( hexdump -C " $SOCK_REPLY_FILE " 2> /dev/null | wc -l | sed ' s/ //g ' )
1971
1971
[[ " $DEBUG " -ge 2 ]] && out " (returned $lines lines) "
1972
1972
1973
1973
# printf "Protokoll "; tput bold; printf "$tls_low_byte = $tls_str"; tput sgr0; printf ": "
@@ -2093,7 +2093,7 @@ heartbleed(){
2093
2093
outln
2094
2094
fi
2095
2095
2096
- lines_returned=$( echo " $SOCKREPLY " | " ${HEXDUMP[@]} " | wc -l)
2096
+ lines_returned=$( echo " $SOCKREPLY " | " ${HEXDUMP[@]} " | wc -l | sed ' s/ //g ' )
2097
2097
if [ $lines_returned -gt 1 ]; then
2098
2098
pr_red " VULNERABLE (NOT ok)"
2099
2099
ret=1
@@ -2204,7 +2204,7 @@ ccs_injection(){
2204
2204
fi
2205
2205
2206
2206
reply_sanitized=$( echo " $SOCKREPLY " | " ${HEXDUMPPLAIN[@]} " | sed ' s/^..........//' )
2207
- lines=$( echo " $SOCKREPLY " | " ${HEXDUMP[@]} " | wc -l)
2207
+ lines=$( echo " $SOCKREPLY " | " ${HEXDUMP[@]} " | wc -l | sed ' s/ //g ' )
2208
2208
2209
2209
if [ " $reply_sanitized " == " 0a" ] || [ " $lines " -gt 1 ] ; then
2210
2210
pr_green " not vulnerable (OK)"
@@ -2453,7 +2453,7 @@ freak() {
2453
2453
2454
2454
[ $VULN_COUNT -le $VULN_THRESHLD ] && outln && pr_blue " --> Testing for FREAK attack" && outln " \n"
2455
2455
pr_bold " FREAK " ; out " (CVE-2015-0204), experimental "
2456
- no_exportrsa_ciphers=$( $OPENSSL ciphers -v ' ALL:eNULL' | egrep -a " ^EXP.*RSA" | wc -l)
2456
+ no_exportrsa_ciphers=$( $OPENSSL ciphers -v ' ALL:eNULL' | egrep -a " ^EXP.*RSA" | wc -l | sed ' s/ //g ' )
2457
2457
exportrsa_ciphers=$( $OPENSSL ciphers -v ' ALL:eNULL' | awk ' /^EXP.*RSA/ {print $1}' | tr ' \n' ' :' )
2458
2458
debugme echo $exportrsa_ciphers
2459
2459
# with correct build it should list these 7 ciphers (plus the two latter as SSLv2 ciphers):
@@ -2502,15 +2502,15 @@ beast(){
2502
2502
if [ $? -ne 0 ]; then
2503
2503
continue # protocol no supported, so we do not need to check each cipher with that protocol
2504
2504
fi
2505
- # FIXME: doesn't work on FreeBSD, needs a warning and bailout
2505
+ # FIXME: doesn't work on with openssl 0.98, we won't fix though
2506
2506
while read hexcode dash cbc_cipher sslvers kx auth enc mac export ; do
2507
2507
$OPENSSL s_client -cipher " $cbc_cipher " -" $proto " $STARTTLS -connect $NODEIP :$PORT $SNI > $TMPFILE 2> /dev/null < /dev/null
2508
2508
# normalize_ciphercode $hexcode
2509
2509
# neat_list $HEXC $ciph $kx $enc | grep -wai "$arg"
2510
2510
if [ $? -eq 0 ]; then
2511
2511
detected_cbc_cipher=" $detected_cbc_cipher " " $( grep -aw " Cipher" $TMPFILE | egrep -avw " New|is" | sed -e ' s/^.*Cipher.*://' -e ' s/ //g' ) "
2512
2512
fi
2513
- done < <( $OPENSSL ciphers -V ' ALL:eNULL' | grep -a CBC)
2513
+ done < <( $OPENSSL ciphers -V ' ALL:eNULL' | grep -a CBC) # -V doesn't work with openssl < 1.0
2514
2514
# ^^^^^ process substitution as shopt will either segfault or doesn't work with old bash versions
2515
2515
2516
2516
# detected_cbc_cipher=$(echo $detected_cbc_cipher | sed 's/ //g')
@@ -2564,7 +2564,7 @@ rc4() {
2564
2564
fi
2565
2565
pr_bold " RC4" ; out " (CVE-2013-2566, CVE-2015-2808) "
2566
2566
2567
- $OPENSSL ciphers -V ' RC4:@STRENGTH' > $TMPFILE
2567
+ $OPENSSL ciphers -V ' RC4:@STRENGTH' > $TMPFILE # -V doesn't work with openssl < 1.0
2568
2568
[ $LONG -eq 0 ] && [ $SHOW_LOC_CIPH -eq 0 ] && echo " local ciphers available for testing RC4:" && echo $( cat $TMPFILE )
2569
2569
$OPENSSL s_client -cipher $( $OPENSSL ciphers RC4) $STARTTLS -connect $NODEIP :$PORT $SNI & > /dev/null < /dev/null
2570
2570
if [ $? -eq 0 ]; then
@@ -2574,9 +2574,9 @@ rc4() {
2574
2574
[[ $LONG -eq 0 ]] && neat_header
2575
2575
while read hexcode n ciph sslvers kx auth enc mac; do
2576
2576
$OPENSSL s_client -cipher $ciph $STARTTLS -connect $NODEIP :$PORT $SNI < /dev/null & > /dev/null
2577
- ret=$?
2577
+ ret=$? # here we have a fp with openssl < 1.0
2578
2578
if [[ $ret -ne 0 ]] && [[ " $SHOW_EACH_C " -eq 0 ]] ; then
2579
- continue # no successful connect AND not verbose displaying each cipher
2579
+ continue # no successful connect AND not verbose displaying each cipher
2580
2580
fi
2581
2581
if [ $LONG -eq 0 ]; then
2582
2582
normalize_ciphercode $hexcode
@@ -2678,20 +2678,20 @@ openssl_age() {
2678
2678
0.9.8)
2679
2679
case $OSSL_VER_APPENDIX in
2680
2680
a|b|c|d|e) old_fart;; # no SNI!
2681
- # other than that we leave this for MacOSX but it's a pain and no guarantees!
2681
+ # other than that we leave this for MacOSX and FREEBSD but it's a pain and likely gives false negatives/positives
2682
2682
esac
2683
2683
;;
2684
2684
esac
2685
2685
if [ $OSSL_VER_MAJOR -lt 1 ]; then # # mm: Patch for libressl
2686
2686
outln
2687
- outln " Your \" $OPENSSL \" is way too old (<version 1.0)"
2687
+ pr_magentaln " Your \" $OPENSSL \" is way too old (<version 1.0)"
2688
2688
case $SYSTEM in
2689
2689
* BSD|Darwin)
2690
2690
outln " Please use openssl from ports/brew or compile from github.com/PeterMosmans/openssl" ;;
2691
2691
* ) outln " Update openssl binaries or compile from github.com/PeterMosmans/openssl" ;;
2692
2692
esac
2693
2693
outln
2694
- pr_magentaln " Proceeding may result in false negatives or positives ¡¡¡ <Enter> at your own risk !!! \n"
2694
+ pr_magentaln " ¡¡¡ Proceeding WILL CERTAINLY result in false negatives or positives !!! Hit <ENTER> to acknowledge \n"
2695
2695
read a
2696
2696
fi
2697
2697
}
3423
3423
3424
3424
exit $ret
3425
3425
3426
- # $Id: testssl.sh,v 1.246 2015/05/11 08:47:25 dirkw Exp $
3426
+ # $Id: testssl.sh,v 1.247 2015/05/11 14:58:56 dirkw Exp $
3427
3427
# vim:ts=5:sw=5
3428
3428
# ^^^ FYI: use vim and you will see everything beautifully indented with a 5 char tab
0 commit comments