Skip to content

Commit 4af9016

Browse files
authored
Merge pull request #1751 from tosticated/ssl_renego_mod
Modified ssl renegotiation attempts to be variable, default 6.
2 parents 1049fe2 + 45059ed commit 4af9016

3 files changed

Lines changed: 14 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
* Added support for certificates with EdDSA signatures and pubilc keys
2424
* --add-ca can also now be a directory with \*.pem files
2525
* Warning of 398 day limit for certificates issued after 2020/9/1
26+
* Added environment variable for amount of attempts for ssl renegotiation check
2627
* Added --user-agent argument to support using a custom User Agent
2728

2829
### Features implemented / improvements in 3.0

CREDITS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ Full contribution, see git log.
4040
- NetBSD fixes
4141

4242
* Jim Blankendaal
43-
- maximum certificate lifespan of 398 days
43+
- maximum certificate lifespan of 398 days
44+
- ssl renegotiation amount variable
4445

4546
* Frank Breedijk
4647
- Detection of insecure redirects

testssl.sh

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ fi
231231
DISPLAY_CIPHERNAMES="openssl" # display OpenSSL ciphername (but both OpenSSL and RFC ciphernames in wide mode)
232232
declare UA_STD="TLS tester from $SWURL"
233233
declare -r UA_SNEAKY="Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
234+
SSL_RENEG_ATTEMPTS=${SSL_RENEG_ATTEMPTS:-6} # number of times to check SSL Renegotiation
234235

235236
########### Initialization part, further global vars just being declared here
236237
#
@@ -15969,6 +15970,7 @@ run_renego() {
1596915970
local cwe="CWE-310"
1597015971
local hint=""
1597115972
local jsonID=""
15973+
local ssl_reneg_attempts=$SSL_RENEG_ATTEMPTS
1597215974
# No SNI needed here as there won't be two different SSL stacks for one IP
1597315975

1597415976
"$HAS_TLS13" && [[ -z "$proto" ]] && proto="-no_tls1_3"
@@ -16074,24 +16076,26 @@ run_renego() {
1607416076
fi
1607516077
case "$sec_client_renego" in
1607616078
0) # We try again if server is HTTP. This could be either a node.js server or something else.
16077-
# node.js has a mitigation which allows 3x R and then blocks. So we test 4x
16079+
# Mitigations (default values) for:
16080+
# - node.js allows 3x R and then blocks. So then 4x should be tested.
16081+
# - F5 BIG-IP ADS allows 5x R and then blocks. So then 6x should be tested.
1607816082
# This way we save a couple seconds as we weeded out the ones which are more robust
16083+
# Amount of times tested before breaking is set in SSL_RENEG_ATTEMPTS.
1607916084
if [[ $SERVICE != HTTP ]]; then
1608016085
pr_svrty_medium "VULNERABLE (NOT ok)"; outln ", potential DoS threat"
1608116086
fileout "$jsonID" "MEDIUM" "VULNERABLE, potential DoS threat" "$cve" "$cwe" "$hint"
1608216087
else
16083-
(for i in {1..4}; do echo R; sleep 1; done) | \
16088+
(for ((i=0; i < ssl_reneg_attempts; i++ )); do echo R; sleep 1; done) | \
1608416089
$OPENSSL s_client $(s_client_options "$proto $legacycmd $STARTTLS $BUGS -connect $NODEIP:$PORT $PROXY") >$TMPFILE 2>>$ERRFILE
1608516090
case $? in
16086-
0) pr_svrty_high "VULNERABLE (NOT ok)"; outln ", DoS threat"
16091+
0) pr_svrty_high "VULNERABLE (NOT ok)"; outln ", DoS threat ($ssl_reneg_attempts attempts)"
1608716092
fileout "$jsonID" "HIGH" "VULNERABLE, DoS threat" "$cve" "$cwe" "$hint"
1608816093
;;
16089-
1) pr_svrty_good "not vulnerable (OK)"
16090-
outln " -- mitigated"
16094+
1) pr_svrty_good "not vulnerable (OK)"; outln " -- mitigated (disconnect within $ssl_reneg_attempts)"
1609116095
fileout "$jsonID" "OK" "not vulnerable, mitigated" "$cve" "$cwe"
1609216096
;;
16093-
*) prln_warning "FIXME (bug): $sec_client_renego (4 tries)"
16094-
fileout "$jsonID" "DEBUG" "FIXME (bug 4 tries) $sec_client_renego" "$cve" "$cwe"
16097+
*) prln_warning "FIXME (bug): $sec_client_renego ($ssl_reneg_attempts tries)"
16098+
fileout "$jsonID" "DEBUG" "FIXME (bug $ssl_reneg_attempts tries) $sec_client_renego" "$cve" "$cwe"
1609516099
ret=1
1609616100
;;
1609716101
esac

0 commit comments

Comments
 (0)