Commit Graph

4190 Commits

Author SHA1 Message Date
Dirk Wetter c643860701 Modernize 08_isHTML_valid.t
and make it similar to 07_isJSON_valid.t or 20_baseline_ipv4_http.t
in terms of output and readability
2019-11-16 12:41:44 +01:00
Dirk Wetter 325c67d5ef
Merge pull request #1379 from drwetter/ticketbleed_minorfix
Ticketbleed fix: shutting down the connection properly
2019-11-16 11:58:52 +01:00
Dirk Wetter 7747128c11 Ticketbleed fix: shutting down the connection properly
In cases where the probes for reading memory from the server side were not
successful (=not vulnerable) the TCP connection was not shut down properly --
leading to and undefined state and probably causing problems to a consecutive
check. The server side then assumably from time to time just didn't return
anything which caused a integration test (t/08_isHTML_valid.t) to fail
randomly.

This PR properly terminates the TCP socket connection. Also, as sending the
close notification before closing the socket was duplicated in testssl.sh
that went to a separate function.

See comment in #1375:
https://github.com/drwetter/testssl.sh/pull/1375#issuecomment-554424814
2019-11-16 11:48:22 +01:00
Dirk Wetter fbca5d1b3e
Merge pull request #1375 from dcooper16/enhance_run_protocols_ssl_
Enhance run_protocols() in --ssl-native mode
2019-11-15 17:11:33 +01:00
Dirk Wetter 298628995e
Merge pull request #1377 from dcooper16/new_ossl_versions
Support new OpenSSL/LibreSSL versions
2019-11-15 17:00:45 +01:00
David Cooper b15b39a5cb
Support new OpenSSL/LibreSSL versions
This PR enhances support for the latest versions of OpenSSL and LibreSSL.

The development version of OpenSSL at https://github.com/openssl/openssl/ is version 3.0.0-dev. So, checks for OpenSSL versions need to support this version as well. At the same time, the latest versions of LibreSSL are 3.0.0, 3.0.1, and 3.0.2, so version number alone will no longer be sufficient to distinguish between OpenSSL and LibreSSL.

In addition to checks for these new version numbers, this PR addresses a couple of other issues:

 - In LibreSSL, the "$OPENSSL ciphers" command will not accept any protocol version other than "-tls1" as a parameter (and even including "-tls1" as an option is described as "deprecated").  So, this PR ensures that "$OPENSSL ciphers" is not passed any protocol version option other than "-tls1" is LibreSSL is being used.
- In OpenSSL 3.0.0-dev, the "$OPENSSL dgst" can no longer be used to compute HMACs, but a new "$OPENSSL mac" function has been created. So, this PR changes hmac() to use "$OPENSSL mac" with OpenSSL 3.0.0-dev.

Note that I have not tested the modified version of sub_session_resumption(). I am just assuming that OpenSSL 3.0.0-dev works the same as OpenSSL 1.1.1 and that all versions of LibreSSL work the same as OpenSSL 1.1.0 and earlier.
2019-11-14 14:24:09 -05:00
Alexander Naumov 966b464802
--html option looks like all others 2019-11-13 21:23:33 +01:00
David Cooper aab7e028c2
Enhance run_protocols() in --ssl-native mode
When tls_sockets() is used for run_protocols(), for each protocol version the results will indicate whether the server responded to a ClientHello for that protocol version with (1) a ServerHello for that same protocol version, (2) a ServerHello for a different (hopefully lower) protocol version, or (3) a handshake failure.

Currently, however, run_prototest_openssl() does not distinguish between cases in which the server responds with a ServerHello for a different (hopefully lower) protocol version and cases in which the server responds with a handshake failure. This PR changes run_prototest_openssl() so that it distinguishes between these two cases (as long as $OPENSSL supports the protocol version specified in the ServerHello).

Making use of the additional information provided by run_prototest_openssl(), this PR also modifies run_protocols() to check that version negotiation was performed correctly even if $using_sockets is false.

