Skip to content

Commit 1aaab67

Browse files
committed
Multiple IP fix and simple not vulnerable printing case recover
- Recover the "not vulnerable" case (no mitigation) printing, cosmetic fix. - With the removing of all s_client invocation other than the main loop one, fix the init of the ERRFILE and TMPFILE: no need to append, no need to remove, inconditionally zap the content before the loop.
1 parent 7625422 commit 1aaab67

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

testssl.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17172,8 +17172,6 @@ run_renego() {
1717217172
# We will need $ERRFILE for mitigation detection
1717317173
if [[ $ERRFILE =~ dev.null ]]; then
1717417174
ERRFILE=$TEMPDIR/errorfile.txt || exit $ERR_FCREATE
17175-
# cleanup previous run if any (multiple IP)
17176-
rm -f $ERRFILE
1717717175
restore_errfile=1
1717817176
else
1717917177
restore_errfile=0
@@ -17190,7 +17188,9 @@ run_renego() {
1719017188
# Amount of times tested before breaking is set in SSL_RENEG_ATTEMPTS.
1719117189

1719217190
# Clear the log to not get the content of previous run before the execution of the new one.
17191+
# (Used in the loop tests before s_client invocation)
1719317192
echo -n > $TMPFILE
17193+
echo -n > $ERRFILE
1719417194
# RENEGOTIATING wait loop watchdog file
1719517195
touch $TEMPDIR/allowed_to_loop
1719617196
# If we dont wait for the session to be established on slow server, we will try to re-negotiate
@@ -17211,7 +17211,7 @@ run_renego() {
1721117211
&& [[ $k -lt 120 ]]; \
1721217212
do sleep $ssl_reneg_wait; ((k++)); if (tail -5 $TMPFILE| grep -qa '^closed'); then break; fi; done; \
1721317213
done) | \
17214-
$OPENSSL_NOTIMEOUT s_client $(s_client_options "$proto $legacycmd $STARTTLS $BUGS -connect $NODEIP:$PORT $PROXY $SNI") >$TMPFILE 2>>$ERRFILE &
17214+
$OPENSSL_NOTIMEOUT s_client $(s_client_options "$proto $legacycmd $STARTTLS $BUGS -connect $NODEIP:$PORT $PROXY $SNI") >$TMPFILE 2>$ERRFILE &
1721517215
pid=$!
1721617216
( sleep $((ssl_reneg_attempts*3+3)) && kill $pid && touch $TEMPDIR/was_killed ) >&2 2>/dev/null &
1721717217
watcher=$!
@@ -17235,6 +17235,9 @@ run_renego() {
1723517235
tmp_result=2
1723617236
rm -f $TEMPDIR/was_killed
1723717237
fi
17238+
if [[ $tmp_result -eq 1 ]] && [[ loop_reneg -eq 1 ]]; then
17239+
tmp_result=3
17240+
fi
1723817241
if [[ $SERVICE != HTTP ]]; then
1723917242
# theoric possible case
1724017243
if [[ $loop_reneg -eq 2 ]]; then
@@ -17244,7 +17247,7 @@ run_renego() {
1724417247
0) pr_svrty_medium "VULNERABLE (NOT ok)"; outln ", potential DoS threat"
1724517248
fileout "$jsonID" "MEDIUM" "VULNERABLE, potential DoS threat" "$cve" "$cwe" "$hint"
1724617249
;;
17247-
1) prln_svrty_good "not vulnerable (OK)"
17250+
1|3) prln_svrty_good "not vulnerable (OK)"
1724817251
fileout "$jsonID" "OK" "not vulnerable" "$cve" "$cwe"
1724917252
;;
1725017253
2) pr_svrty_good "likely not vulnerable (OK)"; outln ", timed out ($((${ssl_reneg_attempts}*3+3))s)" # it hung
@@ -17263,6 +17266,9 @@ run_renego() {
1726317266
1) pr_svrty_good "not vulnerable (OK)"; outln " -- mitigated (disconnect after $loop_reneg/$ssl_reneg_attempts attempts)"
1726417267
fileout "$jsonID" "OK" "not vulnerable, mitigated" "$cve" "$cwe"
1726517268
;;
17269+
3) prln_svrty_good "not vulnerable (OK)"
17270+
fileout "$jsonID" "OK" "not vulnerable" "$cve" "$cwe"
17271+
;;
1726617272
2) pr_svrty_good "not vulnerable (OK)"; \
1726717273
outln " -- mitigated ($loop_reneg successful reneg within ${ssl_reneg_attempts} in $((${ssl_reneg_attempts}*3+3))s(timeout))"
1726817274
fileout "$jsonID" "OK" "not vulnerable, mitigated" "$cve" "$cwe"

0 commit comments

Comments
 (0)