Commit Graph
100 Commits
Author SHA1 Message Date
Dirk Wetter 4f1da9b192 Trying to address some of the domain issues for MTA-STS
There are checks now whether testssl.sh was started with --max and
whether we aim at a target which is an MX record. It has not been
thoutoughly tested but works for a couple of scenarios. There were
cases being identififed where this fails, see comments in the code.

Also this commit addresses an error in the URL handling: for
DNS queries a trailing dot is fine in the variable $NODE. For
HTTP queries it is not.
2021-01-13 11:23:36 +01:00
Dirk Wetter d96cfddf9b Add better mta_sts_record / mts-sts policy validation
Fix temp diretoty for debugging
2021-01-12 17:44:12 +01:00
Dirk Wetter 43b05b082c Added fileout, raw good/bad/info checks 2021-01-06 14:12:12 +01:00
Dirk Wetter b7cd397c98 Add MTA-STS as a PoC
This commit adds a first PoC implementation of MTA-STS (RFC 8461), see also
issue #1646.

What works:
- test a hostname which is equal to a MX record and a domainname and has
  a MTS-STS setup (dev.testssl.sh)
- check _mta-sts TXT record + https://mta-sts.$NODE/.well-known/mta-sts.txt
- check also _smtp._tls TXT record
- screen output

What doesn't work
- test a hostname which is not equal to domainname
- test a hostname which has not mx record
- fileout put
- any parsing of TXT record + .well-known/mta-sts.txt
- when no TXT records or .well-known/mta-sts.txt are there
- fileoutput
- colored screen output

There's a stub function for DANE.

There are also two stub functions splitting HTTP body from HTTP header
which I couldn't get to work and will be removed later.

Besides to avoid confusion it changes from all GET requests over HTTPS tm_out
to safe_echo. It's actually exactly the same only the name is different.
2021-01-05 22:05:54 +01:00
Dirk WetterandGitHub a9f4bb5fb5 Merge pull request #1810 from drwetter/starttls_injection
STARTTLS injection
2020-12-29 14:40:58 +01:00
Dirk WetterandGitHub e1a43e6e16 Merge branch '3.1dev' into starttls_injection 2020-12-29 13:46:18 +01:00
Dirk Wetter 7c66535628 resolve merge conflict 2020-12-29 13:44:04 +01:00
Dirk WetterandGitHub ffe223f6e6 Merge pull request #1807 from tosticated/custom_http_headers
Custom HTTP request headers support added. Addresses #1770
2020-12-26 12:13:59 +01:00
Dirk WetterandGitHub 2682d032b8 Merge pull request #1801 from drwetter/tmpfix_order_idsfriendly+U
Fix order for -U and --ids-friendly
2020-12-12 12:03:22 +01:00
Dirk Wetter 39132fe3d0 Fix order for -U and --ids-friendly
Workaround for bug see #1717. In addition: Bring  the test closer to a cleaner style,
as the others

Should --ids-firednly could be as well be removed when travis runs faster.
2020-12-11 20:49:15 +01:00
Dirk WetterandGitHub 4f375de26c Merge pull request #1799 from PeterDaveHello/RefactorDockerfileApkUsage
Refactor `apk` usage in Dockerfile
2020-12-09 09:17:00 +01:00
Dirk WetterandGitHub 2cb96d4e9e Merge pull request #1798 from drwetter/client_always_wide
Client simulation per default as wide
2020-12-08 23:23:55 +01:00
Dirk Wetter d76829cd28 wide mode for client simulation 2020-12-08 19:52:42 +01:00
Dirk Wetter e7fa4ff4ce Client simulation per default as wide
... in order to be consistent with run_server_preference().