Note that one special case needed to be addressed. If an SSLv3-only server is being tested using an $OPENSSL that does not support SSLv3, then $latest_supported must not be set to SSLv3. In the case of a server like this, it is possible that support for SSLv3 will be determined by determine_optimal_sockets_params(), which will cause run_protocols() to report that the server supports SSLv3, even though $OPENSSL does not support SSLv3 and testing is being performed in --ssl-native mode. If $latest_supported were set, then later tests in run_protocols() would incorrectly report a version negotiation failure, even though the failure to connect was a result of a limitation of $OPENSSL rather than a fault of the server.
2019-11-13 10:46:51 -05:00
Dirk Wetter 93169a3123
Merge pull request #1374 from a666/a666-fix-missing-negation
Fix missing negation in check_resolver_bins
2019-11-11 22:00:26 +01:00
a666 1ab48b4a79
Fix missing negation in check_resolver_bins 2019-11-11 14:32:41 -06:00
Dirk Wetter 89dd26e043
Merge pull request #1373 from drwetter/cn+rsolver_fix
Move check_resolver_bins again, handle double CN
2019-11-10 12:55:38 +01:00
Dirk Wetter 90a1455570 Move check_resolver_bins again, handle double CN
When running in debugging mode, HAS_DIG and friends was
still false as check_resolver_bins() was called too late.
This amends basically bac0f66112 .

In cases where a certificate has two CNs, the output contained
a linefeed. This replaces the line feed by a space.
2019-11-10 12:52:12 +01:00
Dirk Wetter 5c39ceafe1
Merge pull request #1369 from dcooper16/run_protocols_ssl_native1
Fix issues with run_protocols() in --ssl-native mode
2019-11-09 19:57:03 +01:00
Dirk Wetter 29a2ecf88f
Merge pull request #1372 from drwetter/resolverbin_earlier
Earlier initialisation of DNS HAS_* related vars
2019-11-09 19:42:14 +01:00
Dirk Wetter bac0f66112
Earlier initialisation of DNS HAS_* related vars
This fixes a bug e.g. when supplying a proxy by a DNS name, testssl couldn't resolve the name as the HAS_ variables initialized by ``check_resolver_bins()`` was done later than ``check_proxy()``.

The patch just puts ``check_resolver_bins()`` earlier in  "main"
2019-11-09 19:41:37 +01:00
David Cooper a7fe481904
Don't ignore first call to $OPENSSL s_client
run_prototest_openssl() currently calls "$OPENSSL s_client" twice, once with $PROXY and once without. The problem is that the results of the first call are just ignored. This commit changes run_prototest_openssl() so that the attempt without $PROXY is only tried if the first attempt was unsuccessful.
2019-11-07 13:12:41 -05:00
David Cooper 8e729d1396
Missing line break
If --ssl-native is being used and the server supports SSLv2, but does not support any SSLv2 ciphers, there is a missing line break after the warning message is printed.
2019-11-07 13:03:42 -05:00
David Cooper c607bf4d92
Check stderr for "no cipher list"
run_prototest_openssl() currently checks only stdout for the string "no cipher list", which is an indication that the server supports SSLv2, but no ciphers for that protocol. However, the output that includes "no cipher list" is sent to stderr.
2019-11-07 13:01:21 -05:00
David Cooper 9d97db85fc
Fix typos in comment 2019-11-07 12:57:58 -05:00
David Cooper 54fad800c0
Fix issue with run_protocols() in --ssl-native mode
This PR fixes a minor problem with run_protocols() in "--ssl-native" mode if $OPENSSL does not support TLS 1.3. Currently, the warning message that $OPENSSL does not support a protocol is printed when run_prototest_openssl() is called. This causes a problem for the output if $OPENSSL does not support TLS 1.3, since the run_prototest_openssl() is called before the results for TLS 1.2 are printed. The result is something like this:

 SSLv2      not offered (OK)
 SSLv3      not offered (OK)
 TLS 1      offered (deprecated)
 TLS 1.1    offered (deprecated)
Local problem: /home/cooper/Desktop/testssl.sh/bin/openssl.Linux.x86_64 doesn't support "s_client -tls1_3"
 TLS 1.2    offered (OK)
 TLS 1.3     NPN/SPDY   not offered
 ALPN/HTTP2 http/1.1 (offered)
