Commit Graph

3921 Commits

Author SHA1 Message Date
David Cooper cea570836f
Check for pkey support
Similar to the recently added HAS_PKUTIL (f829878a43), this PR adds HAS_PKEY, which indicates whether OpenSSL has the pkey utility. HAS_PKEY is then checked before attempting to do something that requires the pkey utility.
2017-12-13 11:01:58 -05:00
Dirk 69956016b3 CVEs from https://robotattack.org/ added (in JSON) 2017-12-13 13:21:17 +01:00
Dirk Wetter fe7feda228
Merge pull request #932 from dcooper16/reduce_file_ops
Reduce use of temporary files
2017-12-12 19:41:39 +01:00
Dirk 5978d37c74 Merge branch '2.9dev' of github.com:drwetter/testssl.sh into 2.9dev 2017-12-12 19:41:07 +01:00
Dirk f829878a43 Introduce property global HAS_PKUTIL 2017-12-12 19:37:33 +01:00
David Cooper 274d8a8b3a
Reduce use of temporary files
This PR reduces testssl.sh's use of temporary files by making greater use of pipes. This results in a very slight performance improvement.
2017-12-12 11:51:15 -05:00
Dirk Wetter 97b7f9c923
Merge pull request #931 from dcooper16/correct_title
Correct comment
2017-12-12 16:41:09 +01:00
David Cooper 4a209cceb4
Correct comment
The comment at the beginning of the run_robot() function uses the wrong title for the paper. This PR fixes the title and adds a URL.
2017-12-12 10:25:44 -05:00
Dirk Wetter 8f597f7077
Merge pull request #930 from dcooper16/Bleichenbacher
Test for vulnerability to Bleichenbacher attack
2017-12-12 15:58:24 +01:00
David Cooper 5de873f8bc Test for vulnerability to Bleichenbacher attack
This PR adds a test to check whether a server that supports ciphers suites that use RSA key transport (TLS_RSA) are vulnerable to Bleichenbacher attacks (see http://archiv.infsec.ethz.ch/education/fs08/secsem/bleichenbacher98.pdf).
2017-12-12 09:51:48 -05:00
Dirk Wetter 7e62dc3192
Merge pull request #925 from seccubus/json_footer_breaks_json
JSOn output is broken by the JSON footer in combination with mass mode
2017-12-07 09:59:58 +01:00
Frank Breedijk 393e4fb920 JSON output fixed in `--parallel` too 2017-12-06 21:54:59 +01:00
Frank Breedijk 3eb402a3d5 JSOn output is broken by the JSON footer in combination with mass mode 2017-12-06 16:10:53 +01:00
Dirk 2a0a0475ab Fix for POP3, Robustness for STARTTLS
POP3 STARTTLS handshakes were often unsuccessful as
a regex wasn't properly escaped.

Furthermore if a STARTTLS handshake doesn't succeed, there's
a warning now.
2017-12-06 12:24:26 +01:00
Dirk 9e1ed1c9cf Add check for -oA in nma greppable output 2017-12-06 10:23:24 +01:00
Dirk f92d3988af Better consistency (cipher coloring)
Especially for yellow=low the key exchange is considered
to be equal now. That needs to be subject to reconsideration.
2017-12-04 21:53:39 +01:00
Dirk Wetter cf89488ab9
Merge pull request #905 from dcooper16/color_all_ciphers
Color all ciphers
2017-12-04 21:12:01 +01:00
Dirk 7f6ff5db3b Sloppy try to address in the worst cases of wrong coloring of ciphers
See pending PR #905 / issue #333.

There's still lots of work needed and probably the function
needs to be completely rewritten and to be in sync with
other parts of the program.
2017-12-04 21:06:47 +01:00
Dirk 0c779d1684 proper indentation of "client-based" in service detection
Also correct "based" to "-based" (Marriam-Webster + Oxford Dict.)
where appropriate.
2017-12-04 17:14:06 +01:00
Dirk 721ca1e45c Fix regression in HTTP header
This PR fixes one odd formatting of header flags like X-Frame-Options,
where the output header maybe contained a LF "\r". X-XSS-Protection was
also not correctly formatted due to the fact that only a part of it until
the blank was displayed.

Also the file output may contain now 1x less blank, e.g.

"X-Content-Type-Options: nosniff" instead of
"X-Content-Type-Options:  nosniff"
2017-12-04 15:47:45 +01:00
David Cooper 853b8333e3 Color all ciphers
This PR adds an additional COLOR level (3). If color is set to 3 then all ciphers are printed according to pr_cipher_quality() rather than just the "Negotiated cipher" in run_server_preference().
2017-12-04 09:18:27 -05:00
Dirk Wetter 868e872dc6
Merge pull request #913 from dcooper16/reduce_alert_processing
Reducing processing of alert messages
2017-12-04 14:33:29 +01:00
Dirk Wetter e516ba1b9d
Update ISSUE_TEMPLATE.md 2017-12-04 14:04:41 +01:00
Dirk 4aec5664d5 introducing sentence added 2017-12-04 13:59:12 +01:00
Dirk Wetter a9e1ca4440
Delete .issue_template 2017-12-04 13:55:52 +01:00
Dirk 3150cfed0e new issue template 2017-12-04 13:54:55 +01:00
Dirk Wetter 374fb2a85c
Create .issue_template 2017-12-04 13:48:37 +01:00
David Cooper b6a022d84f Reducing processing of alert messages
This PR reduces the amount of work parse_tls_serverhello() does when processing alert messages when not in debug mode. It delays writing anything to $TMPFILE unless $DEGUG -ge 1 until it has reason to believe that the response was successful. If $DEBUG is 0 and alert messages are sent, then no file operations are performed processing the alert messages.

In almost every case, there is no attempt to look at the contents of $TEMPDIR/$NODEIP.parse_tls_serverhello.txt unless the connection was successful. So, in most cases, it is okay to not call tmpfile_handle() in parse_tls_serverhello() unless the connection was successful. There is, however. one place in run_grease() where the code reads the contents of $TEMPDIR/$NODEIP.parse_tls_serverhello.txt even if the connection was not successful. In order to address this, the DEBUG level is temporarily set to 1 when performing this test if its value is 0. Also in order to address this, changes were made in parse_tls_serverhello() to ensure that "tmpfile_handle $FUNCNAME.txt" is always called before returning if $DEBUG -ge 1.
2017-12-01 15:45:36 -05:00
Dirk 62f925a1bc Merge branch '2.9dev' of github.com:drwetter/testssl.sh into 2.9dev 2017-12-01 21:21:22 +01:00
Dirk Wetter 137f2fa3c3
Merge pull request #920 from dcooper16/client_auth_and_assume_http
HTTP-related checks and certificate based client authentication
2017-12-01 21:19:23 +01:00
Dirk Wetter 9c8fa5419d
Merge pull request #917 from dcooper16/check_version
Compare selected version against supported_versions
2017-12-01 21:03:52 +01:00
Dirk dda07cd1d0 commenting #918 2017-12-01 21:02:03 +01:00
Dirk Wetter 4be759afea
Merge pull request #918 from sdann/mysql_read_timeout
Reduce read timeout for MySQL back to 1 second
2017-12-01 20:54:37 +01:00
Dirk 99d12434dd fix strip_*_space() 2017-12-01 20:09:16 +01:00
David Cooper 1ba4b395ff
HTTP-related checks and certificate based client authentication
If certificate-based client authentication is required by the server, then most HTTP-related checks are skipped, even if the "--assume-http" flag is used. If $CLIENT_AUTH is true, then $ASSUME_HTTP is ignored.

In some cases the checks are appropriately skipped, since the tests cannot be performed. In other places, the value of "$CLIENT_AUTH" is used as a hint as to whether HTTP is being used. For example, in run_tickbleed:

     if [[ "$SERVICE" != HTTP ]] && ! "$CLIENT_AUTH"; then
          outln "--   (applicable only for HTTPS)"
          fileout "ticketbleed" "INFO" "Ticketbleed: not applicable, not HTTP" "$cve" "$cwe"
          return 0
     fi

There are some places, however, where tests are just skipped, even if both $CLIENT_AUTH and $ASSUME_HTTP are true, even though the test could be performed. For example, run_client_simulation() only simulates generic clients in this case.

This PR attempts to address this:
* In run_client_simulation() it runs all of the tests if $ASSUME_HTTP is true.
* In certificate_transparency() it only says that the lack of CT information is "N/A" it can verify that HTTP is not being used (if $SERVICE is not HTTP and $CLIENT_AUTH is false). Otherwise it just says "no" without flagging it as an issue.
* In certificate_info() it displays additional warnings (about use of SHA-1 or subjectAltName matching) only if it can verify that HTTP is being used ($SERVICE is HTTP or $ASSUME_HTTP is true).
* In run_crime(), if compression is used, it only says " but not using HTTP" if it can verify that HTTP is not being used (if $SERVICE is not HTTP and $CLIENT_AUTH is false).
2017-12-01 10:58:06 -05:00
David Cooper 76c75ae8f9 Replace external calls with Bash functions 2017-12-01 10:31:30 -05:00
David Cooper 74c1a6bcb3 Compare selected version against supported_versions
If a supported_versions extension was included in the ClientHello, then check that the version returned by the server was included in the ClientHello's supported_versions extension.

OpenSSL will respond to a TLSv1.3 ClientHello that only specifies 0304 in its supported_versions extension with a ServerHello that specifies whatever draft of TLSv1.3 it currently supports (e.g., 7F16). The result is that run_protocols() incorrectly reports that OpenSSL supports TLSv1.3 "final" in addition to whatever draft version it supports.

This PR fixes that problem by treating it as a failed connection when the ClientHello offers only 0304 and the ServerHello specifies something else (e.g., 7F16).

Performing this check is actually a requirement for clients in Section 4.2.1 of draft-ietf-tls-tls13-22. So, including this check will also help make client simulations more accurate when clients that support TLSv1.3 are added to client-simulation.txt.
2017-12-01 10:31:29 -05:00
Dirk 851030ea8f Fixes in headers
- double word match: Content-Security-Policy matched also X-Content-Security-Policy
- X-UA-Compatible always appeared twice
2017-12-01 13:31:43 +01:00
Steven Danneman 2fb7e45799 Reduce read timeout for MySQL back to 1 second
The default STARTTLS_SLEEP timeout was increased to 10 seconds in
d1e7498. This caused MySQL connections to timeout. Quick fix is to
parameterize the timeout and pass in 1 again.

Better future fix is to read MySQL as binary packets, parsing the fixed
sized header, to then read the variable sized payload. Doing this will
also greatly speed up testing.

This fixes issue #914.
2017-11-30 15:10:47 -08:00
Dirk 1b7e6630d7 Extending OPTIMAL_PROTO tests with TLS 1.3
It partly addresses #915, supposedly the openssl binary used supports
TLS 1.3 (and the correct draft/final).

It also reduces handshakes by not trying protocols which aren't supported
on the client side.
2017-11-30 16:07:51 +01:00
Dirk Wetter f9d8d4df7b
Merge pull request #912 from dcooper16/draft22
Support TLSv1.3 draft 22
2017-11-30 09:55:16 +01:00
David Cooper fee2f68a64
Support TLSv1.3 draft 22
This PR adds support for TLSv1.3 draft 22. This PR has testssl.sh operate in "middlebox compatibility mode" as described in Appendix D.4 of draft-ietf-tls-tls13-22 to maximize the chances of being able to perform a successful test even if there is a misbehaving middlebox between testssl.sh and the server being tested. Support for drafts 18 through 21 is still maintained.

This PR has been tested against a few different implementations of draft 22 that were made available shortly before draft 22 was posted.
2017-11-29 14:47:22 -05:00
Dirk Wetter affc9d6bb6
Merge pull request #909 from dcooper16/remove_extra_spaces
Remove extra spaces
2017-11-29 19:39:54 +01:00
Dirk Wetter 34f4a8cb4f
Merge pull request #910 from dcooper16/hrr_socket
Don't open new socket for second ClientHello
2017-11-29 19:39:15 +01:00
David Cooper 77b5a58b2d Remove extra spaces
This PR just removes some extra spaces in the printing of TLS extensions in parse_tls_serverhello().
2017-11-29 09:15:01 -05:00
David Cooper 0a6e88041c Don't open new socket for second ClientHello
In TLSv1.3, when responding to a HelloRetryRequest, the second ClientHello should be sent through the same socket as the first ClientHello.

This PR adds an option to socksend_tls_clienthello() to not open a socket and then uses that option in resend_if_hello_retry_request() when sending the second ClientHello.
2017-11-29 09:14:16 -05:00
Dirk f61b701f5a recognise TLS alert as a sign that SSLv2 is not supported
Revert the exception from previous commit 20b38d5aa6
that TLS alerts on SSLv2 client hello won't be a proper reply -- due to a reality check,
see #908.

In order to have better debugging info the TLS alert message is printed
in clear. Messages code and text assignements was moveed to a separate
function.
2017-11-29 11:43:35 +01:00
Dirk ece1d868c4 change wording and color for not valid SSLv2 server hello 2017-11-28 10:03:49 +01:00
Dirk 20b38d5aa6 Make SSLv2 parsing more robust 2017-11-27 21:55:17 +01:00
Dirk Wetter 0633ca595d
Merge pull request #904 from dcooper16/negotiated_proto_and_cipher
Add TLSv1.3 support for negotiated protocol and cipher
2017-11-27 12:42:29 +01:00