TESTSSL(1)
π NAME π
okay so this is testssl(1) from the General Commands Manual, and it's the page for testssl.sh β a free command line tool that checks encryption of SSL/TLS servers. The NAME section literally gives you both testssl and testssl.sh -- check encryption of SSL/TLS servers, so yeah bestie, both are here and both are iconic. π
β¨ SYNOPSIS β¨
testssl.sh [OPTIONS] <URI>, testssl.sh [OPTIONS] --file <FILE>
or
testssl.sh [BANNER OPTIONS]
πΈ DESCRIPTION πΈ
testssl.sh is a free command line tool that checks a server's service on any port for support of TLS/SSL ciphers, protocols, cryptographic flaws, and much more. It's giving security audit but make it terminal. π₯
The output rates findings by color on screen or by severity in file output, so you can tell whether something is good or bad. The screen output has several sections where classes of checks are performed. To ease readability on the screen it aligns and indents the output properly. Obsessed with a tool that formats itself, honestly.
Only you see the result. You also can use it internally on your LAN. Except DNS lookups, or unless you instruct testssl.sh to check for revocation of certificates, it doesn't use any other hosts or even third parties for any test. Privacy queen behavior. π
π§ REQUIREMENTS π§
testssl.sh is out of the box portable: it runs under any Unix-like stack β Linux, *BSD, MacOS X, WSL=Windows Subsystem for Linux, Cygwin, and MSYS2. bash is a prerequisite, and version 3 is still supported. Standard utilities like awk, sed, tr, and head are also needed. This can be of a BSD, System 5, or GNU flavor, whereas grep from System V is not yet supported. Noted, bestie.
Any OpenSSL or LibreSSL version is needed as a helper. Unlike previous versions of testssl.sh, almost every check is done via (TCP) sockets. In addition, statically linked OpenSSL binaries for major operating systems are supplied in ./bin/. π¦
π GENERAL π
testssl.sh URI as the default invocation does the so-called default run, which does a number of checks and puts out the results colorized (ANSI and termcap) on the screen. It does every check listed below except -E, and these are in order of appearance:
- displays a banner (see below), does a DNS lookup also for further IP addresses, and does for the returned IP address a reverse lookup. Last but not least, a service check is being done.
- SSL/TLS protocol check
- standard cipher categories to give you upfront an idea for the ciphers supported
- checks (perfect) forward secrecy: ciphers and elliptical curves
- server preferences (server order)
- server defaults (certificate info, TLS extensions, session information)
- HTTP header (if HTTP detected or being forced via
--assume-http) - vulnerabilities
- testing each of
370preconfigured ciphers - client simulation
π OPTIONS AND PARAMETERS π
Options are either short or long options. Any long or short option requiring a value can be called with or without an equal sign. E.g. this:
testssl.sh -t=smtp --wide --openssl=/usr/bin/openssl <URI>
β¦is short options with equal sign, and it's equivalent to this:
testssl.sh --starttls smtp --wide --openssl /usr/bin/openssl <URI>
β¦which is long option without equal sign. Some command line options can also be preset via ENV variables. This:
WIDE=true OPENSSL=/usr/bin/openssl testssl.sh --starttls=smtp <URI>
β¦would be the equivalent to the aforementioned examples. Preference has the command line over any environment variables. Command line stays main character, periodt.
π¨<URI>or--file <FILE>always needs to be the last parameter.
π BANNER OPTIONS π
--helpβ or no arg: display command line help. No thoughts, just help text.-b,--bannerβ displays thetestssl.shbanner, including license, usage conditions, version oftestssl.sh, detected openssl version, its path to it, # of ciphers of openssl, its build date, and the architecture. It's giving ID card but for a script.-v,--versionβ same as before. Version check, but make it dΓ©jΓ vu.-V[pattern],--local[pattern] β pretty print all local ciphers supported by openssl version. If a pattern is supplied it performs a match (ignore case) on any of the strings supplied in the wide output, see below. The pattern will be searched in any of the columns:hexcode,cipher suite name(OpenSSL or IANA),key exchange,encryption,bits. It does a word pattern match for non-numbers; for number just a normal match applies. Numbers here are defined as[0-9,A-F]. This means (attention: catch) that the patternCBCis matched as non-word, butAESas word. iykyk, the pattern matching has lore.
π₯ INPUT PARAMETERS π₯
URI can be a hostname, an IPv4 or IPv6 address (restriction see below), or an URL. IPv6 addresses need to be in square brackets. For any given parameter, port 443 is assumed unless specified by appending a colon and a port number. The only preceding protocol specifier allowed is https. You need to be aware that checks for an IP address might not hit the vhost you want. DNS resolution (A/AAAA record) is being performed unless you have an /etc/hosts entry for the hostname. DNS girlies, stay alert.
--file <fname>, or the equivalent-iL <fname>β mass testing options. Per default it implicitly turns on--warnings batch.
In its first incarnation, the mass testing option reads command lines from fname. fname consists of command lines of testssl, one line per instance. Comments after # are ignored, EOF signals the end of fname, and any subsequent lines will be ignored too. You can also supply additional options which will be inherited to each child, e.g. when invoking testssl.sh --wide --log --file <fname> . Each single line in fname is parsed upon execution. If there's a conflicting option and serial mass testing option is being performed, the check will be aborted at the time it occurs and, depending on the output option, potentially leaving you with an output file without footer. In parallel mode the mileage varies, likely a line won't be scanned. Mass testing: powerful, but do not expect it to be a calm little brunch.
Alternatively, fname can be in nmap's grep(p)able output format (-oG). Only open ports will be considered. Multiple ports per line are allowed. The ports can be different and will be tested by testssl.sh according to common practice in the internet, i.e. if nmap shows in its output an open port 25, automatically -t smtp will be added before the URI, whereas port 465 will be treated as a plain TLS/SSL port, not requiring an STARTTLS SMTP handshake upfront. This is done by an internal table which correlates nmap's open port detected to the STARTTLS/plain text decision from testssl.sh. Internal table said βI'll handle it,β and honestly? It did.
Nmap's output always returns IP addresses and only if there's a PTR DNS record available a hostname. As it is not checked by nmap whether the hostname matches the IP (A or AAAA record), testssl.sh does this automatically for you. If the A record of the hostname matches the IP address, the hostname is used and not the IP address. Please keep in mind that checks against an IP address might not hit the vhost you maybe were aiming at and thus it may lead to different results. Vhost plot twist is real.
A typical internal conversion to testssl.sh file format from nmap's grep(p)able format could look like:
10.10.12.16:443 10.10.12.16:1443 -t smtp host.example.com:25
host.example.com:443 host.example.com:631 -t ftp 10.10.12.11:21
10.10.12.11:8443
Please note that fname has to be in Unix format. DOS carriage returns won't be accepted. Instead of the command line switch the environment variable FNAME will be honored too. Unix format or it's not coming in, bestie.
--mode <serial|parallel>β mass testing to be doneserial(default) orparallel(--parallelis shortcut for the latter,--serialis the opposite option). Per default mass testing is being run in serial mode, i.e. one line after the other is processed and invoked. The variableMASS_TESTING_MODEcan be defined to be either equalserialorparallel. Choose your fighter: line-by-line or chaos mode.--warnings <batch|off>β the warnings parameter determines howtestssl.shwill deal with situations where user input normally will be necessary. There are two options.batchdoesn't wait for a confirming keypress when a client- or server-side problem is encountered. As of3.0it just then terminates the particular scan. This is automatically chosen for mass testing (--file).offjust skips the warning, the confirmation but continues the scan, independent whether it makes sense or not. Please note that there are conflicts wheretestssl.shwill still ask for confirmation which are the ones which otherwise would have a drastic impact on the results. Almost any other decision will be made in the future as a best guess bytestssl.sh. The same can be achieved by setting the environment variableWARNINGS. Warnings said βbestie, are you sure?β and sometimes it still means it.--connect-timeout <seconds>β this is useful for socket TCP connections to a node. If the node does not complete a TCP handshake (e.g. because it is down or behind a firewall or there's an IDS or a tarpit),testssl.shmay usually hang for around2minutes or even much more. This parameter instructstestssl.shto wait at most seconds for the handshake to complete before giving up. This option only works if your OS has atimeoutbinary installed.CONNECT_TIMEOUTis the corresponding environment variable. No more two-minute staring contest with a firewall. Or at least less of it.--openssl-timeout <seconds>β this is especially useful for all connects using openssl and practically useful for mass testing. It avoids the openssl connect to hang for ~2minutes. The expected parameter seconds instructstestssl.shto wait before the openssl connect will be terminated. The option is only available if your OS has atimeoutbinary installed. As there are different implementations oftimeout: it automatically calls the binary with the right parameters.OPENSSL_TIMEOUTis the equivalent environment variable. Timeout binary said βI'll adapt,β and that's highkey iconic.--basicauth <user:pass>β this can be set to provide HTTP basic auth credentials which are used during checks for security headers.BASICAUTHis the ENV variable you can use instead. Credentials but make it header-checking era.
π SPECIAL INVOCATIONS π
-t <protocol>,--starttls <protocol>β does a default run against a STARTTLS enabled protocol. protocol must be one offtp,smtp,pop3,imap,xmpp,telnet,ldap,irc,lmtp,nntp,postgres,mysql. For the latter four you need e.g. the supplied OpenSSL or OpenSSL version1.1.1. Please note: MongoDB doesn't offer a STARTTLS connection, LDAP currently only works with--ssl-native.telnetandircis WIP. The WIP girlies are still in the group chat.--xmpphost <jabber_domain>β is an additional option for STARTTLS enabled XMPP: it expects the jabber domain as a parameter. This is only needed if the domain is different from the URI supplied. XMPP said βit's complicated.β--mx <domain|host>β tests all MX records (STARTTLS on port25) from high to low priority, one after the other. Priority order, bestie. Respect the queue.--ip <ip>β tests either the supplied IPv4 or IPv6 address instead of resolving host(s) in<URI>. IPv6 addresses need to be supplied in square brackets.--ip=onemeans: just test the first A record DNS returns (useful for multiple IPs). If-6and--ip=onewas supplied, an AAAA record will be picked if available. The--ipoption might be also useful if you want to resolve the supplied hostname to a different IP, similar as if you would edit/etc/hostsor/c/Windows/System32/drivers/etc/hosts.--ip=proxytries a DNS resolution via proxy. IP shenanigans: handled. β¨--proxy <host>:<port>β does ANY check via the specified proxy. And like, any check, bestie, we're not picky.--proxy=autoβ inherits the proxy setting from the environment. The hostname you supply gets resolved to the first A record. Bonus: if you want lookups via proxy you can specifyDNS_VIA_PROXY=true. Okay so real talk β OCSP revocation checking (-S --phone-out) is not supported by OpenSSL via proxy. And since supplying a proxy is basically a big neon sign saying "port 80 and 443 outgoing are blocked in your network," an OCSP revocation check won't be performed. However π ifIGN_OCSP_PROXY=truehas been supplied, it will be tried directly. Authentication to the proxy? Not supported. Proxying via IPv6 addresses? Not possible. HTTPS or SOCKS proxy? Also no. Sorry babe π-6β does (also) IPv6 checks. Please note that testssl.sh doesn't perform checks on an IPv6 address automatically, because of two reasons: testssl.sh does no connectivity checks for IPv6, and it cannot determine reliably whether the OpenSSL binary you're using has IPv6 s_client support.-6just assumes both are the case. If both conditions are met and you in general prefer to test for IPv6 branches as well, you can addHAS_IPv6to your shell environment. Besides the OpenSSL binary supplied, IPv6 is known to work with vanilla OpenSSL >= 1.1.0 and older versions >=1.0.2 in RHEL/CentOS/FC and Gentoo.--ssl-nativeβ Instead of using a mixture of bash sockets and a few openssl s_client connects, testssl.sh uses the latter (almost) only. She's faster at the moment but provides less accurate results, especially for the client simulation and for cipher support. For all checks you will see a warning if testssl.sh cannot tell if a particular check cannot be performed. For some checks however you might end up getting false negatives without a warning π. This option is only recommended if you prefer speed over accuracy or you know that your target has sufficient overlap with the protocols and cipher provided by your openssl binary.--openssl <path_to_openssl>β testssl.sh tries very hard to find automagically the binary supplied (where the tree of testssl.sh resides, from the directory where testssl.sh has been started from, etc.). If all that doesn't work it falls back to openssl supplied from the OS ($PATH). With this option you can point testssl.sh to your binary of choice and override any internal magic to find the openssl binary. (Environment preset viaOPENSSL=<path_to_openssl>).
π TUNING OPTIONS π
--bugsβ does some workarounds for buggy servers like padding for old F5 devices. The option is passed as-bugto openssl when needed, sees_client(1), environment preset viaBUGS="-bugs"(1x dash, bestie, one dash). For the socket part testssl.sh has always workarounds in place to cope with broken server implementations. She's got your back π«Ά--assuming-httpβ testssl.sh normally does upfront an application protocol detection. In cases where HTTP cannot be automatically detected you may want to use this option. It enforces testssl.sh not to skip HTTP specific tests (HTTP header) and to run a browser based client simulation. Please note that sometimes also the severity depends on the application protocol, e.g. SHA1 signed certificates, the lack of any SAN matches and some vulnerabilities will be punished harder when checking a web server as opposed to a mail server. She's judging you differently depending on the context, ngl π-n,--nodns <min|none>β tells testssl.sh which DNS lookups should be performed.minuses only forward DNS resolution (A and AAAA record or MX record) and skips CAA lookups and PTR records from the IP address back to a DNS name.noneperforms no DNS lookups at all. For the latter you either have to supply the IP address as a target, to use--ipor have the IP address in/etc/hosts. The use of the switch is only useful if you either can't or are not willing to perform DNS lookups. The latter can apply e.g. to some pentests. In general this option could e.g. help you to avoid timeouts by DNS lookups.NODNSis the environment variable for this.--sneakyβ For HTTP header checks testssl.sh uses normally the server friendly HTTP user agent TLS tester from${URL}. With this option your traces are less verbose and a Firefox user agent is being used. Be aware that it doesn't hide your activities. That is just not possible (environment preset viaSNEAKY=true). Like bestie, she can't make you invisible, she can only make you quieter π--ids-friendlyβ is a switch which may help to get a scan finished which otherwise would be blocked by a server side IDS. This switch skips tests for the following vulnerabilities: Heartbleed, CCS Injection, Ticketbleed and ROBOT. The environment variableOFFENSIVEset tofalsewill achieve the same result. Please be advised that as an alternative or as a general approach you can try to apply evasion techniques by changing the variablesUSLEEP_SNDand / orUSLEEP_RECand maybeMAX_WAITSOCK.--phone-outβ Checking for revoked certificates via CRL and OCSP is not done per default. This switch instructs testssl.sh to query external β in a sense of the current run β URIs. By using this switch you acknowledge that the check might have privacy issues, a download of several megabytes (CRL file) may happen and there may be network connectivity problems while contacting the endpoint which testssl.sh doesn't handle.PHONE_OUTis the environment variable for this which needs to be set totrueif you want this.
Fr fr, read that one again. You're calling out to the internet. Privacy? Vibes? Several megabytes of CRL? She's not cleaning that up for you π«Ά
--add-ca <cafile>β enables you to add your own CA(s) for trust chain checks. cafile can be a single path or multiple paths as a comma separated list of root CA files. Internally they will be added during runtime to all CA stores. This is (only) useful for internal hosts whose certificates is issued by internal CAs. AlternativelyADDITIONAL_CA_FILESis the environment variable for this.
π SINGLE CHECK OPTIONS π
Any single check switch supplied as an argument prevents testssl.sh from doing a default run. It just takes this and if supplied other options and runs them β in the order they would also appear in the default run. So like, you pick the vibe, she runs the vibe β¨
-e,--each-cipherβ checks each of the (currently configured) 370 ciphers via openssl + sockets remotely on the server and reports back the result in wide mode. If you want to display each cipher tested you need to add--show-each. Per default it lists the following parameters: hexcode, OpenSSL cipher suite name, key exchange, encryption bits, IANA/RFC cipher suite name. Please note the--mappingparameter changes what cipher suite names you will see here and at which position. Also please note that the bit length for the encryption is shown and not the security length, albeit it'll be sorted by the latter. For 3DES due to the Meet-in-the-Middle problem the bit size of 168 bits is equivalent to the security size of 112 bits. Numbers don't lie, bestie π-E,--cipher-per-protoβ is similar to-e,--each-cipher. It checks each of the possible ciphers, here: per protocol. If you want to display each cipher tested you need to add--show-each. The output is sorted by security strength, it lists the encryption bits though.-s,--std,--standardβ tests certain lists of cipher suites / cipher categories by strength. Those lists are (openssl ciphers $LIST,$LISTfrom below:)- 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'
- NULL encryption ciphers:
-f,--pfs,--fs,--nsaβ Checks robust (perfect) 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).-p,--protocolsβ checks TLS/SSL protocols SSLv2, SSLv3, TLS 1.0 through TLS 1.3 and for HTTP: SPDY (NPN) and ALPN, a.k.a. HTTP/2. For TLS 1.3 several drafts (from 18 on) and final are supported and being tested for.-P,--preferenceβ displays the servers preferences: cipher order, with used openssl client: negotiated protocol and cipher. If there's a cipher order enforced by the server it displays it for each protocol (openssl+sockets). If there's not, it displays instead which ciphers from the server were picked with each protocol. She's showing you who's the main character of the handshake π-S,--server_defaultsβ displays information from the server hello(s):- Available TLS extensions,
- TLS ticket + session ID information/capabilities,
- session resumption capabilities,
- Time skew relative to localhost (most server implementations return random values).
- Several certificate information
- signature algorithm,
- key size,
- key usage and extended key usage,
- fingerprints and serial
- Common Name (CN), Subject Alternative Name (SAN), Issuer,
- Trust via hostname + chain of trust against supplied certificates
- EV certificate detection
- experimental "eTLS" detection
- validity: start + end time, how many days to go (warning for certificate lifetime >=5 years)
- revocation info (CRL, OCSP, OCSP stapling + must staple). When
--phone-outsupplied it checks against the certificate issuer whether the host certificate has been revoked (plain OCSP, CRL). - displaying DNS Certification Authority Authorization resource record
- Certificate Transparency info (if provided by server).
For the trust chain check 5 certificate stores are provided. If the test against one of the trust stores failed, the one is being identified and the reason for the failure is displayed β in addition the ones which succeeded are displayed too. You can configure your own CA via ADDITIONAL_CA_FILES, see section FILES below. If the server provides no matching record in Subject Alternative Name (SAN) but in Common Name (CN), it will be indicated as this is deprecated. Also for multiple server certificates are being checked for as well as for the certificate reply to a non-SNI (Server Name Indication) client hello to the IP address. Regarding the TLS clock skew: it displays the time difference to the client. Only a few TLS stacks nowadays still support this and return the local clock gmt_unix_time, e.g. IIS, openssl < 1.0.1f. In addition to the HTTP date you could e.g. derive that there are different hosts where your TLS and your HTTP request ended β if the time deltas differ significantly. Detective era πβ¨
-x <pattern>,--single-cipher <pattern>β throws your matched-pattern ciphers at a server and sees what sticks. The patterns work basically the same way as the-V pattern/--local patternsituation, so scroll up if you need the matching deets π-h,--header,--headersβ but like, only if the service is HTTP (either because it was detected as such, or because you forced it with--assume-http). It snoops a whole stack of HTTP headers, including:- HTTP Strict Transport Security (HSTS)
- HTTP Public Key Pinning (HPKP)
- Server banner
- HTTP date+time
- Server banner like Linux or other Unix vendor headers
- Application banner (PHP, RoR, OWA, SharePoint, Wordpress, etc)
- Reverse proxy headers
- Web server modules
- IPv4 address in header
- Cookie (including Secure/HTTPOnly flags)
- Decodes BIG IP F5 non-encrypted cookies
- Security headers (X-Frame-Options, X-XSS-Protection, Expect-CT,..., CSP headers). Nonsense is not yet detected here.
ngl the "nonsense is not yet detected here" part is sending me π it's literally in the docs, girls.
-c,--client-simulationβ this one's a whole vibe check for your site: it simulates a handshake with a bunch of standard clients so you can figure out which client cannot or can connect to your site. For the "can" girlies it shows you the protocol, cipher and curve, plus whether there's Forward Secrecy. testssl.sh uses a handselected set of clients which are retrieved by the SSLlabs API. The output lines up all nice in columns when you pair it with the--wideoption. If you want the full nine yards of clients displayed, set the environment variableALL_CLIENTS. π-g,--greaseβ checks several server implementation bugs like tolerance to size limitations and GREASE, seehttps://www.ietf.org/archive/id/draft-ietf-tls-grease-01.txt. Heads up: this check doesn't run per default. you gotta ask for it, bestie π«Ά
π VULNERABILITIES π
-U,--vulnerable,--vulnerabilitiesβ just tests all (of the following) vulnerabilities in one go. The environment variableVULN_THRESHLDdetermines after which value a separate headline for each vulnerability is being displayed. Default is1, which means if you check for two vulnerabilities, only the general headline for the vulnerabilities section is displayed -- in addition to the vulnerability and the result. Otherwise each vulnerability or vulnerability section gets its own headline in addition to the output of the name of the vulnerability and test result. Quick note: a vulnerability section is comprised of more than one check, e.g. the renegotiation vulnerability check has two checks, so has Logjam. iykyk π₯-H,--heartbleedβ checks for Heartbleed, a memory leakage in openssl. Unless the server side doesn't support the heartbeat extension, it's likely that this check runs into a timeout π. The seconds to wait for a reply can be adjusted withHEARTBLEED_MAX_WAITSOCK.8is the default.-I,--ccs,--ccs-injectionβ checks for CCS Injection, which is an openssl vulnerability. Sometimes also here the check needs to wait for a reply. The predefined timeout of5seconds can be changed with the environment variableCCS_MAX_WAITSOCK. patience is a virtue fr fr β³-T,--ticketbleedβ checks for Ticketbleed memory leakage in BigIP loadbalancers. π-BB,--robotβ checks for vulnerability to ROBOT / (Return Of Bleichenbacher's Oracle Threat) attack.-R,--renegotiationβ tests renegotiation vulnerabilities. Currently there's a check for Secure Renegotiation and for Secure Client-Initiated Renegotiation.
β οΈ please be aware that vulnerable servers to the latter can likely be DoSed very easily (HTTP). a check for Insecure Client-Initiated Renegotiation is not yet implemented.
-C,--compression,--crimeβ checks for CRIME (Compression Ratio Info-leak Made Easy) vulnerability in TLS. CRIME in SPDY is not yet being checked for.-B,--breachβ checks for BREACH (Browser Reconnaissance and Exfiltration via Adaptive Compression of Hypertext) vulnerability. As for this vulnerability HTTP level compression is a prerequisite, it'll be not tested if HTTP cannot be detected or the detection is not enforced via--assume-http. Also please note that only the URL supplied (normally"/") is being tested.-O,--poodleβ tests for SSL POODLE (Padding Oracle On Downgraded Legacy Encryption) vulnerability. It basically checks for the existence of CBC ciphers in SSLv3. iconic name, terrible vulnerability π©-Z,--tls-fallbackβ checksTLS_FALLBACK_SCSVmitigation.TLS_FALLBACK_SCSVis basically a ciphersuite appended to the Client Hello trying to prevent protocol downgrade attacks by a Man in the Middle. slay π‘οΈ-W,--sweet32β checks for vulnerability to SWEET32 by testing 64 bit block ciphers (3DES,RC2andIDEA).-F,--freakβ checks for FREAK vulnerability (Factoring RSA Export Keys) by testing for EXPORT RSA ciphers.-D,--drownβ checks for DROWN vulnerability (Decrypting RSA with Obsolete and Weakened eNcryption) by checking whether the SSL 2 protocol is available at the target.
β οΈ please note that if you use the same RSA certificate elsewhere you might be vulnerable too. testssl.sh doesn't check for this but provides a helpful link @ censys.io which provides this service.
-J,--logjamβ checks for LOGJAM vulnerability by checking for DH EXPORT ciphers. It also checks for "common primes" which are preconfigured DH keys. DH keys=< 1024 Bitwill be penalized. Also FFDHE groups (TLS 1.2) will be displayed here.-A,--beastβ checks BEAST vulnerabilities in SSL 3 and TLS 1.0 by testing the usage of CBC ciphers. πΎ-L,--lucky13β checks for LUCKY13 vulnerability. It checks for the presence of CBC ciphers in TLS versions 1.0 - 1.2.-4,--rc4,--appelbaumβ checks which RC4 stream ciphers are being offered. old and busted, but we still gotta look β¨
π OUTPUT OPTIONS π
-q,--quietβ normally testssl.sh displays a banner onstdoutwith several version information, usage rights and a warning. This option suppresses it.
β οΈ please note that by choosing this option you acknowledge usage terms and the warning normally appearing in the banner. so like, read it first, bestie, don't just yeet it π
--wideβ except the "each cipher output" all tests displays the single cipher name (scheme see below). This option enables testssl.sh to display also for the following sections the same output as for testing each ciphers: BEAST, PFS, RC4. The client simulation has also a wide mode. The difference here is restricted to a column aligned output and a proper headline. The environment variableWIDEcan be used instead. wider = better, obviously π--mapping <openssl|iana|no-openssl|no-iana>β picks which cipher suite name form takes the lead:openssl: use the OpenSSL cipher suite name as the primary name cipher suite name form (default),iana: use the IANA cipher suite name as the primary name cipher suite name form.no-openssl: don't display the OpenSSL cipher suite name, display IANA names only.no-iana: don't display the IANA cipher suite name, display OpenSSL names only.
Please note that in testssl.sh 3,0 you can still use rfc instead of iana and no-rfc instead of no-iana but it'll disappear after 3.0. legacy behavior, cute but on its way out π¦
--show-eachβ this is an option for all wide modes only: it displays all ciphers tested -- not only succeeded ones.SHOW_EACH_Cis your friend if you prefer to set this via the shell environment. show me everything π--color <0|1|2|3>β determines the use of colors on the screen and in the log file:2is the default and makes use of ANSI and termcap escape codes on your terminal.1just uses non-colored mark-up like bold, italics, underline, reverse.0means no mark-up at all = no escape codes. This is also what you want when you want a log file without any escape codes.3will color ciphers and EC according to an internal (not yet perfect) rating.
Setting the environment variable COLOR to the value achieves the same result.
please not that OpenBSD and early FreeBSD do not support italics. π (yes, that's a typo in the original, we're keeping the vibe)
--colorblindβ swaps green and blue colors in the output, so that this percentage of folks (up to 8% of males, seehttps://en.wikipedia.org/wiki/Color_blindness) can distinguish those findings better.COLORBLINDis the according variable if you want to set this in the environment. accessibility icon behavior π--debug <0-6>β this gives you additional output on the screen (2-6), only useful for debugging.DEBUGis the according environment variable which you can use. There are six levels (0is the default, thus it has no effect):- screen output normal but leaves useful debug output in
/tmp/testssl.XXXXXX/. The info about the exact directory is included in the screen output in the end of the run. - lists more what's going on, status (high level) and connection errors, a few general debug output
- even slightly more info: hexdumps + other info
- display bytes sent via sockets
- display bytes received via sockets
- whole 9 yards
- screen output normal but leaves useful debug output in
level 6 is giving main character energy, ngl π§
π FILE OUTPUT OPTIONS π
--log,--loggingβ logsstdoutalso to${NODE}-p${port}${YYYYMMDD-HHMM}.login current working directory of the shell. Depending on the color output option (see above) the output file will contain color and other markup escape codes, unless you specify--color 0too.catand -- if properly configuredless-- will show the output properly formatted on your terminal. The output shows a banner with the almost the same information as on the screen. In addition it shows the command line of the testssl.sh instance.
π please note that the resulting log file is formatted according to the width of your screen while running testssl.sh. You can override the width with the environment variable TERM_WIDTH. your terminal, your rules β¨
--logfile <logfile>or-oL <logfile>β instead of the previous option you may want to use this one if you want to log into a directory or if you rather want to specify the log file name yourself. If logfile is a directory the output will put intologfile/${NODE}-p${port}${YYYYMMDD-HHMM}.log. If logfile is a file it will use that file name, an absolute path is also permitted here.LOGFILEis the variable you need to set if you prefer to work environment variables instead.
π please note that the resulting log file is formatted according to the width of your screen while running testssl.sh. You can override the width with the environment variable TERM_WIDTH. (yes, same note, it applies twice, we don't make the rules π)
--jsonβ logs additionally to JSON file${NODE}-p${port}${YYYYMMDD-HHMM}.jsonin the current working directory of the shell. The resulting JSON file is opposed to--json-prettyflat -- which means each section is self contained and has an identifier for each single check, the hostname/IP address, the port, severity and the finding. For vulnerabilities it may contain a CVE and CWE entry too. The output doesn't contain a banner or a footer. clean, flat, no notes π₯--jsonfile <jsonfile>or-oj <jsonfile>β instead of the previous option you may want to use this one if you want to log the JSON out put into a directory or if you rather want to specify the log file name yourself. If jsonfile is a directory the output will put intologfile/${NODE}-p${port}${YYYYMMDD-HHMM}.json. If jsonfile is a file it will use that file name, an absolute path is also permitted here. JSON girlies stay winning π--json-prettyβ logs additionally to a JSON file${NODE}-p${port}${YYYYMMDD-HHMM}.jsonin the shellβs current working directory. This one is non-flat β like, actually structured β as opposed to--json. The structure has a header similar to the banner on screen: command line, scan host, openssl binary used, testssl version, and epoch of the start time. Then every test section of testssl.sh gets its own separate JSON object/section. Each finding has a key/value pair identifier with the identifier for each single check, the severity, and the finding. For vulnerabilities it may contain a CVE and CWE entry too. The footer lists the scan time in seconds. π--jsonfile-pretty <jsonfile>or-oJ <jsonfile>β similar to the aforementioned--jsonfileor--logfile, it logs the output in pretty JSON format (see--json-pretty) into a file or a directory. For further explanation see--jsonfileor--logfile. β¨--csvβ logs additionally to a CSV file${NODE}-p${port}${YYYYMMDD-HHMM}.csvin the current working directory of the shell. The output contains a header with the keys; the values are the same as in the flat JSON format (identifier for each single check, the hostname/IP address, the port, severity, the finding, and for vulnerabilities a CVE and CWE number). π--csvfile <csvfile>or-oC <csvfile>β similar to the aforementioned--jsonfileor--logfile, it logs the output in CSV format (see--cvs) additionally into a file or a directory. For further explanation see--jsonfileor--logfile. π--htmlβ logs additionally to an HTML file${NODE}-p${port}${YYYYMMDD-HHMM}.htmlin the current working directory of the shell. It contains a 1:1 output of the console. In former versions there was a non-native option to use"aha"(Ansi HTML Adapter:github.com/theZiz/aha) liketestssl.sh [options] <URI> | aha >output.html. This is not necessary anymore. πΈ--htmlfile <htmlfile>or-oH <htmlfile>β similar to the aforementioned--jsonfileor--logfile, it logs the output in HTML format (see--html) additionally into a file or a directory. For further explanation see--jsonfileor--logfile. π¦-oA <filename>/--outFile <filename>β similar tonmap, it does a file output to all available file formats: LOG, JSON pretty, CSV, HTML. If the filename supplied is equalauto, the filename is automatically generated using${NODE}-p${port}${YYYYMMDD-HHMM}.${EXT}with the according extension. If a directory is provided, all output files will be put into<filename>/${NODE}-p${port}${YYYYMMDD-HHMM}.{log,json,csv,html}. π-oa <filename>/--outfile <filename>β does the same as the previous option but uses flat JSON instead. π--hintsβ this option is not in use yet. Itβs meant to give hints how to fix a finding or at least a help to improve something.GIVE_HINTSis the environment variable for this. π--severity <severity>β for CSV and both JSON outputs, this will only add findings to the output file if a severity is equal or higher than the severity value specified. Allowed are<LOW|MEDIUM|HIGH|CRITICAL>.WARNis another level which translates to a client-side scanning error or problem. Thus you will always see them in a file if they occur. π₯--appendβ normally, if an output file already exists and it has a file size greater than zero, testssl.sh will prompt you to manually remove the file and exit with an error.--appendhowever will append to this file, without a header. The environment variableAPPENDdoes the same. Be careful using this switch/variable. A complementary option which overwrites an existing file doesnβt exist per design. π--outprefix <fname_prefix>β prepend output filename prefixfname_prefixbefore${NODE}-. You can use as well the environment variableFNAME_PREFIX. Using this, any output files will be named<fname_prefix>-${NODE}-p${port}${YYYYMMDD-HHMM}.<format>when no file name of the respective output option was specified. If you do not like the separator-, you can as well supply a<fname_prefix>ending in.,_or,. In this case or if you already supplied-, no additional-will be appended to<fname_prefix>. π
A few file output options can also be preset via environment variables.
π COLOR RATINGS π
testssl.sh makes use of (the eight) standard terminal colors. The color scheme is as follows:
- light red β a critical finding π
- red β a high finding π₯
- brown β a medium finding
- yellow β a low finding
- green (blue if
COLORBLINDis set) β something which is either in general a good thing or a negative result of a check which otherwise results in a high finding - light green (light blue if
COLORBLINDis set) β something which is either in general a very good thing or a negative result of a check which otherwise results in a critical finding - no color at places where also a finding can be expected β a finding on an info level
- cyan β currently only used for
--show-eachor an additional hint - magenta β signals a warning condition, e.g. either a local lack of capabilities on the client side or another problem
- light magenta β a fatal error which either requires strict consent from the user to continue or a condition which leaves no other choice for testssl.sh to quit
What is labeled as βlightβ above appears as such on the screen but is technically speaking βboldβ. Besides --color=3 will color ciphers according to an internal and rough rating.
Markup (without any color) is used in the following manner:
- bold β for the name of the test
- underline + bold β for the headline of each test section
- underline β for a sub-headline
- italics β for strings just reflecting a value read from the server
π TUNING via ENV variables and more options π
Besides the environment variables mentioned above that can replace command line options, here are some which cannot be set otherwise. Variables used for tuning are preset with reasonable values. There should be no reason to change them unless you use testssl.sh under special conditions.
TERM_WIDTHβ a variable which overrides the auto-determined terminal width size. Setting this variable normally only makes sense if you log the output to a file using the--log,--logfileor-oLoption. π«ΆDEBUG_ALLINONE/SETXβ when setting one of those totrue, testssl.sh falls back to the standard bash behavior, i.e. callingbash -x testssl.shit displays the bash debugging output not in an external file/tmp/testssl-<XX>.log. πDEBUGTIMEβ profiling option. When using bashβs debug mode and when this is set totrue, it generates a separate text file with epoch times in/tmp/testssl-<XX>.time. They need to be concatenated bypaste /tmp/testssl-<XX>.{time,log}<!--βFAST_SOCKETSHOW_SIGALGOFAST-->EXPERIMENTAL=trueβ an option which is sometimes used in the development process to make testing easier. In released versions this has no effect. π§ALL_CLIENTS=trueβ runs a client simulation with all (currently 126) clients when testing HTTP. πUNBRACKTD_IPV6β needs to be set totruefor some old versions of OpenSSL (like from Gentoo) which donβt support[bracketed]IPv6 addresses. πNO_ENGINEβ if you have problems with garbled output containing the wordengineyou might want to set this totrue. It forces testssl.sh to not try to configure opensslβs engine or a non existing one from libressl. πΈHEADER_MAXSLEEPβ to wait how long before killing the process to retrieve a service banner / HTTP header. π¦MAX_WAITSOCKβ instructs testssl.sh to wait until the specified time before declaring a socket connection dead. Donβt change this unless youβre absolutely sure what youβre doing. Value is in seconds. π₯CCS_MAX_WAITSOCKβ similar to above but applies only to the CCS handshakes, for both of the two the two CCS payload. Donβt change this unless youβre absolutely sure what youβre doing. Value is in seconds. πHEARTBLEED_MAX_WAITSOCKβ similar toMAX_WAITSOCKbut applies only to the ServerHello after sending the Heartbleed payload. Donβt change this unless youβre absolutely sure what youβre doing. Value is in seconds. πMEASURE_TIME_FILEβ for seldom cases when you donβt want the scan time to be included in the output you can set this tofalse. πSTARTTLS_SLEEPβ is per default set to10(seconds). Thatβs the value testssl.sh waits for a string in the STARTTLS handshake before giving up. β¨MAX_PARALLELβ the maximum number of tests to run in parallel in parallel mass testing mode. The default value of20may be made larger on systems with faster processors. πMAX_WAIT_TESTβ the maximum time (in seconds) to wait for a single test in parallel mass testing mode to complete. The default is1200. πUSLEEP_SNDUSLEEP_REC-->HSTS_MINβ preset to179(days). If you want warnings sooner or later for HTTP Strict Transport Security you can change this. πHPKP_MINβ preset to30(days). If you want warnings sooner or later for HTTP Public Key Pinning you can change this. πΈDAYS2WARN1β the first threshold when youβll be warning of a certificate expiration of a host, preset to60(days). For Letβs Encrypt this value will be divided internally by2. π¦DAYS2WARN2β the second threshold when youβll be warning of a certificate expiration of a host, preset to30(days). For Letβs Encrypt this value will be divided internally by2. π§TESTSSL_INSTALL_DIRβ the derived installation directory of testssl.sh. Relatively to that thebinandmandatoryetc directory will be looked for. πCA_BUNDLES_PATHβ if you have an own set of CA bundles or you want to point testssl.sh to a specific location of a CA bundle, you can use this variable to set the directory which testssl.sh will use. Please note that it overrides completely the builtin path of testssl.sh which means that you will only test against the bundles you point to. Also you might want to use~/utils/create_ca_hashes.shto create the hashes for HPKP. πMAX_SOCKET_FAILβ a number which tells testssl.sh how often a TCP socket connection may fail before the program gives up and terminates. The default is2. You can increase it to a higher value if you frequently see a message likeFatal error: repeated openssl s_client connect problem, doesn't make sense to continue.π₯MAX_OSSL_FAILβ a number that tellstestssl.shhow many times an OpenSSLs_clientconnect can fail before the program gives up and terminates. The default is2. Crank it higher if you keep seeingFatal error: repeated TCP connect problems, giving up.MAX_HEADER_FAILβ a number that tellstestssl.shhow many times an HTTPGETrequest over OpenSSL can return an empty file before the program gives up and terminates. The default is3. Same vibe: raise the threshold when you spotFatal error: repeated HTTP header connect problems, doesn't make sense to continue.
π§ͺ EXAMPLES π§ͺ
bestie, these are the actual runs β commands stay exactly as written, no cap:
testssl.sh testssl.sh
does a default run on https://testssl.sh: protocols, standard cipher lists, PFS, server preferences, server defaults, vulnerabilities, testing all known 370 ciphers, client simulation.
testssl.sh testssl.net:443
does the same default run as above with the subtle difference that testssl.net has two IPv4 addresses. Both are tested. iconic behavior, honestly.
testssl.sh --ip=one --wide https://testssl.net:443
does the same checks as above, with the difference that one IP address is being picked randomly. Displayed is everything where possible in wide format.
testssl.sh -6 https://testssl.net
As opposed to the first example it also tests the IPv6 part β supposed you have an IPv6 network and your openssl supports IPv6 (see above).
testssl.sh -t smtp smtp.gmail.com:25
Checks are done via a STARTTLS handshake on the plain text port 25. It checks every IP on smtp.gmail.com.
testssl.sh --starttls=imap imap.gmx.net:143
does the same on the plain text IMAP port.
Please note that for plain TLS-encrypted ports you must not specify the protocol option when no STARTTLS handshake is offered:testssl.sh smtp.gmail.com:465just checks the encryption on the SMTPS port,testssl.sh imap.gmx.net:993on the IMAPS port. Also MongoDB which provides TLS support without STARTTLS can be tested directly.
π RFCs and other standards π
like, the standards receipts β every single one, no skipping:
RFC 2246: The TLS Protocol Version 1.0RFC 2818: HTTP Over TLSRFC 2595: Using TLS with IMAP, POP3 and ACAPRFC 3207: SMTP Service Extension for Secure SMTP over Transport Layer SecurityRFC 3501: INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1RFC 4346: The Transport Layer Security (TLS) Protocol Version 1.1RFC 4366: Transport Layer Security (TLS) ExtensionsRFC 4492: Elliptic Curve Cryptography (ECC) Cipher Suites for Transport Layer Security (TLS)RFC 5077: Transport Layer Security (TLS) Session ResumptionRFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2RFC 5280: Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) ProfileRFC 5321: Simple Mail Transfer ProtocolRFC 5746: Transport Layer Security (TLS) Renegotiation Indication ExtensionRFC 6066: Transport Layer Security (TLS) Extensions: Extension DefinitionsRFC 6101: The Secure Sockets Layer (SSL) Protocol Version 3.0RFC 6120: Extensible Messaging and Presence Protocol (XMPP): CoreRFC 6125: Domain-Based Application Service Identity [..]RFC 6797: HTTP Strict Transport Security (HSTS)RFC 6961: The Transport Layer Security (TLS) Multiple Certificate Status Request ExtensionRFC 7469: Public Key Pinning Extension for HTTP (HPKP)RFC 7507: TLS Fallback Signaling Cipher Suite Value (SCSV) for Preventing Protocol Downgrade AttacksRFC 7627: Transport Layer Security (TLS) Session Hash and Extended Master Secret ExtensionRFC 7633: X.509v3 Transport Layer Security (TLS) Feature ExtensionRFC 7465: Prohibiting RC4 Cipher SuitesRFC 7685: A Transport Layer Security (TLS) ClientHello Padding ExtensionRFC 7905: ChaCha20-Poly1305 Cipher Suites for Transport Layer Security (TLS)RFC 7919: Negotiated Finite Field Diffie-Hellman Ephemeral Parameters for Transport Layer SecurityRFC 8143: Using Transport Layer Security (TLS) with Network News Transfer Protocol (NNTP)RFC 8446: The Transport Layer Security (TLS) Protocol Version 1.3W3C CSP: Content Security Policy Level 1-3TLSWG Draft: The Transport Layer Security (TLS) Protocol Version 1.3
π EXIT STATUS π
the exit codes are giving main character energy, and every one matters:
0βtestssl.shfinished successfully without errors and without ambiguous results1βtestssl.shhas encountered exactly one ambiguous situation or an error during run1+nβ same as previous. The errors or ambiguous results are added, also per IP.50-200β reserved for returning a vulnerability scoring for system monitoring or a CI tools242(ERR_CHILD) β Child received a signal from master244(ERR_RESOURCE) β Resourcestestssl.shneeds couldn't be read245(ERR_CLUELESS) β Weird state, either though user options ortestssl.sh246(ERR_CONNECT) β Connectivity problem247(ERR_DNSLOOKUP) β Problem with resolving IP addresses or names248(ERR_OTHERCLIENT) β Other client problem249(ERR_DNSBIN) β Problem with DNS lookup binaries250(ERR_OSSLBIN) β Problem with OpenSSL binary251(ERR_NOSUPPORT) β Feature requested is not supported252(ERR_FNAMEPARSE) β Input file couldn't be parsed253(ERR_FCREATE) β Output file couldn't be created254(ERR_CMDLINE) β Cmd line couldn't be parsed255(ERR_BASH) β Bash version incorrect
π FILES π
etc/*pemare the certificate stores from Apple, Linux, Mozilla Firefox, Windows and Java.etc/client-simulation.txtcontains client simulation data.etc/cipher-mapping.txtprovides a mandatory file with mapping from OpenSSL cipher suites names to the ones from IANA / used in the RFCs.etc/tls_data.txtprovides a mandatory file for ciphers (bash sockets) and key material.
π AUTHORS π
Developed by Dirk Wetter, David Cooper and many others, see CREDITS.md .
π COPYRIGHT π
Copyright Β© 2012 Dirk Wetter. License GPLv2: Free Software Foundation, Inc. This is free software: you are free to change and redistribute it under the terms of the license, see LICENSE.
Attribution is important for the future of this project - also in the internet. Thus if you're offering a scanner based on testssl.sh as a public and/or paid service in the internet you are strongly encouraged to mention to your audience that you're using this program and where to get this program from. That helps us to get bugfixes, other feedback and more contributions.
Usage WITHOUT ANY WARRANTY. USE at your OWN RISK!
πΈ LIMITATION πΈ
All native Windows platforms emulating Linux are known to be slow.
π¦ BUGS π¦
Probably. Current known ones and interface for filing new ones: https://testssl.sh/bugs/ .
β SEE ALSO β
ciphers(1), openssl(1), s_client(1), x509(1), verify(1), ocsp(1), crl(1), bash(1) and the websites https://testssl.sh/ and https://github.com/drwetter/testssl.sh/ .
okay that's the whole page, bestie π source/version: this manual page is TESTSSL(1), and the date is August 2022. go forth and scan responsibly π«Άβ¨
π¦ where this page comes from
- opensuse-leap 16.0: testssl.sh 3.0.9-bp160.1.9 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms