Commit Graph
100 Commits
Author SHA1 Message Date
Dirk b49399e7c7 Adding LMTP as a STARTTLS protocol
This commit adds LMTP to the STARTTLS protocols
supported. It requires an openssl version which
supports this which is either openssl 1.1.1
or a backported version 1.0.2 (binary is in
process).

A check is in place whetrher the binary supports
this.

Furthermore some framework additions were made for
further STARTTLS protocols like IRC and NNTP.
2018-10-04 11:24:52 +02:00
Dirk WetterandGitHub f40f53938b Merge pull request #1137 from dcooper16/fix_1097
Name check for XMPP servers
2018-10-04 10:32:28 +02:00
Dirk 1b52834dfc Extend workaround for TCP fragmentation
Instead of checking via uname for Linux this commit does a check
whether the outcome for an external printf is what is expected. This
makes it more compatible e.g. with OpenBSD which surprisingly works
similar like the GNU counterpart.

Also it checks all external printfs installed wther it's the
"right one" to use. Previously it stopped just at the first one
and if this was "wrong", bash's printf was used.
2018-10-02 23:04:02 +02:00
Dirk WetterandGitHub b22e0d08fd Merge pull request #1136 from dcooper16/undo_1113
Revert #1113
2018-09-26 13:52:05 +02:00
Dirk db948cd6b5 Make sure length bytes are two chars wide
Linux bash internal printf shortened the string
when using len2twobytes() with 3 chars, FreeBSD
e.g. did not.

It worked under both OS though when piping to
the socket with printf.

This commit makes sure that always 2+2 chars
are returned when a 3 char number is supplied.

