Skip to content

Commit be987d1

Browse files
authored
Merge pull request #2360 from mum-viadee/run_renego_sni_patch
Secure renegotiations tests need servername for servers that use SNI
2 parents aa5235e + 22a4f52 commit be987d1

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

testssl.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16896,7 +16896,7 @@ run_renego() {
1689616896
local hint=""
1689716897
local jsonID=""
1689816898
local ssl_reneg_attempts=$SSL_RENEG_ATTEMPTS
16899-
# No SNI needed here as there won't be two different SSL stacks for one IP
16899+
# In cases where there's no default host configured we need SNI here as openssl then would return otherwise an error and the test will fail
1690016900

1690116901
"$HAS_TLS13" && [[ -z "$proto" ]] && proto="-no_tls1_3"
1690216902

@@ -16913,7 +16913,7 @@ run_renego() {
1691316913
fileout "$jsonID" "OK" "TLS 1.3 only server" "$cve" "$cwe"
1691416914
else
1691516915
# first fingerprint for the Line "Secure Renegotiation IS NOT" or "Secure Renegotiation IS "
16916-
$OPENSSL s_client $(s_client_options "$proto $STARTTLS $BUGS -connect $NODEIP:$PORT $PROXY") 2>&1 </dev/null >$TMPFILE 2>$ERRFILE
16916+
$OPENSSL s_client $(s_client_options "$proto $STARTTLS $BUGS -connect $NODEIP:$PORT $PROXY $SNI") 2>&1 </dev/null >$TMPFILE 2>$ERRFILE
1691716917
if sclient_connect_successful $? $TMPFILE; then
1691816918
grep -iaq "Secure Renegotiation IS NOT" $TMPFILE
1691916919
sec_renego=$? # 0= Secure Renegotiation IS NOT supported
@@ -16982,15 +16982,15 @@ run_renego() {
1698216982
else
1698316983
# We need up to two tries here, as some LiteSpeed servers don't answer on "R" and block. Thus first try in the background
1698416984
# msg enables us to look deeper into it while debugging
16985-
echo R | $OPENSSL s_client $(s_client_options "$proto $BUGS $legacycmd $STARTTLS -connect $NODEIP:$PORT $PROXY") >$TMPFILE 2>>$ERRFILE &
16985+
echo R | $OPENSSL s_client $(s_client_options "$proto $BUGS $legacycmd $STARTTLS -connect $NODEIP:$PORT $PROXY $SNI") >$TMPFILE 2>>$ERRFILE &
1698616986
wait_kill $! $HEADER_MAXSLEEP
1698716987
if [[ $? -eq 3 ]]; then
1698816988
pr_svrty_good "likely not vulnerable (OK)"; outln ", timed out" # it hung
1698916989
fileout "$jsonID" "OK" "likely not vulnerable (timed out)" "$cve" "$cwe"
1699016990
sec_client_renego=1
1699116991
else
1699216992
# second try in the foreground as we are sure now it won't hang
16993-
echo R | $OPENSSL s_client $(s_client_options "$proto $legacycmd $STARTTLS $BUGS -connect $NODEIP:$PORT $PROXY") >$TMPFILE 2>>$ERRFILE
16993+
echo R | $OPENSSL s_client $(s_client_options "$proto $legacycmd $STARTTLS $BUGS -connect $NODEIP:$PORT $PROXY $SNI") >$TMPFILE 2>>$ERRFILE
1699416994
sec_client_renego=$?
1699516995
# 0 means client is renegotiating & doesn't return an error --> vuln!
1699616996
# 1 means client tried to renegotiating but the server side errored then. You still see RENEGOTIATING in the output
@@ -17011,7 +17011,7 @@ run_renego() {
1701117011
fileout "$jsonID" "MEDIUM" "VULNERABLE, potential DoS threat" "$cve" "$cwe" "$hint"
1701217012
else
1701317013
(for ((i=0; i < ssl_reneg_attempts; i++ )); do echo R; sleep 1; done) | \
17014-
$OPENSSL s_client $(s_client_options "$proto $legacycmd $STARTTLS $BUGS -connect $NODEIP:$PORT $PROXY") >$TMPFILE 2>>$ERRFILE
17014+
$OPENSSL s_client $(s_client_options "$proto $legacycmd $STARTTLS $BUGS -connect $NODEIP:$PORT $PROXY $SNI") >$TMPFILE 2>>$ERRFILE
1701517015
case $? in
1701617016
0) pr_svrty_high "VULNERABLE (NOT ok)"; outln ", DoS threat ($ssl_reneg_attempts attempts)"
1701717017
fileout "$jsonID" "HIGH" "VULNERABLE, DoS threat" "$cve" "$cwe" "$hint"

0 commit comments

Comments
 (0)