2019-11-06 15:58:38 -05:00
Dirk Wetter cd647ba2d0
Merge pull request #1368 from Night1/patch-1
Fix typo
2019-11-06 14:29:08 +01:00
Niklas f3a8884793
Fix typo
Fixed typo
2019-11-06 12:14:16 +01:00
Dirk Wetter ed4bffb5d2
Merge pull request #1367 from dcooper16/fix1366
Fix #1366
2019-11-06 08:55:34 +01:00
David Cooper 7add991156
Fix #1366
When processing a command line for parallel mass testing, create_mass_testing_cmdline() did not account for the newer shortened versions of the output file options: -oj, -oJ, -oC, and -oH. This caused the command line for the child processes to be incorrect.
2019-11-05 16:10:34 -05:00
Dirk Wetter 6679dd7a16
Merge pull request #1365 from drwetter/drwetter-patch-4
remove blank in output
2019-11-03 20:49:36 +01:00
Dirk Wetter 3b89dc6b0a
remove blank in output
added in bda9c02183
2019-11-03 20:49:22 +01:00
Dirk Wetter cbf6422221
Merge pull request #1364 from scottj/3.0
fix bug in f5_ip_oldstyle() printf format string
2019-11-03 09:20:19 +01:00
Scott Johnson f79e5bbaca fix bug in f5_ip_oldstyle() printf format string 2019-11-02 10:34:00 -05:00
Dirk Wetter bda9c02183
Merge pull request #1363 from drwetter/drwetter-patch-3
Marking CBC and SEED ...
2019-11-02 16:03:39 +01:00
Dirk Wetter 47baf7c206
Marking CBC and SEED ...
.. ciphersuites as obsolete in cipher categories
2019-11-02 16:03:24 +01:00
Dirk Wetter 21d41b5f68
Merge pull request #1362 from drwetter/drwetter-patch-2
Amendments + reordering
2019-11-02 10:21:11 +01:00
Dirk Wetter 35f70f2375
Amendments + reordering
add IDN etc. -support and David's work on determine_optimal_* functions
2019-11-02 10:20:57 +01:00
Dirk Wetter e909d4cd8c
Merge pull request #1327 from drwetter/IDN_improvements
Idn improvements
2019-11-02 09:52:52 +01:00
Dirk Wetter 457ffe78cd
Merge pull request #1205 from dcooper16/server_preference_cipher_order
Separate server preference test (cipher order) for TLS 1.3
2019-10-30 08:12:43 +01:00
Dirk Wetter 9a5c8c08d5
Add case in cipher order for TLS != 1.3 2019-10-29 19:03:36 +01:00
Dirk Wetter 2f9bcea5e6
change another nope to no 2019-10-29 17:36:08 +01:00
Dirk Wetter 0f40e85f62
TLS 1.3 and cipher order
If a server offers TLS 1.3 only and the cipher order is server side this commit changes the severity level to INFO.

Also it changes nope to no in two places
2019-10-29 17:32:50 +01:00
David Cooper 2810c70163
Address comments in #1205
This commit addresses the comments in #1205. If a server only supports TLS 1.3, then it is not considered an issue if the server does not enforce a cipher order. However, if the server does not support a cipher order for TLS 1.2 and below, then that is an issue, even if the server does support a cipher order for TLS 1.3.
2019-10-28 16:15:38 -04:00
David Cooper beec1a7e1e Use results of determine_optimal_sockets_params() 2019-10-28 15:02:49 -04:00
David Cooper 3ea1b1b884 WIP: Separate server preference test (cipher order) for TLS 1.3
This PR is an attempt to fix #1163 by running separate tests for a server cipher order preference to TLSv1.3 and for SSLv3 - TLSv1.2.

If the server supports TLSv1.3, then a test is performed to determine whether the server enforces a cipher order to TLSv1.3. A separate test is performed for SSLv3 - TLSv1.2 unless it is known that the server does not support any of these protocols.

