Commit Graph

2855 Commits

Author SHA1 Message Date
William Faulk
2d1a5930ca add support for MacOS's dscacheutil 2025-07-17 16:48:22 -04:00
Dirk Wetter
88b7af8ad1 Try harder to find OPENSSL2
This commit adds an improvement so that e.g. under MacOS
/opt/homebrew/bin/openssl is automatically taken as
$OPENSSL so that also QUIC works out of the box for MacOS.

Formally for at least MacOS with silicon CPUs OPENSSL was
equal to OPENSSL2 and LibreSSL in /usr/bin/openssl doesn't
have QUIC support (up to version 15.5 of MacoOS at least).
2025-07-15 23:28:44 +02:00
Dirk Wetter
f4ab559dbf Fix message when IPv6 needs to be tested too
"Testing all IPv4 addresses"
2025-07-15 17:29:28 +02:00
Dirk Wetter
a4953d6e22 Redo PR for Opossum
Fixes #2833

This does a check for the opossum vulnerability, see https://opossum-attack.com/ .

It uses a separate function to send the payload and retrieve the result via `http_header_printf()`.  It doesn't use curl or wget. The latter wouldn't work anyway as according to the manpage as the HTTP header which needs to be sent must not contain LFs.  This function was introduced because `http_get_header()` -- which was renamed to `http_head()` -- could use wget if curl is not available. On the way to this PR `http_head()` was improved, so that timeouts were used for curl and wget for better maturity.

`http_header_printf()` now uses bach sockets , strips the URI so that a plaintext request is made. This will be done in the background because not every host will answer.

Done also:
- handling when PROXY is requested (try anyway directly as the payload is not "proxyable")
- print a message when no HTTP service is present
- try hard to use plaintext HTTP when auth is required for HTTPS and service HTTP would not be defined otherwise
- manpages
- help

Also when pwnedkeys are checked a not pwned certificate is labled not neutral but OK=green.
2025-07-12 20:59:50 +02:00
Dirk Wetter
fc3e7eca84 Merge pull request #2830 from magnuslarsen/3.1dev
feat: bump ssllabs rating guide to 2009r
2025-07-09 23:21:33 +02:00
Magnus Larsen
198a5f0c30 fix(rating): HSTS not offered does not give a warning 2025-07-09 09:41:11 +02:00
Robin Wood
f5fd7cb2c7 One more space 2025-07-08 21:16:26 +01:00
Magnus Larsen
3e465bafe2 feat: bump ssllabs rating guide to 2009r 2025-07-08 14:20:46 +02:00
Robin Wood
ec5443438f Removed rogue space on QUIC output
Before:

```
 TLS 1.2    offered (OK)
 TLS 1.3    offered (OK): final
 QUIC        not offered or timed out
 NPN/SPDY   not offered                                                                                      
 ALPN/HTTP2 h2, http/1.1 (offered)                                                                           
```

After:

```
 TLS 1.2    offered (OK)
 TLS 1.3    offered (OK): final
 QUIC       not offered or timed out
 NPN/SPDY   not offered
 ALPN/HTTP2 h2, http/1.1 (offered)
```
2025-07-08 08:32:47 +01:00
Dirk Wetter
85805ba8db Fix not working --disable-rating switch (3.3dev)
The logic was wrong when calling set_rating_state() in parse_cmd_line() as do_rating was set before to true through set_scanning_defaults().

This PR fixes #2825 by querying ${SKIP_TESTS[@]} instead and then calling set_rating_state() when no --disable-rating was supplied .
2025-07-07 12:07:53 +02:00
Dirk
89bd3c753d Add QUIC protocol check in help() 2025-07-04 14:55:48 +02:00
Dirk Wetter
d85c65e3b2 output missing proxy support if connect fails 2025-07-03 23:01:59 +02:00
Dirk Wetter
c942283b34 Re-add correct version \# 2025-07-03 15:01:04 +02:00
Dirk
49dcd5b854 First try for QUIC (OpenSSL only)
This is an implementation for QUIC (RFC 9000, RFC 9114). It's purely
OpenSSL based for now. As some distros support newer (>= 3.2) versions
this works on some distros now and will work on more as time goes by.

It has been tested with MacOS and Linux. If there's an OpenSSL version
in /usr/bin/ it will automagically use that version.

A new short sub function named sub_quic() was introduced for handling this as
run_protocols() is already "full".

It appears below TLS 1.3. A check against HTTPS RR #2484 is planned but
not implemented yet. PR #2484 has to be worked on and merged before.

New variables were introduces (HAS_QUIC/ +HAS2_QUIC). Also there's
QUIC_WAIT as we run the connect in the background and we need a wait time.

HAS_UDS2 was renamed to HAS2_UDS as HAS2 should signal this is for OPENSSL2
and UDS2 doesn't make sense.

