The TLS Scanner
A web version of testssl.sh: it connects to a server and reports which SSL/TLS versions and cipher suites it accepts, the weaknesses that implies, and its certificate. An interactive panel sends one ClientHello of your choosing and shows the handshake records. The page speaks SSL/TLS itself, in JavaScript (lib/crypto/tls); the local agent only opens the raw TCP socket and relays bytes.
- Protocols: SSL 2.0, SSL 3.0, TLS 1.0, 1.1, 1.2 and 1.3 are each tried with a fresh connection.
- Cipher suites: for every accepted SSLv3-family / TLS 1.0–1.2 version, each defined suite is offered on its own, so the result is exactly what the server accepts. The server's own preference is detected by offering the accepted suites in both orders.
- Findings: weak protocols (SSL 2.0/3.0, TLS 1.0/1.1), POODLE, BEAST, Sweet32 (3DES), RC4, anonymous suites, missing forward secrecy, missing secure renegotiation, and certificate problems (expiry, weak key or signature, host mismatch, self-signed).
- Interactive: pick a version, a set of cipher suites, SNI and ALPN, connect, and read the ClientHello / ServerHello / Certificate / … records that went back and forth.
This first version derives its findings from what the server accepts and from its certificate; it does not send malformed or intrusive probes (Heartbleed, CCS injection, ROBOT and the like are out of scope). TLS 1.3 is detected, but our stack negotiates a single TLS 1.3 suite (TLS_AES_128_GCM_SHA256), so individual TLS 1.3 suites are not enumerated.
Contents
- The TlsScanner library
- What the findings mean
- The agent, and how a probe works
1The TlsScanner library
lib/crypto/tls/tls-scan.js is a JavaScript module with no user interface, built on the TLS stack in the same folder (tls.js, tls-engine.js, ssl2.js, tls-common.js) and on lib/x509.js for the certificate. It is agent-agnostic: you give it a connect() that opens one transport, so it can run over an agent socket, an in-memory pipe (the self-test does this), or anything with the agent-socket shape.
import { TlsScanner } from "/lib/crypto/tls/tls-scan.js";
const scanner = new TlsScanner(() => agent.tcpConnect(host, port, 10000), {
host: "example.com", // the address dialled (used for certificate host checks)
serverName: "example.com", // the SNI to send (omitted for a bare IP)
timeout: 10000,
});
const report = await scanner.scan(event => console.log(event.phase));
| Method | What it does |
| scanner.scan(onEvent) | The full scan. Resolves to a report { host, serverName, versions, suitesByVersion, certificate, findings, secureRenegotiation }. onEvent is called as it goes, with { phase, version, suite } (phase is "version", "versionDone", "suite", "suiteDone", "preference" or "renegotiation"). |
| scanner.probe({ version, suites, serverName, alpn, trace }) | One handshake attempt at a single version, offering the suite ids in suites (all defined for the version when omitted). Resolves to { accepted, version, cipher, group, alpn, peerChain, alert, alertName, error, durationMs, records }. With trace: true, records is the handshake messages in order. |
| scanner.probeSsl2({ trace }) | An SSL 2.0 attempt: { accepted, version, cipherSpecs, specNames, exportSpecs, peerChain }. |
| TlsScanner.analyze(report) | The findings implied by a report: [{ severity, id, title, detail }], worst first (severity is "high", "medium", "low", "info" or "good"). Pure; scan() calls it for you. |
| TlsScanner.suitesForVersion(version) | The suite ids defined for a TLS version number, strongest families first. |
A records entry (from a traced probe) is { dir: "out" | "in", type, typeName, version, length, hex, handshakes: [{ type, name, length }] } — one per TLS record, in the order it crossed the wire; a handshake record lists the messages it carried.
2What the findings mean
| Finding | Why it matters |
| SSL 2.0 / SSL 3.0 enabled | Both are broken. SSL 2.0 enables DROWN; SSL 3.0 with a CBC suite enables POODLE. Disable them. |
| TLS 1.0 / 1.1 enabled | Deprecated. A CBC suite over TLS 1.0 is the setting for BEAST. Prefer TLS 1.2 and 1.3. |
| RC4 accepted | RC4 has keystream biases that leak plaintext. Remove every RC4 suite. |
| 3DES accepted (Sweet32) | 64-bit block ciphers are open to a birthday attack on long-lived connections. |
| Anonymous suites | DH_anon / ECDH_anon give no server authentication: trivial man-in-the-middle. |
| No forward secrecy | Static-RSA key exchange means one leaked private key decrypts all past traffic. Offer ECDHE. |
| No secure renegotiation | A server that does not send renegotiation_info (RFC 5746) may be open to renegotiation-prefix injection. |
| Certificate problems | Expired or not-yet-valid, self-signed, a key below 2048-bit RSA, an MD5/SHA-1 signature, or a name that does not cover the host. |
A finding comes from what the server accepted during the scan, so it is only as complete as the suites our stack can offer (the set in tls-common.js). Absence of a finding is not a certificate of safety.
3The agent, and how a probe works
The browser cannot open a raw TCP socket, so the local agent does — and only that. Set its address on the Settings page (start it with agent -port 8765 and paste the address it prints), then Connect to the agent on the scanner page.
Each probe is one fresh TCP connection. The scanner wraps the agent socket in a ByteStream and runs the TLS client for the chosen version, offering exactly the cipher suites under test; the engine reads options.cipherSuites. If the server completes the handshake, the suite (and version) is accepted and the negotiated details and certificate are read from the connection; if it answers with an alert, the suite is rejected. SSL 2.0 is handled by ssl2.js, which learns the server's version, certificate and cipher-specs. No part of this uses the agent for TLS — the agent only moves bytes.
// the scan primitive, in essence
const connection = await SslEngine.client(stream, version, { cipherSuites: [suiteId], serverName });
// resolved → accepted: connection.version / connection.cipher / connection.peerChain
// TlsAlert → rejected