Commit Graph

2855 Commits

Author SHA1 Message Date
Dirk Wetter
2fcd01c693 fix FP 2025-11-10 12:15:58 +01:00
Dirk
da8a6f2f34 Fix pattern for matching /etc/hosts entries
`grep -w` matches also `string1-whatsoever` so that entries like

```
192.168.0.10 anystring anystring-apache
192.168.0.11 anystring-tomcat
```

matched 3 entries over 2 lines.

This PR fixes #2937 by improving the match pattern, so that
`string1` needs a trailing whitespace or a EOL -- besides a
leaing whitespace.
2025-11-03 22:30:26 +01:00
Dirk
da436e7d87 Fix date parsing bc of locale problem
The new block making sure that rust coreutils work properly (PR #2913)
introduced a new check in order to determine which date functions
to use.

The function however parsed only for English error messages ("No such file").
This PR fixes that by setting LC_ALL to C.

Fixes #2929 .
2025-10-30 13:30:08 +01:00
Dirk Wetter
ce820cdaf5 Update "sneaky" user agent
fixes #2926 for 3.3dev.
2025-10-28 10:26:06 +01:00
Dirk Wetter
c53e7a3955 Fix more shellcheck complaints (high severity)
... and fine tune some comments in the beginning
2025-10-13 21:06:02 +02:00
Dirk Wetter
672493ebe7 Fix check for /bin/sh 2025-10-11 18:59:51 +02:00
Dirk Wetter
7090d5fbdd Saving everything before commit/push is supposed to be better ;-) 2025-10-11 18:00:48 +02:00
Dirk Wetter
8392a4aed5 Squash some shellcheck *errors*
and some warnings.

Five errors of type [SC2145](https://www.shellcheck.net/wiki/SC2145) are left as I am not sure whether
it'll be safe to follow the recommendation
2025-10-11 13:19:28 +02:00
Dirk Wetter
df100d986b Merge pull request #2913 from testssl/fix_2909
Fix date for Ubuntu >= 25.10
2025-10-09 20:30:15 +02:00
Dirk Wetter
accd1f20cd Rearrange order of date checks
works for all "older" Linux systems, MacOS, OpenBSD and according to #teki69
also Ubuntu 25.10 .
2025-10-08 23:26:48 +02:00
Dirk Wetter
36bc08ce18 Fix date for Ubuntu >= 25.10
works for
- ubuntu 24.04
- Debian 13
- openbsd 6.6 / 7.x
- macos 15.7.1

Fixes #2909
2025-10-07 23:23:09 +02:00
Dirk Wetter
e0401b6207 TLS 1.3 early data / 0-RTT
This PR implements a check for TLS early data. It needs a compatible OpenSSL or
LibreSSL version. For modern OS versionis it should automagically pick the right,
modern binary for the check.

Mitigations like Defer processing or HTTP 425 are not yet tested.

To clarify is
* whether to penalize SSLlabs rating (@magnuslarsen). testssl.net has it
   enabled but the Web UI claims it's not a/v, see
  https://www.ssllabs.com/ssltest/analyze.html?d=testssl.net&s=172.67.205.231&hideResults=on&latest
* Man pages

To be in line with other HAS2_* global vars (HAS2_QUIC, HAS2_UDS), the following
vars were renamed from their OPENSSL2_HAS_* counter parts:

- HAS2_TLS13
- HAS2_CHACHA20=false
- HAS2_AES128_GCM=false
- HAS2_AES256_GCM=false
2025-10-06 17:03:56 +02:00
Dirk Wetter
ffa1ffdbb3 fix syntax 2025-10-05 20:16:39 +02:00
Dirk Wetter
5b0b771c52 Define vars for early data
It seems needed to introduce two variables for upcoming early data tests,
see #1186. This is not needed for OpenSSL as it introduced that
together with TLS 1.3. For LibreSSL it is though.
2025-10-05 18:19:41 +02:00
Dirk Wetter
637ad03a36 Merge pull request #2904 from testssl/jdvorak001-fix_file_naming
Jdvorak001 fix file naming
2025-09-30 17:31:33 +02:00
Dirk
78ecf53b67 Consistency for function ciphers_by_strength()
* keys now always with v, like supportedciphers_TLSv1_2 and also
  ciphers (e.g. TLSv1.2   x35     AES256-SHA)
* add word "server" to file output so that it reads "NOT a server cipher order configured"

Fixes #2884
2025-09-30 14:30:52 +02:00
Dirk
123684f554 make spellchecker and myself happy ;-) 2025-09-30 13:58:28 +02:00
Dirk
e8ab2c74e6 straighten global definitions in the very bottom 2025-09-30 13:56:25 +02:00
Dirk
1d6ddfb352 rename datetime_started
.. to fname_date as it's more consitent with fname_prefix
2025-09-30 13:35:08 +02:00
Jan Dvorak
e0009cf0cb Adapt variable naming (datetime_started now) 2025-09-26 12:18:44 +02:00
Jan Dvorak
67aba03a41 Use common datetime part when naming output files across all formats
- the datetime is fetched just once
- it is then passed to the functions that start the output files, always as arg1
2025-09-25 23:26:33 +02:00
David Cooper
41db430c46 Fix #2896
This commit fixes #2896. This commit avoids modifying the ADDTL_CA_FILES environment variable, and instead substitutes spaces for commas whenever the variable is used.
2025-09-21 13:23:55 -07:00
Dirk Wetter
75feb05a0c Fix indentation @ Intermediate cert validity
... when there were two server and >1 intermediate CA certificates.
2025-09-16 13:03:48 +02:00
Dirk
ef82cd37be fix typo 2025-09-15 16:00:53 +02:00
Dirk
15ebceca84 Fix garbled screen when HTTP Age is not a non-negative int
As suggested in https://github.com/testssl/testssl.sh/pull/2885 parsing
of the server determined HTTP age var wasn't strict enough.

