Skip to content

Commit 6938f16

Browse files
committed
- WONTFIX remarks for #103 and #102
- better warning for openssl < 1.0
1 parent c1d6541 commit 6938f16

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

testssl.sh

+24-24
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ EOF
447447
pid=$!
448448
if wait_kill $pid $HEADER_MAXSLEEP; then
449449
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'))."
451451
outln "Rerun with DEBUG=1 and inspect \"http_header.txt\"\n"
452452
debugme cat $HEADERFILE
453453
ret=7
@@ -639,7 +639,7 @@ cookieflags() { # ARG1: Path, ARG2: path
639639
pr_bold " Cookie(s) "
640640
grep -ai '^Set-Cookie' $HEADERFILE >$TMPFILE
641641
if [ $? -eq 0 ]; then
642-
nr_cookies=$(wc -l < $TMPFILE)
642+
nr_cookies=$(wc -l < $TMPFILE | sed 's/ //g')
643643
out "$nr_cookies issued: "
644644
if [ $nr_cookies -gt 1 ] ; then
645645
negative_word="NONE"
@@ -743,14 +743,14 @@ prettyprint_local() {
743743
neat_header
744744

745745
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
747747
normalize_ciphercode $hexcode
748748
neat_list $HEXC $ciph $kx $enc
749749
outln
750750
done
751751
else
752752
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
754754
normalize_ciphercode $hexcode
755755
neat_list $HEXC $ciph $kx $enc | grep -wai "$arg"
756756
done
@@ -859,9 +859,9 @@ neat_header(){
859859
neat_list(){
860860
kx=$(echo $3 | sed 's/Kx=//g')
861861
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
865865
echo "$export" | grep -iq export && strength="$strength,export"
866866
if [ -r "$MAP_RFC_FNAME" ]; then
867867
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(){
937937
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
938938
locally_supported "$proto" "$proto_text" || continue
939939
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
941941
$OPENSSL s_client -cipher $ciph $proto $STARTTLS -connect $NODEIP:$PORT $SNI &>$TMPFILE </dev/null
942942
ret=$?
943943
if [ $ret -ne 0 ] && [ "$SHOW_EACH_C" -eq 0 ]; then
@@ -1498,7 +1498,7 @@ pfs() {
14981498
outln
14991499
pr_blue "--> Testing (perfect) forward secrecy, (P)FS"; outln " -- omitting 3DES, RC4 and Null Encryption here"
15001500

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
15021502
if [ $? -ne 0 ] ; then
15031503
number_pfs=$(wc -l < $TMPFILE | sed 's/ //g')
15041504
if [ "$number_pfs" -le "$CLIENT_MIN_PFS" ] ; then
@@ -1539,7 +1539,7 @@ pfs() {
15391539
fi
15401540
fi
15411541
outln
1542-
done < <($OPENSSL ciphers -V "$pfs_ciphers")
1542+
done < <($OPENSSL ciphers -V "$pfs_ciphers") # -V doesn't work with openssl < 1.0
15431543
# ^^^^^ posix redirect as shopt will either segfault or doesn't work with old bash versions
15441544
debugme echo $none
15451545

@@ -1809,7 +1809,7 @@ sslv2_sockets() {
18091809
pr_greenln "not offered (OK)"
18101810
ret=0 ;;
18111811
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')
18131813
[[ "$DEBUG" -ge 2 ]] && out " ($lines lines) "
18141814
if [[ "$lines" -gt 1 ]] ;then
18151815
ciphers_detected=$(($V2_HELLO_CIPHERSPEC_LENGTH / 3 ))
@@ -1967,7 +1967,7 @@ tls_sockets() {
19671967
save=$?
19681968

19691969
# 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')
19711971
[[ "$DEBUG" -ge 2 ]] && out " (returned $lines lines) "
19721972

19731973
# printf "Protokoll "; tput bold; printf "$tls_low_byte = $tls_str"; tput sgr0; printf ": "
@@ -2093,7 +2093,7 @@ heartbleed(){
20932093
outln
20942094
fi
20952095

2096-
lines_returned=$(echo "$SOCKREPLY" | "${HEXDUMP[@]}" | wc -l)
2096+
lines_returned=$(echo "$SOCKREPLY" | "${HEXDUMP[@]}" | wc -l | sed 's/ //g')
20972097
if [ $lines_returned -gt 1 ]; then
20982098
pr_red "VULNERABLE (NOT ok)"
20992099
ret=1
@@ -2204,7 +2204,7 @@ ccs_injection(){
22042204
fi
22052205

22062206
reply_sanitized=$(echo "$SOCKREPLY" | "${HEXDUMPPLAIN[@]}" | sed 's/^..........//')
2207-
lines=$(echo "$SOCKREPLY" | "${HEXDUMP[@]}" | wc -l)
2207+
lines=$(echo "$SOCKREPLY" | "${HEXDUMP[@]}" | wc -l | sed 's/ //g')
22082208

22092209
if [ "$reply_sanitized" == "0a" ] || [ "$lines" -gt 1 ] ; then
22102210
pr_green "not vulnerable (OK)"
@@ -2453,7 +2453,7 @@ freak() {
24532453

24542454
[ $VULN_COUNT -le $VULN_THRESHLD ] && outln && pr_blue "--> Testing for FREAK attack" && outln "\n"
24552455
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')
24572457
exportrsa_ciphers=$($OPENSSL ciphers -v 'ALL:eNULL' | awk '/^EXP.*RSA/ {print $1}' | tr '\n' ':')
24582458
debugme echo $exportrsa_ciphers
24592459
# with correct build it should list these 7 ciphers (plus the two latter as SSLv2 ciphers):
@@ -2502,15 +2502,15 @@ beast(){
25022502
if [ $? -ne 0 ]; then
25032503
continue # protocol no supported, so we do not need to check each cipher with that protocol
25042504
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
25062506
while read hexcode dash cbc_cipher sslvers kx auth enc mac export ; do
25072507
$OPENSSL s_client -cipher "$cbc_cipher" -"$proto" $STARTTLS -connect $NODEIP:$PORT $SNI >$TMPFILE 2>/dev/null </dev/null
25082508
#normalize_ciphercode $hexcode
25092509
#neat_list $HEXC $ciph $kx $enc | grep -wai "$arg"
25102510
if [ $? -eq 0 ]; then
25112511
detected_cbc_cipher="$detected_cbc_cipher ""$(grep -aw "Cipher" $TMPFILE | egrep -avw "New|is" | sed -e 's/^.*Cipher.*://' -e 's/ //g')"
25122512
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
25142514
# ^^^^^ process substitution as shopt will either segfault or doesn't work with old bash versions
25152515

25162516
#detected_cbc_cipher=$(echo $detected_cbc_cipher | sed 's/ //g')
@@ -2564,7 +2564,7 @@ rc4() {
25642564
fi
25652565
pr_bold " RC4"; out " (CVE-2013-2566, CVE-2015-2808) "
25662566

2567-
$OPENSSL ciphers -V 'RC4:@STRENGTH' >$TMPFILE
2567+
$OPENSSL ciphers -V 'RC4:@STRENGTH' >$TMPFILE # -V doesn't work with openssl < 1.0
25682568
[ $LONG -eq 0 ] && [ $SHOW_LOC_CIPH -eq 0 ] && echo "local ciphers available for testing RC4:" && echo $(cat $TMPFILE)
25692569
$OPENSSL s_client -cipher $($OPENSSL ciphers RC4) $STARTTLS -connect $NODEIP:$PORT $SNI &>/dev/null </dev/null
25702570
if [ $? -eq 0 ]; then
@@ -2574,9 +2574,9 @@ rc4() {
25742574
[[ $LONG -eq 0 ]] && neat_header
25752575
while read hexcode n ciph sslvers kx auth enc mac; do
25762576
$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
25782578
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
25802580
fi
25812581
if [ $LONG -eq 0 ]; then
25822582
normalize_ciphercode $hexcode
@@ -2678,20 +2678,20 @@ openssl_age() {
26782678
0.9.8)
26792679
case $OSSL_VER_APPENDIX in
26802680
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
26822682
esac
26832683
;;
26842684
esac
26852685
if [ $OSSL_VER_MAJOR -lt 1 ]; then ## mm: Patch for libressl
26862686
outln
2687-
outln " Your \"$OPENSSL\" is way too old (<version 1.0)"
2687+
pr_magentaln " Your \"$OPENSSL\" is way too old (<version 1.0)"
26882688
case $SYSTEM in
26892689
*BSD|Darwin)
26902690
outln " Please use openssl from ports/brew or compile from github.com/PeterMosmans/openssl" ;;
26912691
*) outln " Update openssl binaries or compile from github.com/PeterMosmans/openssl" ;;
26922692
esac
26932693
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"
26952695
read a
26962696
fi
26972697
}
@@ -3423,6 +3423,6 @@ fi
34233423

34243424
exit $ret
34253425

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 $
34273427
# vim:ts=5:sw=5
34283428
# ^^^ FYI: use vim and you will see everything beautifully indented with a 5 char tab

0 commit comments

Comments
 (0)