Kudos @dcooper16
2018-09-26 13:41:35 +02:00
Dirk e1ee04fbd7 Put temporary workaounrd in place for Linux + TCP fragmentation
This commit basically reverses the previous commit 305eefc for
Linux only. Here the external printf is working fine, where as
the BSDish counterpart is not (see e.g. #1134).

For Linux is basically addresses #1130 / #1113.

A compatible solution for all OS needs to be found.
2018-09-26 09:21:28 +02:00
Dirk 305eefc9e8 Reverse dd3657e temporarily to get a clear picture
See #1134, #1135, also #1132 is a suspect
2018-09-25 16:18:59 +02:00
Dirk d9f0258171 Fix of errorneous return value due to ALPN check
This commit fixes a problem when not every supplied $ALPN_PROTOs
was suported which is probably never the case ;-/

See #1133
2018-09-25 10:54:17 +02:00
Dirk WetterandGitHub 441f14ae90 Merge pull request #1124 from dcooper16/deprecated_curves
Deprecated elliptic curves
2018-09-24 10:30:30 +02:00
Dirk 39822d89e9 Merge branch '2.9dev' of github.com:drwetter/testssl.sh into 2.9dev 2018-09-23 14:16:42 +02:00
Dirk dd3657eb23 Fix TCP fragmentation
As @tomato42 pointed out in #1113 '\x0a' causes the printf buffer
to flush before all data was sent. As a result any '\x0a' in
a ClientHello causes a new TCP fragment.

This commit changes all TCP sockets write to use an external
printf if available which doesn't show this behaviour, see #1130.
It was checked against wireshark.

The external printf was available for Linux, FreeBSD 9 and OpenBSD,
so I do not expect any problems with MacOS X either.

There might be further solutions like 'stdbuf' or 'dd' which
are shown in #1130.
2018-09-23 13:30:46 +02:00
Dirk 11d74d2f6e Remove the cat in get_cipher() and get_protocol()
See #1129
2018-09-22 09:50:15 +02:00
Dirk WetterandGitHub 0727a30456 Merge pull request #1129 from dcooper16/fix_1118
Fix #1118
2018-09-22 09:23:15 +02:00
Dirk WetterandGitHub 7b9a673b6e Merge pull request #1131 from dcooper16/avoid_oa
Avoid unnecessary '0a' characters in ClientHello
2018-09-22 09:21:48 +02:00
Dirk 96a1002f84 Re-adding IP/FQDN + PORT to CSV output
This commit fixes a recently introduced bug, see #1128
2018-09-20 21:43:39 +02:00
Dirk WetterandGitHub ef442f1c1c Merge pull request #1126 from dcooper16/fewer_key_shares
Send fewer key shares
2018-09-19 09:30:28 +02:00
Dirk WetterandGitHub 04dfb66a42 Merge pull request #1125 from dcooper16/fix_grease_findings
Fix run_grease() severity levels
2018-09-19 09:26:33 +02:00
Dirk WetterandGitHub 355ba91b65 Merge pull request #1122 from dcooper16/fix_size_calculation
Fix calculation of ClientHello size
2018-09-17 13:24:40 +02:00
Dirk WetterandGitHub d7e9794062 Merge pull request #1120 from dcooper16/avoid_clienthello_size_bug
Avoid ClientHello size bug
2018-09-17 09:59:23 +02:00
Dirk 9c075469c2 Code readability change to c9b725e 2018-09-16 18:18:43 +02:00
Dirk c9b725e6ff Fix filename expansion in CSV output
This commit fixes #1123 where a security header containing an asterix lead
to a local filename expansion which was included in the CSV file output.
A new function fileout_csv_finding() addresses this.

Also if "$GIVE_HINTS" isn't true the headline and each line in the CSV file doesn't include
anymore the word hint -- which is more consistent with the JSON output.
2018-09-16 18:08:05 +02:00
Dirk 15261b2cf4 Merge branch '2.9dev' of github.com:drwetter/testssl.sh into 2.9dev 2018-09-14 16:34:09 +02:00
Dirk 4722033f40 Accept square brackets in supplied IPv6 address 2018-09-14 16:33:09 +02:00
Dirk WetterandGitHub 23df63ed74 Merge pull request #1113 from dcooper16/clienthello_length_bug
A ClientHello length intolerance bug
2018-09-12 17:30:46 +02:00
Dirk f2303637b9 Minor polishing 2018-09-10 20:09:39 +02:00
Dirk a24a502716 Make JSON more robust
In cases where a finding was empty (error condition), the JSON output
wasn't valid because the finding wasn't printed to file.

This commit makes sure that always a finding is printed,
also if it is empty.

FIX #1112
2018-09-10 18:51:43 +02:00
Dirk 1bfc9ca5b8 Avoid warning for OpenSSL 1.1.1 config file
As #1119 noted, there's a warning for users with an OpenSSL 1.1.1
config file because of #1117 / #1098 .

This commit suppresses the warning on the screen if a config file
from OpenSSL 1.1.1 was detected (kludge from
https://github.com/openssl/openssl/commit/b524b808a1d1ba204dbdcbb42de4e3bddb3472ac).
2018-09-10 17:52:56 +02:00
Dirk 44570541c0 Tell which OpenSSL versions support IPv6 out of the box 2018-09-10 09:52:59 +02:00
Dirk 5de89aedc2 Avoid conflicts of OpenSSL 1.1.1 config file
This addresses a bug where openssl s_client connects hiccuped
because of newer config files which our openssl 1.0.2 couldn't
swallow.

It appeared first on Debian.

FIX #1117

FIX #1098
2018-09-05 16:48:28 +02:00
Dirk a66f5cfdbc curl added for --phone-out checks 2018-09-04 20:20:09 +02:00
Dirk 9a3b6e334b BigIP F5: routed domains
Set routed domains to 3 digits, see also
https://github.com/drwetter/F5-BIGIP-Decoder/issues/1
2018-09-03 13:25:19 +02:00
Dirk 61508b1443 add missing line feed in run_preferences() 2018-09-03 11:10:24 +02:00
Dirk 563dbebffb Added rDNS to file output (CSV+JSON) 2018-09-03 10:45:28 +02:00
Dirk WetterandGitHub a3d8143043 Merge pull request #1109 from dcooper16/shellcheck
Fix some shellcheck issues
2018-08-30 23:07:31 +02:00
Dirk WetterandGitHub c83612d8ec Merge pull request #1110 from dcooper16/certlist_ordering_problem
Fix #1080
2018-08-30 22:03:29 +02:00
Dirk 8d7dd663f9 Finalizing proxy support for OCSP checks
As mentioned in #1106 proxying ocsp protocol doesn't work (yet)
This commit notifies the user that it is not possible. One
can ignore that and try by supplying IGN_OCSP_PROXY=true.

It also fixes a typo I probably introduced (pVULN_THRESHLD).
2018-08-24 15:43:25 +02:00
Dirk 3fdcd034f3 Fine tuning of --outprefix
The standard separator after $FNAME_PREFIX is now '-'.
You can as well supply a different <fname_prefix> ending in '.',  '_' or ',' , then
no no additional '-' will be appended.

Also a small bash function get_last_char() has been introduced which returns
the last char from a supplied string.
2018-08-23 11:40:50 +02:00
Dirk 5da7454e7a Merge branch 'ocsp_crl_final' into 2.9dev
and bump version to 3.0rc1
2018-08-17 12:32:35 +02:00
Dirk ed17797b13 Finalize proxy support for http_get()
... for curl, wget and sockets. Tested and worked.

Furthermore: fd_socket() now is a bit more injection safe as
an echo statement was exchange by printf. For possible future
changes fd_socket now also has and arg1 for the file descriptor.
2018-08-17 12:23:16 +02:00
Dirk 5837e82c85 Supplying of both -6 and --ip=one results in picking an IPv6 address
... previously it depended on the order of DNS replies otherwise. This was
one outcome of discussion in #1026 where it seemed more logical
to pick an IPv6 address as opposed to an abitrary (v4/v6) address.
2018-08-16 12:03:56 +02:00
Dirk efa56a34f2 Fix error introduced from previous commit 2018-08-15 02:15:19 +02:00
Dirk 89f7814f81 Fix #1100: scenarios with -6 and --ip=<ipv6address>
This PR fixes checks where those two cmdline options were supplied
but errorneously also the IPv4 address was tested.

It also lables supplied IPv6 addresses as AAAA records
instead of A records.

Still, determine_ip_addresses() has space for improvements.

Some comparisons fixed strings popped up during debugging were polished
to avoid internal quoting

[[ $VAR == "teststr" ]]

will be otherwise expanded to

[[ $VAR == \t\e\s\t\s\t\r ]]
2018-08-15 01:50:10 +02:00
Dirk 7cc584027c Save work for later -- proxy not working 2018-07-26 22:49:12 +02:00
Dirk WetterandGitHub 94828aed03 Merge pull request #1091 from dcooper16/common_primes_update
Update etc/common-primes.txt
2018-07-26 22:45:36 +02:00
Dirk WetterandGitHub 811c66bb80 Merge pull request #1092 from dcooper16/2048_bit_common_primes
Consider 2048-bit DH primes as acceptable
2018-07-26 21:28:43 +02:00
Dirk WetterandGitHub 093108d297 Merge pull request #1090 from dcooper16/rfc7919_primes
Add RFC 7919 primes to etc/common-primes.txt
2018-07-20 15:29:39 +02:00
Dirk d83aed83fd server banner message polishing if empty 2018-07-19 14:09:19 +02:00
Dirk ee8c70bce3 Minor polish
Typos, cleanup ec_nistp_64_gcc_128 (for 64 bit at least), add -DOPENSSL_TLS_SECURITY_LEVEL=0
2018-07-18 00:57:32 +02:00
Dirk 5f7f392e83 Merge branch '2.9dev' of github.com:drwetter/testssl.sh into 2.9dev 2018-07-17 01:14:35 +02:00
Dirk b6dca77cd2 Merge branch '2.9dev' of github.com:drwetter/testssl.sh into 2.9dev 2018-07-17 00:44:47 +02:00
Dirk 5d5d21af04 Make script for OpenSSL 1.1.1 tree 2018-07-17 00:41:21 +02:00
Dirk 6e5f7c15af Make Travis CI shut up.
A soon-to-be-expired cert can be also HIGH, thus a test
for critical is appropriate.
2018-07-11 17:14:29 +02:00
Dirk c0921c8877 Merge branch '2.9dev' of github.com:drwetter/testssl.sh into 2.9dev 2018-07-11 11:03:52 +02:00
Dirk 61c5e8b96d (Slightly) improved JSON output for certificates
This commit fixes a bug mentioned in #1084 where a server
with multiple host certificates wa missing a certificate
number the the host certificate itself.

It also adds a JSON object for the number of host certificates.
2018-07-11 10:59:05 +02:00
Dirk WetterandGitHub 09182cb196 Merge pull request #1079 from dcooper16/bad_certificate_list
Handle incorrectly populated certificate_list
2018-07-05 09:54:58 +02:00
Dirk WetterandGitHub 488cb03c60 Merge pull request #1078 from dcooper16/stapled_ocsp_revocation_check
Check stapled OCSP response for revocation status
2018-06-28 20:25:46 +02:00
Dirk 4aabc3f999 Merge branch 'skip_offensive' into 2.9dev 2018-06-26 13:10:18 +02:00
Dirk 33cf1d524c Fine tuning if Jac2NL's commit of IDS evasion
Reduce the offensive tests to 4: the others are "just" / mostly cipher
based checks which should not cause an IDS to block. (This maybe
subject to reconsider at a later time.)

Added a switch --ids-friendly

Updated VULN_COUNT accordingly

Added this (including PHONE_OUT to env debugging output)

Added help()

Manual section added
2018-06-26 13:04:30 +02:00
Dirk 01f177199c Merge branch 'Jac2NL-2.9dev' into skip_offensive 2018-06-26 12:36:01 +02:00
Dirk 3ce22ed8df Merge branch '2.9dev' of https://github.com/Jac2NL/testssl.sh into Jac2NL-2.9dev 2018-06-26 12:35:29 +02:00
Dirk 87f0cda234 Fix #1071 : typos and link in docu 2018-06-25 18:31:55 +02:00
Dirk WetterandGitHub 0355145576 Merge pull request #1074 from dcooper16/fix615
Fix #615
2018-06-22 14:18:23 +02:00
Dirk aa0f33e984 Update RFC section in ~/doc with soon to be TLS 1.3 RFC
See PR #1072, title taken from
https://github.com/ietf/draft-ietf-tls-tls13/blob/master/rfc8446.xml
(maybe subject to change).

Todo: Handle the obsolted ones, maybe by adding "obsolete"
2018-06-20 09:41:51 +02:00
Dirk WetterandGitHub 8e144e8e6f Merge pull request #1072 from dcooper16/rfc8446
TLS 1.3 will be RFC 8446
2018-06-20 09:25:10 +02:00
Dirk f2944205b9 Fix output error when $HEADERFILE was empty 2018-06-19 10:27:42 +02:00
Dirk d23241b8cd Fix to-be-expired-soon certificate
The certificate from self-signed.badssl.com was about to expire
which raises a MEDIUM type issue in testssl.

This commit does a workaround for this, so that those certificates
will be ok in Travis CI.

(Same problem exists in 2.9.5)
2018-06-13 14:30:35 +02:00
Dirk b6cc01a558 Fix line feeds in vulnerabilty output when running in wide mode
This commit is a FIX for #1069, thus when running in
wide mode it corrects an additional line feed which
happened sometimes.

As @dcooper16 pointed out it also cleans up the needless
if-statements in run_rc4(), run_lucky13() and run_beast().

It also inserts for wide mode lines a blank so the alignment
is not at the left border anymore (check for leftovers
needed).
2018-06-13 13:25:02 +02:00
Dirk WetterandGitHub 1be25f9cf7 Merge pull request #1067 from dcooper16/revocation_checking_errors
Fix false "revoked" results for CRL and OCSP checking
2018-06-05 10:33:42 +02:00
Dirk WetterandGitHub 626e0fc65a Merge pull request #1066 from dcooper16/ocsp_error_responses
OCSP error handling
2018-05-25 22:28:05 +02:00
Dirk c21ed3212e add a small hint how to use the tuning vars 2018-05-24 13:09:56 +02:00
Dirk 770f3ea832 fix typo in cmd line arg for -oA 2018-05-24 10:48:25 +02:00
Dirk WetterandGitHub ec57b64339 Merge pull request #1064 from dcooper16/ocsp_checking
OCSP improvements
2018-05-23 22:38:50 +02:00
Dirk f426a3bb21 Merge branch 'crl_ocsp' into 2.9dev
OCSP revocation checks ran with a 100% success rate for the Alexa ~Top 1000
(basis: all hosts supporting TLS and having an OCSP URI)
2018-05-23 15:09:03 +02:00
Dirk WetterandGitHub d578adb05c Merge pull request #1062 from dcooper16/certificate_validity_dates
Fix extraction of certificate validity dates
2018-05-23 10:51:29 +02:00
Dirk 92eaa3e7d3 Merge #1047 before processing #1051 2018-05-18 22:39:19 +02:00
Dirk WetterandGitHub 31b26da691 Merge pull request #1060 from dcooper16/multicomponent_ocsp_uris
HTTP URLs with multiple components in path
2018-05-18 21:40:56 +02:00
Dirk 7d36734a96 Handle host header in OCSP request properly
My previous commit added a host header but didn't properly
format the host header (trailing slashes / path). This commit
corrects that so that the 305 times HTTP 400 in #1056
should now be gone (TBC), including Google CA responders.

One issue which needs to be addressed (same as in CRL
revocation checks): Not trusted certificates (zhanqi.tv,
taken from my Alexa scans) fail for obvious reasons.
2018-05-18 20:30:37 +02:00
Dirk 82aae158ba Minor additions to OCSP revocation check
Error from OCSP responder is now being displayed (and logged to JSON, ...)

Whole replay is kept in $tmpfile for debugging purposes

JSON output added for OCSP responderi query failures

Furtermore wget was replaced by "type -p" and grep by fgrep.
2018-05-16 19:52:10 +02:00
Dirk fac65d82b0 Add host header to OCSP Request
Some OCSP responder seems to need a host header, see e.g.
https://blog.ivanristic.com/2014/02/checking-ocsp-revocation-using-openssl.html .

This commit adds this header.

It addresses not all errors though. E.g. "https://testssl.sh" is fine now,
"https://google.com" still returns "Code=400,Reason=Bad Request" which
needs further investigation,

Also this commit gives a warning if the OCSP request fails (fileout needs
to be added)
2018-05-16 15:51:45 +02:00
Dirk WetterandGitHub 567cc05fca Merge pull request #1055 from dcooper16/ocsp_checking
Add OCSP checking
2018-05-16 11:11:00 +02:00
Dirk WetterandGitHub e68b1ce025 Merge pull request #1054 from dcooper16/fix1053
Fix #1053
2018-05-15 17:54:09 +02:00
Dirk WetterandGitHub be743e0c9b Merge pull request #1052 from dcooper16/draft28
TLS 1.3 draft 28
2018-05-07 10:58:49 +02:00
Dirk WetterandGitHub a787ba0ec5 Merge pull request #1048 from dcooper16/ldap_get_failure
ldap_get() should fail if curl fails
2018-05-07 10:55:54 +02:00
Dirk WetterandGitHub b6c527598b Merge pull request #1049 from dcooper16/dont_offer_compression
Don't offer TLS compression by default
2018-05-02 11:08:51 +02:00
Dirk WetterandGitHub 4b39039209 Merge pull request #1050 from dcooper16/remove_extra_space
Remove extra space in BEAST output
2018-05-02 11:00:01 +02:00
Dirk 470f8b62e6 jsonID HTTP status code as variable 2018-04-28 22:38:53 +02:00
Dirk 168eec447a Merge branch 'crl_ocsp' into 2.9dev 2018-04-28 22:36:27 +02:00
Dirk 0851599a4e Polish existing CRL revocation check code
* Extra function for ldap_get()
  * Hint when curl is not installed and LDAP URI is encountered
  * Rename jsonID cert_cRLDistributionPoints to cert_crlDistributionPoints
  * Fix trailing _ in jsonID

Open/to be clarified:

   * Proxy for curl / proxy needs to come from testssl.sh
   * Proxy support for HTTP bash socket GET
   * cert_CRLrevoked comes before cert_cRLDistributionPoints
   * Unit tests

Still open: OCSP
2018-04-28 22:25:43 +02:00
Dirk 5ff9fe0f0d Merge branch 'dcooper16-ldap_urls' into crl_ocsp 2018-04-27 21:49:00 +02:00
Dirk c3927d00c8 Document --phone-out 2018-04-27 21:37:44 +02:00
Dirk WetterandGitHub da49603c46 Merge pull request #1042 from dcooper16/non_http_crldp
non-HTTP cRLDistributionPoints
2018-04-26 17:08:32 +02:00
Dirk WetterandGitHub 6d919de0ad Merge pull request #1043 from dcooper16/expired_certs
Don't check expired certificates
2018-04-26 16:51:20 +02:00
Dirk ddf5ff6bc9 Minor additions wrt --color=3 and fname prefix 2018-04-26 09:39:30 +02:00
Dirk WetterandGitHub af2f6dd353 Merge pull request #1041 from dcooper16/server_preference_list
Update ciphers for server preference
2018-04-25 23:09:30 +02:00
Dirk c4f42fd6c7 Experimental support for certificate check via CRL
In order to use it one has to use --phone-out  (PHONE_OUT
is the respective ENV) like

``./testssl.sh --phone-out --json-pretty -S wikipedia.org``

This makes use of curl (if available) or wget (if available) and
falls back to bash socket GET. The latter uses HTTP/1.0 as
chunked transfers by the server (used for bigger files normally)
can't be reasonably separated from their HTTP header. (HTTP/1.0
doesn't support chunked transfers).

curl and wget use the enviroment variables automatically. Probably
we want to use those proxies only if told by a switch to testssl.sh.

"-crl_download" would have been an option. Support would have
been needed to check beforehand. Alos information on proper
usage seems limited, so for now a solution which works is
preferred.

Open/to be clarified:

  * Documentation
  * Proxy for curl / proxy needs to come from testssl.sh
  * Proxy support for HTTP bash socket GET
  * JSON ID is cert_CRLrevoked_ (trailing underscore)
  * cert_CRLrevoked_ comes before cert_cRLDistributionPoints
  (* reconsider naming of cert_cRLDistributionPoints)
  * Unit tests

Still open: OCSP
2018-04-25 22:34:47 +02:00
Dirk e84d0cf170 First prototype of CRL checker
As it would be a possible privacy violation a new flag PHONE_OUTSIDE
is introduced (later accompanied by a switch). It determines whether
the client is allowed to retrieve the CRL specified (HTTP only supported).

Tested ok against wikipedia.de and revoked.badssl.com.

To do:
  * look into -crl_download
  * fileout
 * Unit tests

OCSP verification
2018-04-24 17:52:01 +02:00
Dirk WetterandGitHub 90b671fbb3 Merge pull request #1040 from dcooper16/fix_typo
Fix typo
2018-04-23 21:37:13 +02:00
Dirk WetterandGitHub 1a03e31a7d Merge pull request #1039 from dcooper16/csv_json_mass_testing
JSON and CSV output problem with mass testing
2018-04-23 18:19:47 +02:00
Dirk 8149c2d5cf CCS injection: better handling of TLS alert protocols
In certain situations while testting for CCS injection it could have happened
that an error code was sent which was not interpreted properly by testssl.sh.
(https://tools.ietf.org/html/rfc5246#section-7.2)

This has now been fixed and thus addresses #906. Also it has been made sure
that other error codes are reported appropiately.

The case where this test failed before was a non-patched Ubuntu 12.04
with openssl/postfix on port 25.
2018-04-20 11:31:05 +02:00
Dirk 39647d1703 Shellcheck, bump version to 3.0beta
For the upcoming release this commit initiated the beta phase: important features
will be allowed. On the agenda is otherwise to fix bugs.

I ran shellcheck (see #434), and fixed some complaints and adjusted some coding
style mismatches.
2018-04-19 17:57:52 +02:00