https://www.rfc-editor.org/rfc/rfc7234#section-1.2.1 requires the
variable to be a non-negative integer but testssl.sh assumed it was
like that but did't check whether that really was the case. This was
labled as a (potential) security problem. Potential as it didn't
look exploitable after review -- the header as a whole was already
sanitized.

This PR fixes the typs confusion and the garbled screen by checking
the variable early in run_http_header() and reset it to NaN. That
will be used later in run_http_date() to raise a low severity finding.

Kudos to @Tristanhx for catching this and for the suggested PR.

Also, only when running in debug mode, this PR fixes that during
service_detection() parts of the not-yet-sanitized header ended
up on the screen. The fix just calls sanitze_http_header() for the
temporary variable $TMPFILE.
2025-09-15 15:41:43 +02:00
Dirk Wetter
881ce7723e wait_kill() is now 0.1 seconds
... which leads to a performance gain., most noteably on Macs.

All times when calling were re-adjusted.

Also:
* PROXY_WAIT was decrease to 10 seconds. 20 seemed just too much
* passed var to `starttls_just_read()` was simplyfied
2025-07-30 18:34:37 +02:00
Dirk
279bc4ad91 Fix additional parameter in shouldwedo_ipv6()
.... for connectivity_problem() which may block testssl.sh
2025-07-30 12:53:13 +02:00
Dirk
2ce0110eee Exec IPv6 check in background
... as it can get stuck.

Also reduce MAX_WAITSOCK to 5 instead of 10.
2025-07-29 15:36:23 +02:00
Dirk
0225bc3604 typo fix 2025-07-28 15:44:58 +02:00
Dirk
9166fc7174 Fix typo in comment 2025-07-28 15:43:01 +02:00
Dirk
f8d3df7747 Make QUIC protocol detction more reliable
The site from that billioniare who made nazi gestures delivers a UDP
response without proper TLS handshake. This led to a false positive
as if the site supports QUIC via h3.

This PR makes the detection of QUIC more robust by adding a certificate check
and also take better the return values from `wait_kill()` into account.

It also introduces a function to remove any non printable chars (depending
on the LC_ALL var): `filter_printable()`

Also `sanitze_http_header()` doesn't operate anymore on a global variable
which is kind of not best practise as it is easily to avoid here.
2025-07-28 15:37:35 +02:00
Dirk Wetter
57689611bf Fix also IPv6 addresses for --nodns etc....
Seems the patch in #2856 wasn't complete. So that it was forgotten to add also manually specified IPv6 addresses to the IP addresses to show and to scan.
This makes sure it does, so this fixes #2854 finally.

Also statements were added to reset do_ipv4_only and do_ipv6_only correctly so that later the output "Testing all IP** addresses" is correct.
2025-07-22 14:38:42 +02:00
Dirk Wetter
d638843cc1 Merge pull request #2858 from testssl/code2network_socksend_x
Slightly improved strings @ pre-socket handling
2025-07-21 17:32:09 +02:00
Dirk Wetter
6c045e05ab Merge pull request #2855 from testssl/fix_2847+
Doing a better guess for Opossum when tcp/80 is not a/v
2025-07-21 16:24:37 +02:00
Dirk
eb75ac23b6 Slightly improved strings @ pre-socket handling
* `code2network()` was improved to just use internal bash functions, except sed
* `socksend()` was renamed to `socksend_x()` to clarify that the string passed contains already a leading x

