TLS
TLS is the protocol that gives traffic confidentiality, integrity, and authenticity (HTTPS and much more). This card covers how the handshake works, how to audit a TLS configuration, and the historical attacks that explain why TLS 1.3 is recommended today.
What it is
Section titled “What it is”TLS (Transport Layer Security) is a protocol that negotiates a session key using asymmetric cryptography and then protects the data with authenticated symmetric encryption. It authenticates the server (and optionally the client) with X.509 certificates. See PKI & certificates.
How the handshake works (TLS 1.3)
Section titled “How the handshake works (TLS 1.3)”sequenceDiagram
participant C as Client
participant S as Server
C->>S: ClientHello (suites, ECDHE key_share, random)
S-->>C: ServerHello (suite, ECDHE key_share)
S-->>C: {Certificate + CertificateVerify} encrypted
S-->>C: {Finished}
C->>S: {Finished}
Note over C,S: 1-RTT; AEAD channel with PFS established
In TLS 1.3 (RFC 8446) the client sends its ECDHE key_share already in the ClientHello, so the handshake completes in 1-RTT. The session key is derived with HKDF (RFC 5869). RSA key exchange, CBC, RC4, compression, and renegotiation were removed, which simplifies the protocol and closes entire families of attacks.
Theory: PFS and AEAD suites
Section titled “Theory: PFS and AEAD suites”PFS (Perfect Forward Secrecy): with ECDHE, compromising the server’s private key does not allow decrypting captured past traffic, because the session key is ephemeral and never transmitted. That’s the reason to require ECDHE. TLS 1.3 only allows AEAD suites (AES-GCM, ChaCha20-Poly1305) with PFS; TLS 1.2 should be restricted to that same set.
Quick comparison:
| TLS 1.2 | TLS 1.3 | |
|---|---|---|
| Handshake RTT | 2-RTT | 1-RTT (0-RTT optional) |
| Key exchange | RSA or (EC)DHE | (EC)DHE only (PFS mandatory) |
| Cipher | CBC, GCM, RC4… | AEAD only |
| Renegotiation / compression | yes | removed |
Red Team
Section titled “Red Team”Auditing the configuration
Section titled “Auditing the configuration”testssl.sh https://host # version, suites, PFS, known vulns, certsslscan host:443 # supported suites, fastnmap --script ssl-enum-ciphers -p 443 hostopenssl s_client -connect host:443 -tls1_2 # manual handshake/cert inspectionRed flags: SSLv3/TLS 1.0/1.1 enabled, weak RC4/3DES/CBC, no PFS, expired certificate or incomplete chain, RSA key < 2048.
MITM against clients (authorized lab)
Section titled “MITM against clients (authorized lab)”If the client doesn’t validate the certificate properly (see PKI & certificates), a proxy like mitmproxy or Burp presents its own certificate; if the client accepts it, there’s a full MITM. Useful for analyzing mobile and IoT apps; with pinning you need a bypass (e.g. Frida) in an authorized environment.
Historical attacks (why TLS evolved)
Section titled “Historical attacks (why TLS evolved)”- BEAST (CVE-2011-3389): CBC with a predictable IV in TLS 1.0.
- CRIME (CVE-2012-4929) / BREACH: compression + injection allows recovering cookies by size.
- Lucky Thirteen (CVE-2013-0169): timing-based padding oracle in TLS CBC.
- POODLE (CVE-2014-3566): downgrade to SSLv3 + CBC padding oracle.
- Heartbleed (CVE-2014-0160): OpenSSL memory leak (keys, data) via a heartbeat bug; not a protocol flaw.
- FREAK (CVE-2015-0204) / Logjam (CVE-2015-4000): downgrade to 512-bit “export” keys.
- DROWN (CVE-2016-0800): reusing a key with vulnerable SSLv2 breaks TLS.
- Sweet32 (CVE-2016-2183): block collision in 3DES (64-bit block) with a huge number of requests.
Blue Team
Section titled “Blue Team”- TLS 1.3 (and 1.2 only with AEAD + ECDHE suites); disable SSLv2/3, TLS 1.0/1.1, RC4, 3DES, and CBC.
- HSTS to force HTTPS, OCSP stapling, valid-CA certificates with a complete chain, keys ≥ 2048 or ECC.
- No TLS compression; automated renewal/rotation (ACME/Let’s Encrypt); monitor with Certificate Transparency.
- On your own clients: strict validation and, where applicable, pinning.
Checklist
Section titled “Checklist”- Scan with testssl.sh/sslscan: versions and suites
- SSLv3/TLS 1.0-1.1, RC4, 3DES, CBC, or no PFS?
- Verify the certificate: validity, chain, SAN, key size
- Vulnerable to Heartbleed/POODLE/DROWN? (testssl flags it)
- HSTS present? HTTP→HTTPS redirect?
- Own clients: MITM to check validation/pinning
- Prefer and verify TLS 1.3 support