The wide formatting of other tests need some inspection and
off the top off my head are not as perfectly formatted so that
they should not run per default in wide mode.
2020-12-08 19:43:07 +01:00
Dirk WetterandGitHub f6e2a5c381 Merge pull request #1797 from atroost/hex2curves
Hex2curves
2020-12-03 12:44:21 +01:00
Dirk WetterandGitHub ea6d99fe93 Merge pull request #1795 from drwetter/no_code_update
Trying to save resources for poor Travis/CI ;-)
2020-11-28 10:08:53 +01:00
Dirk WetterandGitHub a780ad6174 fix '|" 2020-11-27 20:24:46 +01:00
Dirk Wetter 1cd5510955 Trying to save resources for poor Travis/CI ;-)
See https://github.com/google/EarlGrey/pull/383/files/3b38a5dea36a88aba42a42931e77a7c5429a1837
2020-11-27 18:10:43 +01:00
Dirk WetterandGitHub 19494a6d8b Merge pull request #1794 from drwetter/drwetter-patch-1
Minor changes to Readme Dockerfile again
2020-11-27 17:05:22 +01:00
Dirk WetterandGitHub c88d22a0f0 Update Dockerfile.md 2020-11-27 17:05:03 +01:00
Dirk WetterandGitHub 2655e91255 Update Readme.md 2020-11-27 17:00:34 +01:00
Dirk WetterandGitHub 20c57289d1 Merge pull request #1792 from drwetter/docker_docu_polish
Consolidate docker sections in Readme.md and Dockerfile.md
2020-11-27 16:35:03 +01:00
Dirk Wetter 1a7e4f1e92 consolidate docker sections in Readme.md and Dockerfile.md
see #1791
2020-11-27 16:33:23 +01:00
Dirk WetterandGitHub 849c031597 Merge pull request #1789 from drwetter/skip_sometunittests
Trying to reduced the runtime of travis
2020-11-27 15:24:06 +01:00
Dirk Wetter 96d4b4f08b Trying to reduced the runtime of travis
Often in the past travis was hitting a limit (50min?).

This is a try to make reasonable cuts to the unit tests:
- For STARTTLS some checks with OPenSSL are skipped
- For JSON and HTML outputs --ids-friendly was added assumming we
  don't change the output of ticketbleed, CCSI, HeartBleed and ROBOT any more.
- There's also not point to run those checks against badssl
- for  the diff check we switch to 'or diag' to display a dfifference
2020-11-27 13:19:52 +01:00
Dirk WetterandGitHub a5d93486ad Merge pull request #1788 from drwetter/diff_unittest
Diff unittest
2020-11-26 20:04:22 +01:00
Dirk 665209bf60 typos 2020-11-26 16:27:40 +01:00
Dirk 1b63760bc3 Add baseline master file for testssl.sh 2020-11-26 16:05:08 +01:00
Dirk WetterandGitHub 9aafc452d8 Merge pull request #1787 from drwetter/unittest_reorder
Unittest reorder
2020-11-26 16:04:02 +01:00
Dirk a98ede0720 Finalize first diff check for travis 2020-11-26 15:58:13 +01:00
Dirk 49d321cfbb Add "command not found" 2020-11-26 13:41:44 +01:00
Dirk 191efddaee document changes from previous commits 2020-11-26 13:07:49 +01:00
Dirk 0c20b21fc2 Better order, "command not found added" 2020-11-26 13:02:10 +01:00
Dirk Wetter 9ea7446203 Add STARTTLS injection to Changelog 2020-11-26 10:48:32 +01:00
Dirk Wetter 5c5c4dcd58 Merge branch '3.1dev' into starttls_smtp_injection
Resolving conflicts because of do_winshock
2020-11-26 10:45:02 +01:00
Dirk WetterandGitHub cc40d2f559 Merge pull request #1786 from drwetter/new-templates
Update issue templates
2020-11-25 21:19:48 +01:00
Dirk WetterandGitHub b47bc9e871 Update bug_report.md 2020-11-25 21:19:26 +01:00
Dirk WetterandGitHub cab2ee7706 Update bug_report.md 2020-11-25 21:13:44 +01:00
Dirk WetterandGitHub 0ed7ede6de Update other-issues---question.md 2020-11-25 21:12:47 +01:00
Dirk 9ee939397e Merge remote-tracking branch 'origin/template_update' into new-templates 2020-11-25 21:11:18 +01:00
Dirk WetterandGitHub d1481616db Update issue templates
Use the new style suggested bu github
2020-11-25 21:07:54 +01:00
Dirk Wetter 4a62b365a9 remove old universal template 2020-11-25 20:12:00 +01:00
Dirk WetterandGitHub 21d0910b50 Merge pull request #1781 from drwetter/fix_1779_3.1dev
Fix reading SSLv2 socket
2020-11-24 21:58:05 +01:00
Dirk 3a15383273 Fix reading SSLv2 socket
This fixes #1779. There was a problem introduced in
3cd1273439 which counted
the size of the file name rather than the size of the
socket reply.