If the server enforces a cipher order for SSLv3 - TLSv1.2, but not for TLSv1.3, then cipher_pref_check() is not called for TLSv1.3, since cipher_pref_check() is intended to show the cipher order that the server enforces. As TLSv1.3 will be the negotiated protocol if it is supported, the negotiated cipher for TLSv1.3 will already be presented.

This PR still has one major flaw, which may create a problem when testing a TLSv1.3-only server. If run_protocols() is run before run_server_preference(), then everything will be okay, as run_server_preference() will be able to determine that SSLv3 - TLSv1.2 are not supported. However, if run_server_preference() is run by itself, run_server_preference() will not know that SSLv3 - TLSv1.2 are not supported and so it will try to determine whether the server enforces a cipher preference order for these protocols. The attempt to connect to the server will fail, but at the moment run_server_preference() doesn't know whether the failure is because the server does not support SSLv3 - TLSv1.2 or because the server supports at least one of these protocols, but does not support any ciphers in $list_fwd. At the moment, run_server_preference() incorrectly flags an error.

One option would be to perform additional tests against the server in this case to determine the reason for the connection failure. Another option would be to have some code that is always run earlier, such as determine_optimal_proto(), test whether a server that supports TLSv1.3 supports any earlier protocols (SSLv3 - TLSv1.2).
2019-10-28 15:02:49 -04:00
Dirk Wetter bbd103fe95
Merge pull request #1360 from drwetter/drwetter-patch-1
Remove c&p relict
2019-10-28 18:44:42 +01:00
Dirk Wetter d3e3724d65
Merge pull request #1356 from dcooper16/fix_parse_tls_serverhello_bug
Fix parse_tls_serverhello() bug
2019-10-28 18:41:43 +01:00
Dirk Wetter 326558dec1
Remove c&p relict 2019-10-28 18:36:39 +01:00
Dirk Wetter 9c27a03c30
Merge pull request #1357 from dcooper16/fix_do_starttls_initialization_bug
Fix do_starttls initialization bug
2019-10-28 18:08:01 +01:00
Dirk Wetter 1335d9ebda
Merge pull request #1359 from drwetter/fix_1355
Adress #1355
2019-10-28 18:01:58 +01:00
Dirk Wetter bfb94c8acb Adress #1355
by adding "_hint" to the additional information when
testing for DROWN.
2019-10-28 18:00:10 +01:00
Dirk Wetter 10a6c7b9d2
Merge pull request #1358 from dcooper16/use_jsonID
Use $jsonID rather than literal string
2019-10-28 17:49:16 +01:00
David Cooper 8a0f94f561
Use $jsonID rather than literal string
In run_drown(), $jsonID is set to "DROWN" and most calls to fileout() are of the form

     fileout "$jsonID" ...

However, one call is written as

    fileout "DROWN" ...

This PR changes this one call to be consistent with the others. This does not change the functionality of the program.
2019-10-28 12:43:29 -04:00
David Cooper 42c8769983
Fix do_starttls initialization bug
At the moment, $do_starttls is initialized to true in initialize_globals() and then it is set to true again in parse_cmd_line() if the --starttls command line option is used. Presumably the intention was to set $do_starttls to false in initialize_globals().
2019-10-28 10:15:05 -04:00
David Cooper be073e6134
Fix parse_tls_serverhello() bug
This PR fixes a minor bug in parse_tls_serverhello(). In some cases the server's entire response is not retrieved. In these cases, it is possible that the response from the server ends with a portion of a handshake message.

The loop at the beginning of parse_tls_serverhello() extracts the various handshake and alert messages from the server's response. If it gets to the end of the response, and what is at the end is not a complete message, it should just ignore that fragment and break out of the loop. At the moment, however, parse_tls_serverhello() just continues in the loop rather than breaking out. This has not been a problem up to now, since $msg_len is usually set to a positive value from a previous iteration of the loop, which causes the loop to end.

In the case of the server identified in #1353, however, $msg_len is 0 and so the continue rather than break results in an endless loop.
2019-10-28 10:06:21 -04:00