To clarify:
- check for a proxy and then don't do the check?
- short unit test (t/31_isJSON_valid.t cjecks cloudflare but ...)
2025-07-03 14:36:55 +02:00
Dirk
3792bceeda Improve error message for sockets fail and Alpine
See $2807 .

Also some prln_magenta were modified (see #2816) to pr_warning.
2025-06-29 15:24:44 +02:00
Dirk Wetter
c9a11a9fb0 Minor improvements to #2798
see https://github.com/testssl/testssl.sh/pull/2798#issuecomment-2972834180
2025-06-23 18:43:34 +02:00
secinto
529a373b2e Update testssl.sh
Modified grading for incomplete chain
2025-06-13 10:54:13 +02:00
Dirk
f2aa87ba66 Bump version
"just" bugfix release.
2025-06-12 17:26:06 +02:00
Dirk
235a6a0f88 add another OPENSSL_CONF='' 2025-06-11 19:02:06 +02:00
Dirk
91a35026b6 Fix OPENSSL_CONF problem for OPENSSL2
In #2727 there were workarounds introduced which sped up processing decryption of
ChaCha20 and and AES-GCM by using OPENSSL2 when it is supporting such functions.

However when OPENSSL2 is called and OPENSSL_CONF still points to the autogenerated
file which works for `~/bin/openssl.$(uname -s).$(uname -m)` the decryption `$plaintext`
will be empty which later on caused a negative value, see #2780 .

This fixes #2780 by prepending `OPENSSL_CONF=''` to each OPENSSL2 instance. Also it
makes `chacha20()` and `gcm-decrypt()` more robust. It is now more readable now.

At other places $OPENSSL2 were prepended by `OPENSSL_CONF=''` also if there weren't
any obvious errors noticed.

Also now all OPENSSL2 vars will appear in /tmp/testssl.XXXXXX/environment.txt when
debugging.

It was also noticed that the `find_socat()` function had room for improvements, it was
not set in any case when `socat was in $PATH or supplied via env SOCAT.
2025-06-11 18:47:14 +02:00
Dirk Wetter
735cc668c0 Merge pull request #2792 from testssl/fix_issuerCN
Fix missing issuer CN
2025-06-11 11:13:21 +02:00
Dirk Wetter
0a89d5c94f Some cert need 5 lines to reach the CN 2025-06-11 09:06:41 +02:00
Dirk Wetter
39029e9995 fix orthographic error 2025-06-10 23:13:00 +02:00
Dirk Wetter
61947405e0 Fix missing issuer CN
This fixes a problem which was introduced @ 8d8f83ace5.
It caused for some hosts not to parse / display the issuer CN correctly.

Also it adds some code in testssl.sh and in a unit test to detect
this earlier. In general an output string FIXME will now cause a
unit test to fail. This can + should be used at other places too!

Fixes #2789
2025-06-10 22:54:11 +02:00
Dirk Wetter
889aedc0e4 Fix parser for server header
Do word match and exclude minus sign

This fixes #2787 for 3.2.
2025-06-10 21:59:40 +02:00
Dirk
0daf83cf76 fix typo 2025-05-21 14:22:13 +02:00
Dirk
cd575526a7 Fix CCS injection regression
The rhs of the pattern was off by one byte and it worked in practise until recent PR #2657.

This fixes #2691 for 3.2 .
2025-05-21 14:17:54 +02:00
Dirk Wetter
85d8d44fbe Try to fix the renegotiation problem
as suggested, see https://github.com/testssl/testssl.sh/issues/2765#issuecomment-2891140503
2025-05-19 16:24:46 +02:00
Dirk Wetter
c109cafa17 Merge branch '3.2' into mac_runner 2025-05-16 18:16:58 +02:00
Dirk Wetter
0aad0a0fac Try /usr/bin/echo for testing
.. although it seems not an option to include this in prod.
RSsee https://github.com/testssl/testssl.sh/issues/2765

Omitting redirecting stderr
2025-05-12 10:43:43 +02:00
vinny-pereira
bce1083df8 fix run_breach error output 2025-05-08 07:48:20 -06:00
ssupdoc
aa2ebf3c21 Uses tolower() utility for hostname conversion 2025-05-08 17:03:04 +12:00
Sullo
6678d2dedc Lowercase URL to match 'HTTPS://<server>/' 2025-05-05 14:42:13 -04:00
Dirk Wetter
06ba579475 Merge pull request #2742 from testssl/bump_version
Prepare for upcoming release
2025-04-23 11:33:39 +02:00
Dirk Wetter
58da779a8e Merge pull request #2721 from testssl/fix_some_ipv6proxy_issues
Fix some ipv6proxy issues
2025-04-22 15:05:05 +02:00
Dirk
ffe5dea844 remove misleading command 2025-04-22 12:55:42 +02:00
Dirk
b4cdc37f9e trailing zero sounds better / is more distinguishable 2025-04-22 12:47:48 +02:00
Dirk
295a68e7ab Just bump version for upcoming release 2025-04-18 13:32:53 +02:00
David Cooper
d1531cdf60 Support decrypting TLS 1.3 handshakes with PQ key exchange
This commit modifies testssl.sh so that TLS 1.3 handshakes that use post-quantum algorithms for key exchange can be decrypted, if $OPENSSL supports the algorithms.
2025-04-10 14:05:30 -07:00
David Cooper
ecaa7878e5 Support ML-DSA server keys
This commit adds support for server certificates that have ML-DSA pubilc keys. It also adds supports for certificates that are signed with ML-DSA or SLH-DSA. The ML-DSA code points for the signature_algorithms extension are taken from https://datatracker.ietf.org/doc/draft-tls-westerbaan-mldsa/ and are the ones used by OpenSSL 3.5.0.
2025-04-10 09:15:04 -07:00
David Cooper
9f48c51dc7 Get supported groups list from OpenSSL 3.5.0
In OpenSSL 3.5.0 the `list` command can be used to obtain a list of supported groups for TLS. The commit makes use of this command when $OPENSSL is OpenSSL 3.5.0 or later. This should be faster than testing curves one at a time.
2025-04-09 09:21:54 -07:00
Dirk Wetter
b7f9ff1bf2 Merge pull request #2727 from dcooper16/chacha20
ChaCha20 decryption
2025-04-04 11:54:05 +02:00
David Cooper
f6ff390799 Fix checks with HAS_UDS and HAS_UDS2
This commit fixes a check where the Boolean variables $HAS_UDS and $HAS_UDS2 are checked for whether they are empty rather than for whether they are true.
2025-04-02 08:03:58 -07:00
David Cooper
e2accb6442 ChaCha20 decryption
Decryption is TLS 1.3 handshakes is very slow if the response is encrypted using ChaCha20 and the $OPENSSL enc command does not support ChaCha20. This commit mitigates that problem by using $OPENSSL2 for ChaCha20 decryption if such decryption is needed and $OPENSSL does not support it.

This commit also changes testssl.sh to make use of $OPENSSL2 for AES-GCM decryption, when $OPENSSL2 supports it, but $OPENSSL does not. However, this change is not as important. Implementing AES-GCM in Bash using $OPENSSL for AES ECB operations isn't nearly as slow as fully implementing ChaCha20 in Bash.
2025-04-02 07:55:31 -07:00
Dirk Wetter
44d9f520fb Add check for proxy IPv6 support
... of the binary. Testing needs to be done.
2025-04-01 23:37:54 +02:00
Dirk Wetter
36a58e2b3e Allow square bracket notation for IPv6 proxy 2025-03-27 18:26:17 +01:00
Dirk Wetter
e81b09176d Distunguish between LibreSSL and OpenSSL IPv6 proxy
Somehow the proxy now shows only IPv6 source addresses when specifying
--proxy=IPV6ADDRESS:PORT
2025-03-25 19:42:54 +01:00
Dirk Wetter
18da1b8df5 Fix some IPv6 proxy issues
As a quick hack this PR enables *basically* the IPv6 proxy which results that testssl.sh
will use an IPv6 proxy when

* the binary supports that
* the binary is used an not tls_sockets()
* there's no A record but an AAAA record of the proxy or an IPv6 address as proxy address was specified.

The latter should guarantee that it doesn't break anything.

However tls_sockets() still uses IPv4 for the connection to the proxy.

See #1105
2025-03-25 19:13:30 +01:00
Dirk Wetter
040ef1e0c9 Comment the first lines get_server_certificate()
See https://github.com/testssl/testssl.sh/issues/2707#issuecomment-2741053487
2025-03-25 17:22:10 +01:00
Dirk Wetter
a17bb42a37 Sanitze HTTP header early and better
On MacOS `run_http_header()` hiccuped when in any place of the web site unprintable chars were returned, see https://github.com/testssl/testssl.sh/issues/2708#issuecomment-2738347784 .

This PR fixes that by moving the sanitization to a separate function and run it earlier before any processing of the returned content (header plus body) takes place.

Output was:

```
'HTTP Status Code           awk: towc: multibyte conversion failure on: '� disabilitato");

 input record number 36, file /tmp/testssl.FHu8E0/AAA.BBB.CCC.DDD.http_header.txt
 source line number 1
'wk: towc: multibyte conversion failure on: '� disabilitato");

 input record number 36, file /tmp/testssl.FHu8E0/AAA.BBB.CCC.DDD.http_header.txt
 source line number 1
  200 OK
```
2025-03-20 13:34:46 +01:00