Commit Graph

2254 Commits

Author SHA1 Message Date
Dirk Wetter 30c0359bdd
Merge pull request #2471 from Tazmaniac/mongodb-detection-fix-backport
MongoDB identification fix
2024-02-13 18:42:33 +01:00
Emmanuel Fusté c98c780ded MongoDB identification fix
The actual code grep for "MongoDB" keyword in the head of the HTTP
session.
In case of "compressed" HTML, a big page is on one line.
On a IT page, we could encounter the "MongoDB" keyword and
miss-identify the application protocol.

Fixed by matching on a longuer string taken from a live MogoDB
server.
2024-02-13 17:48:40 +01:00
Dirk Wetter 02220d2fc4 Bail out if user error bc of umask (3.0 branch)
Implemnation for 3.0, 3.2 see #2450

If a user chose a broken umask testssl.sh will start but emits subsequent errors.
This patch adds two sanity checks whether it is allowed to create and read files in the temp directory.

Fixes #2449
2023-12-24 10:21:11 +01:00
Dirk a0c0c73b66 Amend fix for newer grep versions
See also PR #2243, issue #2241

Removes unneeded escape for exclamation mark. This is for 3.0.
3.2 has the fix already.
2023-10-30 19:07:06 +01:00
Dirk 41c697f232 put the redirection in the right spot 2023-10-30 15:25:38 +01:00
Dirk 775ed60437 Fix weird bash globbing (3.0)
What was problematic was the error message when the certificate stores were missing. This fixes it by redirecting the error message to /dev/null so that if the sub function detects the missing file it returns with an error by the program and not by executing "basename"

As for 3.2 this is for the 3.0 branch.
2023-10-30 15:20:37 +01:00
Dirk c09e1587b7 fix spell errors 2023-10-07 15:15:04 +02:00
Dirk c31b9492ce Fix regexp in STARTTLS detection
see also #2411, kudo to Geert!
2023-10-07 15:06:36 +02:00
Tazmaniac eb006e4173
Backport pull request #2360 to fix #2389
Not exactly for the same reason, but we need SNI too for secure renego tests.
2023-09-08 16:31:38 +02:00
Dirk Wetter 828af39053 Backporting Make sure control chars from HTTP header don't end up in html,csv,json
This is for 3.0. For 3.1dev, see #2332 .

This PR addresses the bug #2330 by implementing a function which removes control characters from the file output format html,csv,json in the output.
In every instance called there's a check before whether the string contains control chars, hoping it'll save a few milli seconds.

A tr function is used, omitting LF.
It doesn't filter the terminal output and the log file output, yet. It provides a function though which is not being called.
2023-03-12 17:40:02 +01:00
Dirk Wetter b8bb3ef747
Merge pull request #2327 from drwetter/fix_mime-type-3.0
Fix Accept Header (3.0)
2023-02-20 20:29:46 +01:00
Dirk 96a4eb99ad Fix Accept Header (3.0)
see #2325. This is for the 3.0 branch (for 3.1dev see #2326)

