Skip to content

Cheatsheet · Web pentesting · Infrastructure and AD pentesting

testssl.sh: TLS/SSL audit, protocols, ciphers, vulnerabilities and headers

testssl.sh to audit TLS: full run, protocols, cipher suites, vulnerabilities, headers, STARTTLS, mass testing and output formats, with grading.

By Steven Carrier Published

Official website: testssl.sh

testssl.sh is a shell script that queries a TLS service and describes its configuration: protocols, cipher suites, certificate, known vulnerabilities and security headers. It changes nothing on the target, but it opens many connections: keep it within the scope agreed using the penetration test scoping checklist. Replace target.example and 10.0.0.12 with your authorised targets. To find the exposed TLS services first, see the Nmap cheatsheet.

Run a full pass

# All the usual checks against an HTTPS site
testssl.sh https://target.example

# Another port, or a non-HTTP service
testssl.sh target.example:8443

# Test a specific IP address (load balancer, origin server) keeping the name for SNI
testssl.sh --ip 10.0.0.12 target.example

# Hide the banner and set timeouts
testssl.sh --quiet --connect-timeout 10 --openssl-timeout 10 https://target.example

With no option, testssl.sh runs the default checks (protocols, cipher categories, forward secrecy, server defaults and certificate, HTTP headers, vulnerabilities, client simulation) and prints a grade. Depending on the service, allow several minutes. Run testssl.sh --version to find out which version you used, and record it in the report.

Target a single check

Option Check
-p, --protocols TLS/SSL protocols, ALPN and HTTP/2
-s, --std cipher suite categories by strength
-f, --fs forward secrecy
-S, --server-defaults server defaults and certificate details
-P, --server-preference the server’s cipher suite preference order
-h, --headers HSTS, banners, security headers, cookies
-U, --vulnerable all applicable vulnerabilities
-c, --client-simulation browsers and clients that negotiate with the server
-e, --each-cipher every cipher suite, one by one (slow)
# Protocols and cipher suites only
testssl.sh -p -s https://target.example

# Certificate and server defaults
testssl.sh -S https://target.example

# Security headers
testssl.sh -h https://target.example

Known vulnerabilities

# All applicable vulnerabilities
testssl.sh -U https://target.example

# A few specific checks
testssl.sh --heartbleed --robot --poodle --sweet32 https://target.example

Common individual options: -H (Heartbleed), -I (CCS injection), -R (renegotiation), -C (CRIME), -B (BREACH), -O (POODLE), -W (SWEET32), -A (BEAST), -F (FREAK), -J (Logjam), -D (DROWN), --BB (ROBOT). Each result states whether the server is vulnerable, not vulnerable or whether the test is not applicable. A "potentially vulnerable" result needs manual verification. For fragile environments, --ids-friendly skips a few checks that may cause an IDS to block the source address.

STARTTLS services

# Plain SMTP that upgrades to TLS (STARTTLS)
testssl.sh --starttls smtp target.example:25

# Other supported protocols: ftp, lmtp, pop3, imap, xmpp, xmpp-server, telnet, ldap, nntp, sieve, postgres, mysql
testssl.sh -t imap target.example:143

# Mail servers of a domain, from highest to lowest priority
testssl.sh --mx example.org

--mx queries the domain’s MX records: check that the mail servers are really part of the scope, as they sometimes belong to a provider.

Output formats

# Text log, JSON, CSV and HTML in the current directory, with prefixed names
testssl.sh --outprefix engagement-001 --log --json --csv --html https://target.example

# Or every format at once into an evidence directory (like nmap's -oA; structured JSON)
mkdir -p evidence/tls
testssl.sh -oA evidence/tls/ https://target.example

# Structured JSON (more readable than flat JSON)
testssl.sh --json-pretty https://target.example

# Keep only findings of MEDIUM severity and above in CSV and JSON
testssl.sh --severity MEDIUM --json --csv https://target.example

# Add remediation hints to the findings
testssl.sh --hints https://target.example

Files are named <host>-p<port><date>.<extension>. --append and --overwrite set the behaviour when a file already exists: by default, testssl.sh refuses to overwrite. Keep the full log and the HTML in the engagement evidence.

Mass testing

# One file: one line = one testssl.sh command line (options + target)
cat > targets.txt <<'LIST'
--starttls smtp mail.target.example:25
https://target.example
10.0.0.12:8443
LIST

# Run serially (default) or in parallel
testssl.sh --file targets.txt --mode serial --jsonfile evidence/tls/
testssl.sh --file targets.txt --parallel

Parallel mode speeds up audits but multiplies simultaneous connections to the scope: limit it on fragile hosts. --file implicitly turns on --warnings batch, which stops processing at the first test error; --warnings off ignores it and carries on.

Interpret the results

testssl.sh classifies findings by severity (OK, LOW, MEDIUM, HIGH, CRITICAL) and, unless --disable-rating is used, derives a grade from A+ to F inspired by the SSL Labs method. Keep in mind:

  • The grade summarises a configuration, not a business risk: a low-exposure internal service does not call for the same urgency as a public portal.
  • SSLv2, SSLv3, TLS 1.0 and TLS 1.1 are obsolete (RFC 8996 for TLS 1.0 and 1.1); having them enabled is a finding to report, with context (legacy clients to serve?).
  • An expired certificate, a name mismatch or an incomplete chain weighs more than a secondary cipher suite.
  • A reported vulnerability that depends on a library version or an intermediate device must be confirmed before it is rated.
  • Results can vary: a load balancer may answer differently depending on the IP address, hence the value of also testing with --ip.

Record the testssl.sh version, the exact command, the date and the target in each finding.

Sources

Related resources

  • AI prompt · Web pentesting · Infrastructure and AD pentesting

    Critical vulnerability alert prompt

    Prompt that drafts the urgent client notification when a critical vulnerability is found during testing: facts, impact and immediate containment advice.

    Published

  • AI prompt · Infrastructure and AD pentesting · Web pentesting

    CVE summary prompt

    Prompt that summarises a CVE or vendor advisory: affected versions, conditions, impact, applicability questions for the client, fix and limits.

    Published

  • Tool · Web pentesting · Infrastructure and AD pentesting

    CVSS 3.1 calculator

    Compute the CVSS 3.1 base score, severity and vector string of a vulnerability, or paste an existing vector to review it. Runs in your browser.

    Published

BEAROPS

Need a penetration test?

BEAROPS experts test your applications, infrastructure and cloud, black box or grey box, following OWASP, NIST and ANSSI guidance.