From 9fc8c337043338b2aa508e026317df3106b7fac8 Mon Sep 17 00:00:00 2001 From: Sole Date: Thu, 2 Feb 2023 00:42:15 +0000 Subject: [PATCH 1/5] 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. --- testssl.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/testssl.sh b/testssl.sh index 77d7bd6..1bbc7c0 100755 --- a/testssl.sh +++ b/testssl.sh @@ -9416,10 +9416,11 @@ certificate_info() { out "$indent"; pr_bold " Chain of trust"; out " " jsonID="cert_chain_of_trust" - if [[ "$issuer_O" =~ StartCom ]] || [[ "$issuer_O" =~ WoSign ]] || [[ "$issuer_CN" =~ StartCom ]] || [[ "$issuer_CN" =~ WoSign ]]; then - # Shortcut for this special case here. - pr_italic "WoSign/StartCom"; out " are " ; prln_svrty_critical "not trusted anymore (NOT ok)" - fileout "${jsonID}${json_postfix}" "CRITICAL" "Issuer not trusted anymore (WoSign/StartCom)" + # Looks for CA's that have their trust removed by the first part of their Organization Name as they can only used verified names + if [[ "$issuer_O" =~ ^(TrustCor Systems|WoSign|StartCom) ]]; then + # Shortcut for this special case here. There is a difference between not being in a root store and being removed from a root store. + pr_italic "$issuer_O"; out " is " ; prln_svrty_critical "actively removed from one or more root stores (NOT ok)" + fileout "${jsonID}${json_postfix}" "CRITICAL" "Issuer removed from one or more root stores ($issuer_O)" set_grade_cap "T" "Untrusted certificate chain" else # Also handles fileout, keep error if happened From 3670c1e4ad8479e32e44d6e76c9ff6039e643b4d Mon Sep 17 00:00:00 2001 From: Sole Date: Thu, 2 Feb 2023 01:13:00 +0000 Subject: [PATCH 2/5] Removed non-relevant CA's that no longer have active certificates. --- testssl.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testssl.sh b/testssl.sh index 1bbc7c0..16374ae 100755 --- a/testssl.sh +++ b/testssl.sh @@ -9416,8 +9416,8 @@ certificate_info() { out "$indent"; pr_bold " Chain of trust"; out " " jsonID="cert_chain_of_trust" - # Looks for CA's that have their trust removed by the first part of their Organization Name as they can only used verified names - if [[ "$issuer_O" =~ ^(TrustCor Systems|WoSign|StartCom) ]]; then + # Looks for CA's that have their trust removed by the first part of their Organization Name, add multiple with ^(TrustCor Systems|WoSign) etc. + if [[ "$issuer_O" =~ ^(TrustCor Systems) ]]; then # Shortcut for this special case here. There is a difference between not being in a root store and being removed from a root store. pr_italic "$issuer_O"; out " is " ; prln_svrty_critical "actively removed from one or more root stores (NOT ok)" fileout "${jsonID}${json_postfix}" "CRITICAL" "Issuer removed from one or more root stores ($issuer_O)" From 76b8f0c981805f840f8b2832adebadcc8791e068 Mon Sep 17 00:00:00 2001 From: Brennan Kinney <5098581+polarathene@users.noreply.github.com> Date: Thu, 2 Feb 2023 14:26:16 +1300 Subject: [PATCH 3/5] chore: Remove redundant `mkdir` - If local folder ownership is for example `644` it will fail to handle the `COPY` regardless (while `744` would work). - Creating the directory with higher permissions in the container does not appear to help. --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2ccf505..34fa45a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,8 +6,7 @@ RUN apk update && \ rm -rf /var/cache/apk/* && \ addgroup testssl && \ adduser -G testssl -g "testssl user" -s /bin/bash -D testssl && \ - ln -s /home/testssl/testssl.sh /usr/local/bin/ && \ - mkdir -m 755 -p /home/testssl/etc /home/testssl/bin + ln -s /home/testssl/testssl.sh /usr/local/bin/ USER testssl WORKDIR /home/testssl/ From b661f7b8d348872203f09084eef59d43681d2284 Mon Sep 17 00:00:00 2001 From: David Cooper Date: Thu, 2 Feb 2023 16:56:42 -0800 Subject: [PATCH 4/5] Update documentation for cipherlists tests The sets of cipher lists checked by `run_cipherslists()` changed in 3.1dev, but the documentation was not updated. --- doc/testssl.1 | 10 ++++++---- doc/testssl.1.html | 10 ++++++---- doc/testssl.1.md | 9 +++++---- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/doc/testssl.1 b/doc/testssl.1 index c34ece8..030774a 100644 --- a/doc/testssl.1 +++ b/doc/testssl.1 @@ -128,13 +128,15 @@ Any single check switch supplied as an argument prevents testssl\.sh from doing .IP "\[ci]" 4 \fBExport ciphers\fR (w/o the preceding ones): 'EXPORT:!ADH:!NULL' .IP "\[ci]" 4 -\fBLOW\fR (64 Bit + DES ciphers, without EXPORT ciphers): 'LOW:DES:RC2:RC4:!ADH:!EXP:!NULL:!eNULL' +\fBLOW\fR (64 Bit + DES ciphers, without EXPORT ciphers): 'LOW:DES:RC2:RC4:MD5:!ADH:!EXP:!NULL:!eNULL:!AECDH' .IP "\[ci]" 4 -\fB3DES + IDEA Ciphers\fR: '3DES:IDEA:!aNULL:!ADH' +\fB3DES + IDEA ciphers\fR: '3DES:IDEA:!aNULL:!ADH:!MD5' .IP "\[ci]" 4 -\fBAverage grade Ciphers\fR: 'HIGH:MEDIUM:AES:CAMELLIA:ARIA:!IDEA:!CHACHA20:!3DES:!RC2:!RC4:!AESCCM8:!AESCCM:!AESGCM:!ARIAGCM:!aNULL' +\fBObsoleted CBC ciphers\fR: 'HIGH:MEDIUM:AES:CAMELLIA:ARIA:!IDEA:!CHACHA20:!3DES:!RC2:!RC4:!AESCCM8:!AESCCM:!AESGCM:!ARIAGCM:!aNULL:!MD5' .IP "\[ci]" 4 -\fBStrong grade Ciphers\fR (AEAD): 'AESGCM:CHACHA20:CamelliaGCM:AESCCM8:AESCCM' +\fBStrong ciphers with no FS\fR (AEAD): 'AESGCM:CHACHA20:CamelliaGCM:AESCCM:ARIAGCM:!kEECDH:!kEDH:!kDHE:!kDHEPSK:!kECDHEPSK:!aNULL' +.IP "\[ci]" 4 +\fBForward Secrecy strong ciphers\fR (AEAD): 'AESGCM:CHACHA20:CamelliaGCM:AESCCM:ARIAGCM:!kPSK:!kRSAPSK:!kRSA:!kDH:!kECDH:!aNULL' .IP "" 0 .P \fB\-f, \-\-fs, \-\-nsa, \-\-forward\-secrecy\fR Checks robust forward secrecy key exchange\. "Robust" means that ciphers having intrinsic severe weaknesses like Null Authentication or Encryption, 3DES and RC4 won't be considered here\. There shouldn't be the wrong impression that a secure key exchange has been taking place and everything is fine when in reality the encryption sucks\. Also this section lists the available elliptical curves and Diffie Hellman groups, as well as FFDHE groups (TLS 1\.2 and TLS 1\.3)\. diff --git a/doc/testssl.1.html b/doc/testssl.1.html index 9b43ca6..21d35db 100644 --- a/doc/testssl.1.html +++ b/doc/testssl.1.html @@ -247,13 +247,15 @@ in /etc/hosts. The use of the switch is only useful if you either
  • Export ciphers (w/o the preceding ones): 'EXPORT:!ADH:!NULL'
  • -LOW (64 Bit + DES ciphers, without EXPORT ciphers): 'LOW:DES:RC2:RC4:!ADH:!EXP:!NULL:!eNULL'
  • +LOW (64 Bit + DES ciphers, without EXPORT ciphers): 'LOW:DES:RC2:RC4:MD5:!ADH:!EXP:!NULL:!eNULL:!AECDH'
  • -3DES + IDEA Ciphers: '3DES:IDEA:!aNULL:!ADH'
  • +3DES + IDEA ciphers: '3DES:IDEA:!aNULL:!ADH:!MD5'
  • -Average grade Ciphers: 'HIGH:MEDIUM:AES:CAMELLIA:ARIA:!IDEA:!CHACHA20:!3DES:!RC2:!RC4:!AESCCM8:!AESCCM:!AESGCM:!ARIAGCM:!aNULL'
  • +Obsoleted CBC ciphers: 'HIGH:MEDIUM:AES:CAMELLIA:ARIA:!IDEA:!CHACHA20:!3DES:!RC2:!RC4:!AESCCM8:!AESCCM:!AESGCM:!ARIAGCM:!aNULL:!MD5'
  • -Strong grade Ciphers (AEAD): 'AESGCM:CHACHA20:CamelliaGCM:AESCCM8:AESCCM'
  • +Strong ciphers with no FS (AEAD): 'AESGCM:CHACHA20:CamelliaGCM:AESCCM:ARIAGCM:!kEECDH:!kEDH:!kDHE:!kDHEPSK:!kECDHEPSK:!aNULL' +
  • +Forward Secrecy strong ciphers (AEAD): 'AESGCM:CHACHA20:CamelliaGCM:AESCCM:ARIAGCM:!kPSK:!kRSAPSK:!kRSA:!kDH:!kECDH:!aNULL'
  • -f, --fs, --nsa, --forward-secrecy Checks robust forward secrecy key exchange. "Robust" means that ciphers having intrinsic severe weaknesses like Null Authentication or Encryption, 3DES and RC4 won't be considered here. There shouldn't be the wrong impression that a secure key exchange has been taking place and everything is fine when in reality the encryption sucks. Also this section lists the available elliptical curves and Diffie Hellman groups, as well as FFDHE groups (TLS 1.2 and TLS 1.3).

    diff --git a/doc/testssl.1.md b/doc/testssl.1.md index 2a69f46..1795cc4 100644 --- a/doc/testssl.1.md +++ b/doc/testssl.1.md @@ -166,10 +166,11 @@ Any single check switch supplied as an argument prevents testssl.sh from doing a * `NULL encryption ciphers`: 'NULL:eNULL' * `Anonymous NULL ciphers`: 'aNULL:ADH' * `Export ciphers` (w/o the preceding ones): 'EXPORT:!ADH:!NULL' -* `LOW` (64 Bit + DES ciphers, without EXPORT ciphers): 'LOW:DES:RC2:RC4:!ADH:!EXP:!NULL:!eNULL' -* `3DES + IDEA Ciphers`: '3DES:IDEA:!aNULL:!ADH' -* `Average grade Ciphers`: 'HIGH:MEDIUM:AES:CAMELLIA:ARIA:!IDEA:!CHACHA20:!3DES:!RC2:!RC4:!AESCCM8:!AESCCM:!AESGCM:!ARIAGCM:!aNULL' -* `Strong grade Ciphers` (AEAD): 'AESGCM:CHACHA20:CamelliaGCM:AESCCM8:AESCCM' +* `LOW` (64 Bit + DES ciphers, without EXPORT ciphers): 'LOW:DES:RC2:RC4:MD5:!ADH:!EXP:!NULL:!eNULL:!AECDH' +* `3DES + IDEA ciphers`: '3DES:IDEA:!aNULL:!ADH:!MD5' +* `Obsoleted CBC ciphers`: 'HIGH:MEDIUM:AES:CAMELLIA:ARIA:!IDEA:!CHACHA20:!3DES:!RC2:!RC4:!AESCCM8:!AESCCM:!AESGCM:!ARIAGCM:!aNULL:!MD5' +* `Strong ciphers with no FS` (AEAD): 'AESGCM:CHACHA20:CamelliaGCM:AESCCM:ARIAGCM:!kEECDH:!kEDH:!kDHE:!kDHEPSK:!kECDHEPSK:!aNULL' +* `Forward Secrecy strong ciphers` (AEAD): 'AESGCM:CHACHA20:CamelliaGCM:AESCCM:ARIAGCM:!kPSK:!kRSAPSK:!kRSA:!kDH:!kECDH:!aNULL' `-f, --fs, --nsa, --forward-secrecy` Checks robust forward secrecy key exchange. "Robust" means that ciphers having intrinsic severe weaknesses like Null Authentication or Encryption, 3DES and RC4 won't be considered here. There shouldn't be the wrong impression that a secure key exchange has been taking place and everything is fine when in reality the encryption sucks. Also this section lists the available elliptical curves and Diffie Hellman groups, as well as FFDHE groups (TLS 1.2 and TLS 1.3). From 3d82f7cb211f6f2c2623b36d04ab760a7e30909e Mon Sep 17 00:00:00 2001 From: David Cooper Date: Fri, 3 Feb 2023 14:18:02 -0800 Subject: [PATCH 5/5] 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). --- testssl.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/testssl.sh b/testssl.sh index 16374ae..58a1c23 100755 --- a/testssl.sh +++ b/testssl.sh @@ -535,11 +535,11 @@ html_reserved(){ local output "$do_html" || return 0 #sed -e 's/\&/\&/g' -e 's//\>/g' -e 's/"/\"/g' -e "s/'/\'/g" <<< "$1" - output="${1//&/&}" - output="${output///>}" - output="${output//\"/"}" - output="${output//\'/'}" + output="${1//&/$'&'amp;}" + output="${output///$'&'gt;}" + output="${output//\"/$'&'quot;}" + output="${output//\'/$'&'apos;}" printf -- "%s" "$output" return 0 }