"whenever HTTP/1.1 is used then the Accept header uses "text/*" as a MIME type.
This causes some minor issues with some of the checks we are doing"
2023-02-20 15:14:34 +01:00
David Cooper 404d40cf68
Remove set_grade_cap() from 3.0
Grading is a new feature in 3.1dev,, so set_grade_cap() is not defined in the 3.0 branch.

This commit removes the call to set_grade_cap() in certificate_info().
2023-02-06 06:40:22 -08:00
Dirk Wetter 3bacce4770
Merge pull request #2319 from SSLbrain/3.0
Feature request Trustcor certificate #2293 for 3.0
2023-02-05 19:21:15 +01:00
Sole f7acaa8272 Change exception for removed root certificates into easy edit multi-value regular expression for Organization name and making it clear that CA's are actively removed from 1+ root stores. 2023-02-05 03:22:24 +00:00
David Cooper 5c0b8314d0 Fix HTML output in Bash 5.2 and newer
As noted in #2304, the way that the '&' character is treated in the string part of a pattern substitution changed in Bash 5.2. As a result, the change that was made in #1481 to accommodate older versions of Bash (e.g., on MacOS) now causes testssl.sh to produce incorrect HTML output when run on Bash 5.2.

This commit encodes the '&' characters in the substitution strings in a way that produces correct results on multiple versions of Bash (3.2 on MacOS, 5.2 on Ubuntu 23.10, 5.0 on Ubuntu 20.04).
2023-02-03 14:31:08 -08:00
Dirk Wetter 6b91a60a7a
Merge pull request #2274 from dcooper16/fix2249
Fix #2249
2022-11-11 16:30:12 +01:00
David Cooper 8593cbbb14
Fix #2249
OpenSSL uses "sha1WithRSAEncryption" to represent 1.2.840.113549.1.1.5 and "sha1WithRSA" to represent 1.3.14.3.2.29. While 1.2.840.113549.1.1.5 is generally recognized as the "standard" OID for RSA with SHA-1 (see, for example, RFC 3279), 1.3.14.3.2.29 has been used in some places as well (https://codereview.chromium.org/1223763002, https://bugzilla.mozilla.org/show_bug.cgi?id=1042479, pyca/cryptography#3160)
2022-11-10 11:37:58 -08:00
David Cooper f929e39db0
Fix #2271
This commit fixes #2271 by adding the `-no_ssl2` option to the call to get_host_cert() in run_drown(). There is at least one server that causes OpenSSL to hang if this call to get_host_cert() results in an SSLv2 ClientHello being sent. Since this call to get_host_cert() only needs to find the server's certificate in cases in which the server does not support SSLv2, there is no need to send an SSLv2 ClientHello.
2022-11-10 11:33:30 -08:00
David Cooper b9271ba5ec
Fix infinite loop in run_pfs()
This commit fixes an infinite loop in run_pfs() that occurs in cases in which $OPENSSL supports TLS 1.3 and the server supports all of the non-TLS 1.3 FS ciphers that $OPENSSL supports but not all of the TLS 1.3 ciphers that $OPENSSL supports.

The problem is that testing for supported ciphers using $OPENSSL, testing should stop if there are no more ciphers to test (because all of the ciphers supported by $OPENSSL have been determined to be supported by the server). However, currently testing only stops if both the list of TLS 1.3 ciphers and non-TLS 1.3 ciphers is empty. In the problematic case, only the list of non-TLS 1.3 ciphers is empty. Instead of stopping, s_client_options() is called with a -cipher option with an empty list, and s_client_options() simply removes the -cipher option from the command, resulting in a call to $OPENSSL s_client with a full list of non-TLS 1.3 ciphers. Since this call succeeds, the loop continues.

This commit fixes the problem by stopping TLS 1.3 ClientHello testing when the list of TLS 1.3 ciphers is empty and stopping non-TLS 1.3 ClientHello testing when the list of non-TLS 1.3 ciphers is empty.
2022-11-01 14:16:43 -07:00
Dirk Wetter abdd51d815
Merge pull request #2231 from drwetter/bump_version
Bump version
2022-09-28 09:19:37 +02:00
Geert Hendrickx ffcf07f6b1 Fix grep 3.8 warnings on fgrep. 2022-09-18 18:59:18 +02:00
Geert Hendrickx c819a3014a
Fix grep 3.8 warnings on unneeded escapes of hyphen, slash, space. 2022-09-18 18:52:27 +02:00
David Cooper d37f6c78ae
Fix alignment in neat_list()
When neat_list() is printing information about a cipher suite that uses (EC)DH key exchange that was obtained using an old version of OpenSSL the rows are not properly aligned, since the key exchange input includes an unexpected trailing space. This commit fixes the problem by removing any trailing spaces from $kx.
2022-09-15 13:59:17 -07:00
Dirk 884319948e Bump version 2022-09-07 10:49:19 +02:00
Dirk Wetter 01e6535ec1
Merge pull request #2226 from dcooper16/fix_ct_30
Fix certificate_transparency()
2022-09-07 10:18:59 +02:00
David Cooper d6888457eb
Fix certificate_transparency()
certificate_transparency() does not work in debug mode, since tls_sockets() writes debugging messages to stdout. This commit fixes the problem by having certificate_transparency() return its results using a global variable rather than writing the results to stdout and having having run_server_defaults() catch the output.
2022-09-06 11:40:18 -07:00
David Cooper a8c8bfe7ea
Fix decrypting TLS 1.3 server response
There is at least one server that includes a new session ticket in the same packet as the Finished message. This confuses check_tls_serverhellodone() since the new session ticket is encrypted under the application traffic keys rather than the handshake keys. check_tls_serverhellodone(), being unable to decrypt the new session ticket, reports a failure and does not return any of the decrypted data.

This commit fixes the problem by having check_tls_serverhellodone() simply ignore any data that appears after the Finished message.
2022-09-02 11:15:50 -07:00
David Cooper 07dca9fd6b
Fix #2198
This commit is the same as #2211, but for the 3.0 branch.
2022-08-25 09:44:14 -07:00
Tomasz Kramkowski 5793bc26ae Make run_crime use $jsonID instead of repeating
This also seems more consistent across the code.
2022-05-24 22:21:57 +01:00
Tomasz Kramkowski 130b5b2aac Fix CRIME test on servers only supporting TLS 1.3
As jsonID is not set by run_crime, make the fileout invocation for
servers supporting only TLS 1.3 use the literal "CRIME_TLS" instead.

Previously running testssl with CSV or JSON output would produce an item
with the wrong ID.
2022-05-24 22:21:57 +01:00
Dirk 78e67d8fff Shorten censys link
Remove sort order and fix the argument separator
2022-05-14 11:52:45 +02:00
Dirk d38a8b283d Backport #2184, Censys link
See #2127. The line is very long though: 152 chars
2022-05-14 11:42:43 +02:00
Dirk Wetter a773f00fce Fix banner and remove STARTTLS NNTP CI check
On macOS in dark mode the git tag in grey wasn't visible. It was
changed now to light grey. It also works at least on Linux
using a light terminal background.

The NNTP server which we used for STARTTLS checks seems ofen
not to work. Thus this PR removes that for the 3.0 branch.
2022-05-04 10:56:16 +02:00
David Cooper aaf7bf8505 Backport #2157, #2160, #2162
This commit backports PR #2157, #2160, and #2162 from the 3.1dev branch to the 3.0 branch.
2022-05-02 10:33:07 -04:00
Dirk 405f431612 Relax STARTTLS FTP requirement (3.0)
In rare? occassions where the STARTTLS FEAT request only displays AUTH instead
of AUTH TLS, testssl.sh fails as it cannot upgrade to TLS.

Required by RFC 4217 is only AUTH ("MUST"), AUTH TLS is optional ("should"), see section 6.
This PR relaxes the presence of TLS after AUTH and fixes #2132 for the 3.0 branch.
2022-04-27 14:52:46 +02:00
David Cooper 93711f3d30 Fix run_server_preference() with no default protocol
run_server_preference() calls "default_proto=$(get_protocol $TMPFILE)" even if all attempts to connect to the server failed. This will result in default_proto incorrectly being set to TLS 1.2. This commit fixes the issue by only calling get_protocol() if an attempt to connect to the server was successful.
2022-04-14 12:29:21 -04:00
Dirk Wetter 0047e1f153
Merge pull request #2153 from dcooper16/no_session_id_30
Fix setting NO_SESSION_ID
2022-04-14 18:08:53 +02:00
David Cooper 0d596e208b
Fix setting NO_SESSION_ID
With a TLS 1.3 connection, a session ID will only appears as part of a post-handshake session ticket. However, with OpenSSL 1.1.1 or newer when using $OPENSSL s_client as it is called in determine_optimal_proto() (i.e., with "< /dev/null"), a post-handshake session ticket will usually not be received, even if the server supports it. With versions of LibreSSL that support TLS 1.3, a post-handshake session ticket is never displayed (even without "< /dev/null"). This can result in NO_SESSION_ID incorrectly being set to true.

This commit fixes the issue by setting NO_SESSION_ID to true by default, and then setting it to false if a session ID is returned by any connection to the server.
2022-04-14 09:40:41 -04:00
David Cooper 6e6b8731c9
Fix getting CRL
OpenSSL 3.X pretty prints certificates in a slightly different way than previous versions, and this breaks the code for getting the URIs from the CRLDP extension.
This commit fixes the issue by having awk search for additional possible strings to start the CRL Distribution Points output. Unless the CRLDP extension is malformed, it will begin with "Full Name", "Relative Name", "Reasons", or "CRL Issuer".
2022-04-14 08:31:57 -04:00
David Cooper 6b5ce68d1a
More OpenSSL compatibility fixes
This commit fixes yet another issue with using OpenSSL 3.X with the 3.0 branch. When $OPENSSL is used to obtain a fingerprint, OpenSSL 3.X prepends the fingerprint with "sha1" or "sha256" rather than "SHA1" or "SHA256".
2022-04-11 13:36:56 -04:00
Dirk Wetter 395907a79f
Merge pull request #2144 from dcooper16/ossl3_compat_30
OpenSSL compatibility fix
2022-04-07 21:34:30 +02:00
David Cooper cd89134338
OpenSSL compatibility fix
OpenSSL 3.0.X uses different names for some elliptic cures in the "Server Temp Key" line than previous previous versions. This commit addresses this issue by checking for both names.
2022-04-07 14:31:40 -04:00
David Cooper 5b26b9931b
Fix #2138 in 3.0 branch
This commit fixes #2138 in the 3.0 branch.
2022-04-07 14:09:16 -04:00
Dirk bc2c8d6eaa Remove trailing spaces to get rid of failing status of CI 2022-04-01 18:07:19 +02:00
David Cooper 61bbfb4489
Add FFDHE groups to supported_groups
There is at least one server that will not negotiate TLS_DHE_* cipher suites with TLS 1.2 and below if the supported_groups extension is present but does not include any DH groups. This commit adds the DH groups that are currently in the TLS 1.3 ClientHello to the TLS 1.2 and earlier ClientHello.
2022-03-09 15:19:33 -05:00
David Cooper f5e75054d3
Include RSA-PSS in ClientHello
This commit changes prepare_tls_clienthello() so that the RSA-PSS algorithms are offered in the signature algorithms extension of TLS 1.2 and below ClientHello messages.
2022-03-09 07:45:52 -05:00
Dirk Wetter c6dce9d8b3 Bump patch version number 2022-02-17 09:10:41 +01:00
Dirk Wetter 93b9a37c0c Fix "ID resumption test failed" under Darwin (3.0)
Under Darwin using LibreSSL it was not possible to test for session
resumption by session ID.

This fixes the issue #2096 for 3.0 by checking not only the return value of the
s_client hello but also whether a probable certificate is being returned.
2022-02-16 23:18:04 +01:00
Dirk Wetter c511319683 Fix JSON output bc of missing locale in alpine (3.0)
It is now being tested whether the binary locale exists and
there's a global introduced for that.

Also there's no fileout warning at this early stage anymore
as it leads to non-valid JSON
2022-02-16 10:45:12 +01:00