The helper function count_chars() is now not used anymore.
It maybe useful in the future though.
2020-11-20 11:23:20 +01:00
Dirk WetterandGitHub ac99fbe078 Merge pull request #1773 from drwetter/ca-update
Update certificate stores
2020-11-14 11:11:10 +01:00
Dirk WetterandGitHub 2c4799e154 Merge pull request #1518 from dcooper16/html_colors
Make colors in HTML output more accessible
2020-11-14 11:10:47 +01:00
Dirk Wetter ce802634b6 Update remaining: Apple / Java / Microsoft
* also ca_hashes.txt

* Used Java SDK 15 instead of JRE 8
* Used Windows 20H2
* Java Keystore has added 5 certificates (90 --> 95)

Updated Readme and make it more reproducible
2020-11-13 22:01:17 +01:00
Dirk WetterandGitHub a019b3d396 --overwrite / X-XSS-Protection 2020-11-13 19:26:47 +01:00
Dirk WetterandGitHub 2098ea33c5 Merge pull request #1777 from drwetter/feature_overwrite
Introducing --overwrite option
2020-11-13 18:59:03 +01:00
Dirk Wetter 9d0744e229 Introducing --overwrite option
Sometimes it is needed to overwrite existing output files.
This has been requested in the past (#927). For safety reasons
it was not implemented.

However I realized that it could be useful. It requires some
responsible usage though.

Code added, help() and manpages added -- warnings added too.
2020-11-13 16:05:53 +01:00
Dirk Wetter 33ea2c710c updated Linux.pem + Mozilla.pem 2020-11-11 18:15:56 +01:00
Dirk WetterandGitHub 65586311f6 Merge pull request #1769 from drwetter/fix_1768
Fix perl style variable in starttls_full_read()
2020-11-05 14:07:42 +01:00
Dirk Wetter 19219dca2e Fix perl style variable in starttls_full_read()
This fixes #1768
2020-11-05 11:47:53 +01:00
Dirk WetterandGitHub b0c1f99923 Merge pull request #1766 from keisentraut/fix-gitignore-ignore-html-scan-results
.gitignore: ignore HTML scan results like example.com_p443-20201103-1…
2020-11-03 20:35:46 +01:00
Dirk WetterandGitHub 498dc80885 Merge pull request #1765 from drwetter/http_header_color
Remove lite cyan color for http header
2020-11-03 08:51:35 +01:00
Dirk 12bf2987a2 Remove lite cyan color for http header
While we are not sure yet how we deal with "other" colors and different
backgrounds users can have, I'll remove the light cyan here until we
settle on a standard. (other=not yellow,reds,brown,greens)
2020-11-03 08:44:40 +01:00
Dirk WetterandGitHub 8d812f5dc0 Merge pull request #1764 from keisentraut/fix-1762
fix #1762: Stop labeling X-XSS-Protection as green
2020-11-02 21:46:51 +01:00
Dirk WetterandGitHub e3cd36a63b Merge pull request #1760 from keisentraut/fix-1757
fix #1757: manpage: --c has one dash to much
2020-10-29 20:27:19 +01:00
Dirk WetterandGitHub 084a29409d Merge pull request #1758 from drwetter/fix_1754
Fix run_freak() when sslv2 server hello is empty
2020-10-28 11:43:30 +01:00
Dirk Wetter faad7128a7 If we are sure we don't have sslv2 we don't need to test any RC4 SSLv2 ciphers 2020-10-28 10:13:22 +01:00
Dirk Wetter 3cd1273439 Address complaint by Travis
Despite the fact google doesn't support RC4 ciphers, testssl.sh called
sslv2_sockets(). Google answered with a >= TLS alert. Building a sum then
failed then in sslv2_sockets().

This fixes sslv2_sockets() and introduces count_chars() as a helper function
(tested also under old FreeBSD to make sure it works under MacOSX).
2020-10-28 10:06:39 +01:00
Dirk 888f4f9c5a Fix run_freak() when sslv2 server hello is empty
This fixes #1754 by avoiding further strings operations if the socket
reply is empty as bash 5.1 seems to have a problem with that. The fix
is done in sslv2_sockets() .

Also sslv2 is not being used in run_freak() if known not to be supported.
2020-10-27 22:36:42 +01:00
Dirk WetterandGitHub d531981e31 Merge pull request #1756 from drwetter/fix_1755
Fix issue with host certificate expiration
2020-10-26 21:45:41 +01:00
Dirk 45b5d7a5d8 Fix issue with host certificate expiration
- wrong certificate name
- fault logic (if statements) -- intermediate section looks not affected
2020-10-26 21:32:09 +01:00
Dirk WetterandGitHub 4af901683a Merge pull request #1751 from tosticated/ssl_renego_mod
Modified ssl renegotiation attempts to be variable, default 6.
2020-10-20 21:00:02 +02:00
Dirk WetterandGitHub 1049fe2330 Merge pull request #1749 from definity/3.1dev
Update man pages and CHANGELOG
2020-10-20 11:34:39 +02:00
Dirk WetterandGitHub e51301d9ee Merge pull request #1748 from definity/3.1dev
Added support for custom user agent
2020-10-17 17:04:49 +02:00
Dirk WetterandGitHub b873441238 Merge pull request #1746 from horazont/feature/xmpp-sni
Force SNI to be the --xmpphost if passed
2020-10-16 09:34:45 +02:00
Dirk WetterandGitHub b4c9437e95 Merge pull request #1741 from drwetter/intermediate_cert_improvements
Intermediate cert improvements
2020-10-03 10:21:31 +02:00
Dirk 4ca4e075a2 Use test::diff so that errors are spotted better 2020-10-02 13:07:13 +02:00
Dirk c3f8207d93 Fix Travis + mv issuer line down
Travis failure was due to debug output in function which return a string.
The debug statement was removed, (stderr would have been choice \#2).

Issuer is heading now the intermediate certificate section, not
sure whethe this is redundant info.
2020-10-02 13:00:21 +02:00
Dirk d5a64ff4b6 Further improvements to intermediate certs
* reorder sequence of checks in certificate info so that the chain relevant points are closer
  together
* determine_cert_fingerprint_serial() doesn't need fil input anymore, thus removed that part
* cert_validityPeriod in JSON/CSV may lead to misunderstandings, thus renamed to cert_extlifeSpan
* reorganized loop for the intermediate certificate checks, so that also i is used and not the variable
  which defines the number of certificates, i.e. certificates_provided. In addition made the counting
  more hiuma friendly, which starts now at 1 instead of 0
2020-10-02 08:43:17 +02:00
Dirk a7bcf9ec7f Further improvements to certificate_info()
* add cn and issuer_CN to the output both on screen and file
* the severity rating for intermediates are just a shot (20/40 days) and
  deserve a second thought
* replace the expiry check by one test statement and make grep futile
* replace at some places "$openssl x509 -in $filename"  by  "$openssl x509 <<< $var"
* the thing with 25*60*60 was fie readability. When it's used >20 times it maybe is not
  (and maybe costs to much time) --> replaced by $secsaday
* adjusted the loop for bad ocsp check for readability
2020-10-01 17:49:14 +02:00
Dirk 67afa6c372 MOre points added to complete intermediate cert section
* UI feed back for expiration date of intermediates: 20 days: HIGH, 40 days: MEDIUM
* also in JSON/CSV
* list the end date of validity
* works for >1 intermediates too
* section moved to the end of certificate_info()
* renamed  <cert#${certificate_number}> --> <hostCert#${certificate_number}> to avoid coinfusion with intermediate certs
* removed blanks in return values of determine_dates_certificate
2020-10-01 00:13:31 +02:00
Dirk 5eee67291e Outsourcing of certificate date properties determination
determine_dates_certificate() is now determining the important dates
of a certificate passed via argument. It works of course for host and
any other certificates.
   Returning multiple parameters is being done via CSV and passed to a
read statement which seemed the best choice for bash.

ToDo:

* $expok is not set properly for intermediate certificates
* check if expired at least in the UI (JSON+CSV: echo the dates so far)
* for multiple host certificates the naming scheme (jsonID + intermediate
certnumnber kind of sucks:

          "id"           : "intermediate_cert_fingerprintSHA256 <cert#1> 1",
	  "id"           : "intermediate_cert_notAfter <cert#2> 1",

The whole thing is kind of hackish as the code has been historically grown.
At some certian point we may want to reconsider how we determine properties of
certificates in certificate_info()
2020-09-30 15:44:23 +02:00
Dirk b625df87c1 Move determination of fingerprint and serial to determine_cert_fingerprint_serial()
.. so that it can be used for other certificates than the host certificate
2020-09-28 20:38:37 +02:00
Dirk 9094665768 Start for improving handling of intermediate certs
See #1683, #1653,  #1004, #1264

* separate code for bad ocsp a bit
* output intermediate cert in json/csv
* replace sed statements from cert_fingerprint* and -serial by bash funcs
2020-09-28 20:17:11 +02:00
Dirk WetterandGitHub 3d07f55f56 Merge pull request #1731 from drwetter/winshock_cipher_improvements
Further robustness checks for winshock (#1719)
2020-09-22 17:35:31 +02:00
Dirk 3d22115d92 Fix travis
and remove some not needed quotes in RHS at double square brackets
2020-09-22 16:40:59 +02:00
Dirk 721d046a7f Add the $EXPERIMENTAL part to winshock
... when checking other services as HTTP or RDP
2020-09-22 15:24:41 +02:00
Dirk 7d8cf71a94 Further robustness check to winshock (#1719)
This commit adds

* a check for the elliptical curves
* and a check for TLS extensions

which will again reduces false positives.

Background:
* https://en.wikipedia.org/wiki/Comparison_of_TLS_implementations#Supported_elliptic_curves
* https://en.wikipedia.org/wiki/Comparison_of_TLS_implementations#Extensions

Also:

* Docu phrased more precise (we're not checking ciphers and
  HTTP Server banner only
* As a last resort we also take 'Microsoft-HTTPAPI/2.0' as a server header on the HTTPS branch
  and query the HTTP branch for Microsoft-IIS/8.x.
* $EXPERIMENTAL overrides some banner and service related checks. So that e.g. SMTP servers can also
  be checked. Last but bot least ist's a vulnerability of the TLS stack.

For better debugging we'll keep the TLS extensions and offered curves in a file.
Also it adds a debug1() function which may be needed on other occasions.

Also the output is better coded as we put "check patches locally to confirm"
into a variable.

There's still room for improvement:

* More extensions (see https://raw.githubusercontent.com/cisco/joy/master/doc/using-joy-fingerprinting-00.pdf)
* We could need a separate determine_curves() function, see #1730 as otherwise
  we can't use the curves in a non-default run.
2020-09-22 13:04:18 +02:00
Dirk WetterandGitHub 8d4042c6b6 Merge pull request #1726 from drwetter/fix_1725_SCIR
Fix Secure Client-Initiated Renegotiation false positive (3.1dev)
2020-09-16 20:13:10 +02:00
Dirk ade010d4e7 Fix Secure Client-Initiated Renegotiation false positive
Server side closed the connection but openssl retrieved
a zero exit code. In addition now we look for "closed"
and if that was returned from the server we label it
as not vulnerable.

This fixes #1725
2020-09-16 18:06:21 +02:00
Dirk WetterandGitHub d4a3a67f70 Merge pull request #1723 from drwetter/winshock_cipher_improvements
Add two ECDHE_RSA GCM ciphersuites to prevent FPs for winshock
2020-09-14 20:59:17 +02:00
Dirk 53bef583c6 add GCM in cipher description (debug info) 2020-09-14 19:33:07 +02:00
Dirk 772420cb42 Add two ECDHE_RSA GCM ciphersuites to prevent FPs for winshock
... they appeared later in SChannel, see

https://docs.microsoft.com/en-us/windows/win32/secauthn/cipher-suites-in-schannel
https://notsomany.com/2016/08/26/achieve-a-on-sslabs-iis-8-5-windows-2012-r2/

On famous false positive I discovered by accident was nvd.nist.gov (sigh).
2020-09-14 19:26:18 +02:00
Dirk WetterandGitHub e62a9b8446 Merge pull request #1721 from drwetter/run_ws_default_fix
Winshock should now run also per default
2020-09-09 15:30:05 +02:00
Dirk Wetter 2bdcdd5371 Winshock should now run also per default 2020-09-09 15:29:12 +02:00
Dirk WetterandGitHub 4a120d9a45 Merge pull request #1720 from drwetter/winshock_fingerprint_improvements
Remove false positive for winshock bc of wrong protocol
2020-09-09 13:22:07 +02:00
Dirk Wetter 023005f011 remove false positive for winshock bc of wrong protocol
Also a cipher exclusion list was added, see #1719
2020-09-09 12:15:23 +02:00
Dirk WetterandGitHub edf669711f Merge pull request #1718 from drwetter/winshock
New feature: winshock
2020-09-08 22:11:36 +02:00
Dirk Wetter 0e54075a6a Reverse double dash option for vulnerabilities (cmd line) 2020-09-08 22:09:57 +02:00
Dirk Wetter 1f8e65104c Add winshock to documentation 2020-09-08 22:08:05 +02:00
Dirk WetterandGitHub 794bbe30af Merge pull request #1710 from tosticated/3.1dev
Added check for certificate validity longer than 398 days
2020-09-08 15:37:07 +02:00
Dirk Wetter fe7b51a3e2 remove hint in winshock 2020-09-08 13:42:50 +02:00
Dirk Wetter a1a0605082 add winshock 2020-09-08 13:42:33 +02:00
Dirk Wetter a511da4ce8 New feature: winshock
This commit implements a detection of Winshock from 2014 (aka MS14-066, CVE-2014-6321).

It does that by analyzing
* the ciphers supported -- MS' rollup patch introduced new GCM ciphers
* AND grabbing the server banner which should match IIS 8.0 oder IIS 8.5

Admittedly this is not a strong detection. But it worked in the cases I tested
(no RDP  yet). The other known method remotely testing for it against IIS is
using a patched openssl binary (see https://github.com/drwetter/testssl.sh/issues/331#issuecomment-211534954)
-- the diff "jules" (hi) provided a while back. That seems to stem from securitysift
albeit his decription was not complete and he didn't provide a PoC (I've
seen also polarssl +  a little bit of python here: https://vimeo.com/112089813

The catch is securitysift's method, is not as trivial to implement and it dosses the
sass.exe process, see: http://www.securitysift.com/exploiting-ms14-066-cve-2014-6321-aka-winshock/.

* Todo: man page

This commit also removes -BB from the help. We haven't settled yet finally
where we go with short options for the cmd line for vulnerabilities. One
is for sure though: Using one letter uppercase doesn't scale. As winshock
can be executed with --WS and --winshock --BB brings that in line. For now
also -BB works (as -WS) but it isn't advertised anymore.
2020-09-08 12:37:50 +02:00
Dirk WetterandGitHub b6bab1e1b5 Merge pull request #1715 from drwetter/not_run_allciphers_et_al
Modify default for full 9 yrds run
2020-09-07 21:17:01 +02:00
Dirk Wetter e5d0b3eeac Modify default for full 9 yrds run
We don't need to execute run_cipher_per_proto() in addition here
2020-09-07 09:54:34 +02:00
Dirk Wetter eafeb904f4 Fix emptying of SERVICE variable in determine_service()
SERVICE global was previously set to $protocol which was
meant to set this for STARTTLS services. However it
was executes outside the corresponding if-statement.

This commit moves the statement where it belongs.
2020-09-03 14:22:53 +02:00