1111# Stable version https://testssl.sh
1212# File bugs at GitHub https://github.com/testssl/testssl.sh/issues
1313#
14- # Project lead and initiator: Dirk Wetter, copyleft: 2007-today, contributions so far see CREDITS.md
15- # Main contributions from David Cooper
16- # Project lead and initiator: Dirk Wetter, copyleft: 2007-today.
14+ # Project lead and initiator: Dirk Wetter, copyleft: 2007-today, contributions so far
15+ # see CREDITS.md .
1716# Main contributions from David Cooper. Further contributors see CREDITS.md .
1817#
19- # License: GPLv2, see https://opensource.org/licenses/gpl-2.0.php and
20- # accompanying license "LICENSE.txt". Redistribution + modification under this
21- # license permitted.
18+ # License: GPLv2, see https://opensource.org/licenses/gpl-2.0.php and accompanying
19+ # license "LICENSE.txt". Redistribution + modification under this license permitted.
20+ #
2221# If you enclose this program or parts of it in your software, it has to be
2322# accompanied by the same license (see link). Do not violate the license.
24- # If you do not agree to these terms, do not use it in the first place!
23+ # If you do not agree to these terms, do not use testssl.sh in the first place!
2524#
2625# OpenSSL, which is being used and maybe distributed via one of this projects'
2726# web sites, is subject to their licensing: https://www.openssl.org/source/license.txt
3029# Terms of Use' (v2.2), see https://www.ssllabs.com/downloads/Qualys_SSL_Labs_Terms_of_Use.pdf,
3130# stating a CC BY 3.0 US license: https://creativecommons.org/licenses/by/3.0/us/
3231#
33- # Please note: USAGE WITHOUT ANY WARRANTY, THE SOFTWARE IS PROVIDED "AS IS".
34- # USE IT AT your OWN RISK!
35- # Seriously! The threat is you run this code on your computer and untrusted input e.g.
36- # could be supplied from a server you are querying.
32+ # Please note:
33+ # USAGE WITHOUT ANY WARRANTY, THE SOFTWARE IS PROVIDED "AS IS". USE IT AT your OWN RISK!
34+ #
35+ # The threat is you run this code on your computer and untrusted input could be supplied from
36+ # a server you are testing.
3737#
3838# HISTORY:
3939# Back in 2006 it all started with a few openssl commands...
4040# That's because openssl is a such a good swiss army knife (see e.g.
4141# https://wiki.openssl.org/index.php/Command_Line_Utilities) that it was difficult to resist
4242# wrapping some shell commands around it, which I used for my pen tests. This is how
4343# everything started.
44- # Now it has grown up, it has bash socket support for most features, which has been basically
44+ # Testssl.sh has grown up, it has bash socket support for most features, which has been basically
4545# replacing more and more functions of OpenSSL and some sockets functions serve as some kind
4646# of central functions.
4747#
@@ -462,6 +462,7 @@ declare TLS_CIPHER_OSSL_NAME=()
462462declare TLS_CIPHER_RFC_NAME=()
463463declare TLS_CIPHER_SSLVERS=()
464464declare TLS_CIPHER_KX=()
465+ # shellcheck disable=SC2034 . This is a false positive
465466declare TLS_CIPHER_AUTH=()
466467declare TLS_CIPHER_ENC=()
467468declare TLS_CIPHER_EXPORT=()
@@ -13135,7 +13136,7 @@ derive-handshake-secret() {
1313513136 pubkeys_and_ciphers="${pubkeys_and_ciphers%--END HYBRID CIPHERTEXT--*}"
1313613137 privkeys="${tmpfile#*---BEGIN HYBRID PRIV KEY---}"
1313713138 privkeys="${privkeys%---END HYBRID PRIV KEY---*}"
13138-
13139+
1313913140 while [[ "$pubkeys_and_ciphers" =~ BEGIN ]]; do
1314013141 if [[ "${pubkeys_and_ciphers:0:27}" =~ BEGIN\ CIPHERTEXT ]]; then
1314113142 key_or_cipher="-----BEGIN CIPHERTEXT${pubkeys_and_ciphers#*-----BEGIN CIPHERTEXT}"
@@ -18364,16 +18365,16 @@ run_breach() {
1836418365 if [[ ${has_compression[*]} =~ warn ]]; then
1836518366 # warn_empty / warn_stalled
1836618367 if [[ ${has_compression[*]} =~ warn_empty ]]; then
18367- pr_warning "At least 1/4 checks failed (HTTP header request was empty, debug: ${has_compression[@ ]}"
18368- outln ", debug: ${has_compression[@ ]})"
18369- fileout "$jsonID" "WARN" "Test failed as HTTP response was empty, debug: ${has_compression[@ ]}" "$cve" "$cwe"
18368+ pr_warning "At least 1/4 checks failed (HTTP header request was empty, debug: ${has_compression[* ]}"
18369+ outln ", debug: ${has_compression[* ]})"
18370+ fileout "$jsonID" "WARN" "Test failed as HTTP response was empty, debug: ${has_compression[* ]}" "$cve" "$cwe"
1837018371 else # warn_stalled
1837118372 pr_warning "At least 1/4 checks failed (HTTP header request stalled and was terminated"
18372- outln ", debug: ${has_compression[@ ]})"
18373+ outln ", debug: ${has_compression[* ]})"
1837318374 fileout "$jsonID" "WARN" "Test failed as HTTP request stalled and was terminated" "$cve" "$cwe"
1837418375 fi
1837518376 else
18376- for c in " ${has_compression[@]}" ; do
18377+ for c in ${has_compression[*]} ; do
1837718378 if [[ $c =~ yes ]]; then
1837818379 detected_compression+="${c%:*} "
1837918380 fi
@@ -18384,7 +18385,7 @@ run_breach() {
1838418385 outln "${spaces}${when_makesense}"
1838518386 fileout "$jsonID" "MEDIUM" "potentially VULNERABLE, $detected_compression HTTP compression detected $disclaimer" "$cve" "$cwe" "$hint"
1838618387 fi
18387- debugme outln "${spaces}has_compression: ${has_compression[@ ]}"
18388+ debugme outln "${spaces}has_compression: ${has_compression[* ]}"
1838818389 ;;
1838918390 esac
1839018391
0 commit comments