Skip to content

Commit 40c1edb

Browse files
authored
Merge pull request #2976 from testssl/mitigate_2083_3.2
Mitigate inconsistent test results for ROBOT (3.2)
2 parents e456679 + 1ca2d62 commit 40c1edb

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

doc/testssl.1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ Security headers (X\-Frame\-Options, X\-XSS\-Protection, Expect\-CT,\|\.\|\.\|\.
227227
.P
228228
\fB\-T, \-\-ticketbleed\fR Checks for Ticketbleed memory leakage in BigIP loadbalancers\.
229229
.P
230-
\fB\-\-BB, \-\-robot\fR Checks for vulnerability to ROBOT / (\fIReturn Of Bleichenbacher's Oracle Threat\fR) attack\.
230+
\fB\-\-BB, \-\-robot\fR Checks for vulnerability to ROBOT / (\fIReturn Of Bleichenbacher's Oracle Threat\fR) attack\. The predefined timeout of 10 seconds can be changed with the environment variable \fBROBOT_TIMEOUT\fR\.
231231
.P
232232
\fB\-\-SI, \-\-starttls\-injection\fR Checks for STARTTLS injection vulnerabilities (SMTP, IMAP, POP3 only)\. \fBsocat\fR and OpenSSL >=1\.1\.0 is needed\.
233233
.P
@@ -393,6 +393,8 @@ CCS_MAX_WAITSOCK Is the similar to above but applies only to the CCS handshakes,
393393
.IP "\[ci]" 4
394394
HEARTBLEED_MAX_WAITSOCK Is the similar to MAX_WAITSOCK but applies only to the ServerHello after sending the Heartbleed payload\. Don't change this unless you're absolutely sure what you're doing\. Value is in seconds\.
395395
.IP "\[ci]" 4
396+
ROBOT_TIMEOUT is similar to above and applies to the ROBOT check\.
397+
.IP "\[ci]" 4
396398
MEASURE_TIME_FILE For seldom cases when you don't want the scan time to be included in the output you can set this to false\.
397399
.IP "\[ci]" 4
398400
STARTTLS_SLEEP is per default set to 10 (seconds)\. That's the value testssl\.sh waits for a string in the STARTTLS handshake before giving up\.

doc/testssl.1.html

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/testssl.1.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ Also for multiple server certificates are being checked for as well as for the c
236236

237237
`-T, --ticketbleed` Checks for Ticketbleed memory leakage in BigIP loadbalancers.
238238

239-
`--BB, --robot` Checks for vulnerability to ROBOT / (*Return Of Bleichenbacher's Oracle Threat*) attack.
239+
`--BB, --robot` Checks for vulnerability to ROBOT / (*Return Of Bleichenbacher's Oracle Threat*) attack. The predefined timeout of 10 seconds can be changed with the environment variable `ROBOT_TIMEOUT`.
240240

241241
`--SI, --starttls-injection` Checks for STARTTLS injection vulnerabilities (SMTP, IMAP, POP3 only). `socat` and OpenSSL >=1.1.0 is needed.
242242

@@ -386,6 +386,7 @@ Except the environment variables mentioned above which can replace command line
386386
* MAX_WAITSOCK: It instructs testssl.sh to wait until the specified time before declaring a socket connection dead. Don't change this unless you're absolutely sure what you're doing. Value is in seconds.
387387
* CCS_MAX_WAITSOCK Is the similar to above but applies only to the CCS handshakes, for both of the two the two CCS payload. Don't change this unless you're absolutely sure what you're doing. Value is in seconds.
388388
* HEARTBLEED_MAX_WAITSOCK Is the similar to MAX_WAITSOCK but applies only to the ServerHello after sending the Heartbleed payload. Don't change this unless you're absolutely sure what you're doing. Value is in seconds.
389+
* ROBOT_TIMEOUT is similar to above and applies to the ROBOT check.
389390
* MEASURE_TIME_FILE For seldom cases when you don't want the scan time to be included in the output you can set this to false.
390391
* STARTTLS_SLEEP is per default set to 10 (seconds). That's the value testssl.sh waits for a string in the STARTTLS handshake before giving up.
391392
* MAX_PARALLEL is the maximum number of tests to run in parallel in parallel mass testing mode. The default value of 20 may be made larger on systems with faster processors.

testssl.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ MAX_HEADER_FAIL=${MAX_HEADER_FAIL:-2} # If this many failures for HTTP GET are
207207
MAX_WAITSOCK=${MAX_WAITSOCK:-10} # waiting at max 10 seconds for socket reply. There shouldn't be any reason to change this.
208208
CCS_MAX_WAITSOCK=${CCS_MAX_WAITSOCK:-5} # for the two CCS payload (each). There shouldn't be any reason to change this.
209209
HEARTBLEED_MAX_WAITSOCK=${HEARTBLEED_MAX_WAITSOCK:-8} # for the heartbleed payload. There shouldn't be any reason to change this.
210+
ROBOT_TIMEOUT=${ROBOT_TIMEOUT:10} # Initial timeout for ROBOT check
210211
STARTTLS_SLEEP=${STARTTLS_SLEEP:-10} # max time wait on a socket for STARTTLS. MySQL has a fixed value of 1 which can't be overwritten (#914)
211212
FAST_STARTTLS=${FAST_STARTTLS:-true} # at the cost of reliability decrease the handshakes for STARTTLS
212213
USLEEP_SND=${USLEEP_SND:-0.1} # sleep time for general socket send
@@ -20400,7 +20401,7 @@ run_robot() {
2040020401
local -i i subret len iteration testnum pubkeybytes
2040120402
local pubkeybits
2040220403
local vulnerable=false send_ccs_finished=true
20403-
local -i start_time end_time robottimeout=$MAX_WAITSOCK
20404+
local -i start_time end_time robottimeout=$ROBOT_TIMEOUT
2040420405
local cve="CVE-2017-17382 CVE-2017-17427 CVE-2017-17428 CVE-2017-13098 CVE-2017-1000385 CVE-2017-13099 CVE-2016-6883 CVE-2012-5081 CVE-2017-6168"
2040520406
local cwe="CWE-203"
2040620407
local jsonID="ROBOT"
@@ -20571,6 +20572,11 @@ run_robot() {
2057120572
end_time=$(LC_ALL=C date "+%s")
2057220573
resp=$(hexdump -v -e '16/1 "%02x"' "$SOCK_REPLY_FILE")
2057320574
response[testnum]="${resp%%[!0-9A-F]*}"
20575+
# TLS alert length seems to vary sometimes within this loop which leads to
20576+
# wrong test results, see #2083. Thus we cut this here to length 14, if
20577+
# it's a TLS alert with the length of 2
20578+
[[ ${response[testnum]::2} == 15 ]] && [[ ${response[testnum]:10:2} == 02 ]] &&
20579+
response[testnum]=${response[testnum]::14}
2057420580
# The first time a response is received to a client key
2057520581
# exchange message, measure the amount of time it took to
2057620582
# receive a response and set the timeout value for future

0 commit comments

Comments
 (0)