We might want to try using in `code2network()` only bash internal functions like in `socksend_x()`.
And maybe decide for onee format of hexbytes in the code -- with x or without.
2025-07-21 16:15:13 +02:00
Dirk Wetter
727f6c9fa6 Fix bug when --nodns none --ip <IP> is supplied
Due to rebasing determine_ip_addresses() in #2852 it was
forgotten to add any manually specified IP address to
the IP addresses to show and to scan.

This fixes #2854 .
2025-07-21 10:27:23 +02:00
Dirk Wetter
cb971b5336 Doing a better guess for Opossum when tcp/80 is not a/v
This labels the result of a failed test for reaching
port 80 when no direct connection is possible as likely not
vulnerable.

This seems safe to say, as there's another check whether
a proxy is configured, like for corporate environments where
a connection is only allowed though the proxy.
2025-07-21 10:08:25 +02:00
Dirk Wetter
a549acd86d Merge pull request #2852 from testssl/full_ipv6
Enable IPv6 automagically
2025-07-20 20:56:34 +02:00
Dirk Wetter
274a9ca5d6 Merge pull request #2853 from testssl/quic_httpfix
only exec QUIC when SERVICE= HTTP
2025-07-20 18:06:14 +02:00
Dirk Wetter
e62949d39d Merge pull request #2851 from testssl/fix_2847
Fix port and block problem for Opossum
2025-07-20 18:05:19 +02:00
Dirk Wetter
e09d79aad9 Fix error message on UI when testing Opossum
As `wait_kill()` returns with 0 when a TCP reset is encountered
and the process is not killed, we need to open the socket again
in a sub shell. Which is safe in the foreground.

If then the subshell returns with 0 we can safely connect to
port 80.
2025-07-20 15:40:35 +02:00
Dirk Wetter
7a6c652de0 only exec QUIC when SERVICE= HTTP
... and document wait_kill better
2025-07-20 15:28:12 +02:00
Dirk Wetter
a05e697fd1 UI improvements IPv6
* IPv6 addresses which won't be scanned will be put in round brackets to feedback th UI
* logic bug fixed which always said "Testing all IPv4 addresses (port $PORT):". Simplyfied the MULTIPLE_CHECKS output
2025-07-20 14:46:48 +02:00
Dirk Wetter
433ab5118b fix typo 2025-07-19 16:19:42 +02:00
Dirk Wetter
4d1350ebf9 Enable IPv6 automagically
This PR will enable IPv6 fully if available.

It was not enabled before as users were confronted with an error message when
testssl.sh wanted (also) to scan IPv6 before but routing/configuration or
whatsoever issues prevented that. This has been solved by introducing the function
`shouldwedo_ipv6()` which checks whether we can reach the target via IPv6 --
tracked be the global IPv6_OK.

The change is in line with tools like wget or curl in a sense that if IPv6 works
it is just being used. Formally testssl.sh had to be instructed via -6 cmdline
option, like nmap.

* \-6 is now the switch to do IPv6 scans only
* \-4 is now the switch to do IPv4 scans only

The latter is a *breaking change*, as the cmdline option meant before to check
for RC4 ciphers.

Also HAS_IPv6, synonymous to -6 before, does not exist anymore.

As the command line option `--connect-timeout` seemed rather unspecific,
it has been replaced by `--socket-timeout, also all internal variables.

Todo:
* man pages
* dashed lines appear too long
2025-07-19 15:57:52 +02:00
Dirk
ea3cc3789f handle UI output better when conn to port 80 failed 2025-07-19 13:40:03 +02:00
Dirk
0d63a56c80 Fix logic error and mind the sub shell (fd) 2025-07-18 20:17:12 +02:00
Dirk
9e29b35e9e open socket error message, not stdout 2025-07-18 19:06:42 +02:00
Dirk
9743a96462 fix indentation 2025-07-18 18:30:08 +02:00
Dirk
cd7a887878 Fix port problem for Opossum
This fixes #2847 .

It was falsely assumed that the http head command blocks when port 80 is not available but
actucally the exec for the socket is the culprit.

This PR changes that so that the exec is put in the background.

Another change is that $node is still used but the port is stripped of which
lead to the problem raised in #2847. We use $node instead of $NODE has we
can recycle the `http_head[er]_printf()` later.

`http_header_printf()`was renamed to `http_head_printf()` as there's also an `http_head()`
and an `http_get()`
2025-07-18 18:18:30 +02:00