Skip to content

[Possible BUG] Docker: Non Functional Certificate OCSP Certificate Revocation Check #2667

@lwillek

Description

@lwillek

Hello @drwetter

I think I found a possible bug when checking the certificate revocation status when using docker. The OCSP check did not succeed for me as expected, resulted in incorrect outputs and too high ratings in case a certificate has been actually revoked.

To exclude any issues with my own certificates or my own environment, I ended up using the revoked example from badssl.com, and tested with the Docker images you provide at Docker Hub. I could reproduce the issues I have seen on my local environment.

It is worth pointing out that if I git clone testssl and run it locally, then everything is fine, the correct results are shown.

Short Issue Description

  • I do expect that in case a certificate is actually revoked, the OCSP check should fail with a critical status, should indicate the "revoked" state, and should cap the overall rating (grade) at T.
  • However, when using testssl.sh in versions 3.0 or 3.2, the OCSP check produces a warning only, stating "empty OCSP response."

Expected Behavior: Version 3.1dev

The expected behave is seen when using the older drwetter/testssl.sh:3.1dev docker container:

$ docker run --rm -t -v $(pwd):/d drwetter/testssl.sh:3.1dev --quiet --wide --color 3 --full --phone-out --jsonfile-pretty /d/o.json --severity CRITICAL revoked.badssl.com

[output shortened]
 OCSP URI                     http://e6.o.lencr.org, revoked
[output shortened]
 Overall Grade                T
 Grade cap reasons            Grade capped to T. Certificate revoked

$ jq '.scanResult[] | with_entries(select(.value | length > 0))' o.json
{
  "targetHost": "revoked.badssl.com",
  "ip": "104.154.89.105",
  "port": "443",
  "rDNS": "105.89.154.104.bc.googleusercontent.com.",
  "service": "HTTP",
  "serverDefaults": [
    {
      "id": "cert_ocspRevoked",
      "severity": "CRITICAL",
      "finding": "revoked"
    }
  ],
  "rating": [
    {
      "id": "overall_grade",
      "severity": "CRITICAL",
      "finding": "T"
    }
  ]
}

Actual Behavior: Version 3.2

This version throws a "Segmentation fault" as well.

$ docker run --rm -t -v $(pwd):/d drwetter/testssl.sh:3.2 --quiet --wide --color 3 --full --phone-out --jsonfile-pretty /d/o.json --severity CRITICAL revoked.badssl.com

[output shortened]
 OCSP URI                     http://e6.o.lencr.org/usr/local/bin/testssl.sh: line 2044: 20998 Segmentation fault      $OPENSSL ocsp -no_nonce ${host_header} -url "$uri" -issuer $TEMPDIR/hostcert_issuer.pem -verify_other $TEMPDIR/intermediatecerts.pem -CAfile <(cat $ADDTL_CA_FILES "$GOOD_CA_BUNDLE") -cert $HOSTCERT -text &> "$tmpfile"
, error querying OCSP responder (empty ocsp response)

[output shortened]

 Cipher Strength  (weighted)  90 (36)
 Final Score                  94
 Overall Grade                B


$ jq '.scanResult[] | with_entries(select(.value | length > 0))' o.json
{
  "targetHost": "revoked.badssl.com",
  "ip": "104.154.89.105",
  "port": "443",
  "rDNS": "105.89.154.104.bc.googleusercontent.com.",
  "service": "HTTP",
  "serverDefaults": [
    {
      "id": "cert_ocspRevoked",
      "severity": "WARN",
      "finding": "empty ocsp response"
    }
  ]
}

Actual Behavior: Version 3.0

I could reproduce the issue there as well:

$ docker run --rm -t -v $(pwd):/d drwetter/testssl.sh:3.0 --quiet --wide --color 3 --full --phone-out --jsonfile-pretty /d/o.json --severity CRITICAL revoked.badssl.com

[output shortened]
 OCSP URI                     http://e6.o.lencr.org, error querying OCSP responder

$ jq '.scanResult[] | with_entries(select(.value | length > 0))' o.json
{
  "targetHost": "revoked.badssl.com",
  "ip": "104.154.89.105",
  "port": "443",
  "rDNS": "105.89.154.104.bc.googleusercontent.com.",
  "service": "HTTP",
  "serverDefaults": [
    {
      "id": "cert_ocspRevoked",
      "severity": "WARN",
      "finding": ""
    }
  ]
}

Additional Information

$ docker images -f "reference=drwetter/testssl.sh"
REPOSITORY            TAG       IMAGE ID       CREATED         SIZE
drwetter/testssl.sh   3.2       b61c7e88d2e9   2 days ago      60.3MB
drwetter/testssl.sh   3.0       9ecedd099c64   2 days ago      42.7MB
drwetter/testssl.sh   3.1dev    08f3f6548eef   19 months ago   55.5MB

This is how I tested manually. The only reason here to use the docker image is to exclude any local configuration issues on my end.

$ docker run -it --entrypoint /bin/bash drwetter/testssl.sh:3.2

bash-4.4$ # Get the certificates and store them as seperate file in /tmp
bash-4.4$ echo | openssl s_client -connect revoked.badssl.com:443 -showcerts 2>/dev/null | sed -n '/-----BEGIN/,/-----END/p' | awk '/-----BEGIN/{f="cert"++i".pem"} {print > "/tmp/"f}'
bash-4.4$ ls /tmp/cert*
/tmp/cert1.pem	/tmp/cert2.pem

bash-4.4$ # Get the OCSP URL
bash-4.4$ openssl x509 -noout -ocsp_uri < /tmp/cert1.pem
http://e6.o.lencr.org

bash-4.4$ # Perform the OCSP Request
bash-4.4$ openssl ocsp -issuer /tmp/cert2.pem -cert /tmp/cert1.pem -url http://e6.o.lencr.org -noverify
/tmp/cert1.pem: revoked
	This Update: Feb 22 05:42:00 2025 GMT
	Next Update: Mar  1 05:41:58 2025 GMT
	Reason: keyCompromise
	Revocation Time: Dec 19 19:19:49 2024 GMT

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions