Skip to content
Blog

← All articles

From SSL to TLS 1.3: How the Protocol Works, Why It Kept Breaking, and Why You Should Always Use the Latest

Thirty years of SSL and TLS in one tested guide: every version, the attacks that retired it (POODLE, BEAST, FREAK, DROWN and more), how the TLS 1.3 handshake works, and why it matters. We measure 1 round trip instead of 2, decrypt a recorded TLS 1.2 session with a stolen key, catch the downgrade sentinel, and negotiate post-quantum key exchange with nginx, Node.js, Python, and Go.

By 19 min read

The padlock in the address bar has meant the same thing for thirty years, but the protocol behind it has been replaced six times. Netscape's Secure Sockets Layer (SSL) became the IETF's Transport Layer Security (TLS) in 1999, and every version since has been a response to an attack on the one before. The latest, TLS 1.3, isn't a patch: it removed most of what had ever been broken, and it's faster.

This article walks through the whole history, explains how a modern handshake works, and shows the practical differences with experiments you can rerun. We measured the handshake with 100 ms of network latency, recorded a TLS 1.2 session and decrypted it with a "stolen" server key, caught the anti-downgrade marker in a live handshake, and checked which versions today's software will still speak.

The short answer#

What TLS has to do#

Every version of SSL and TLS has the same three jobs, on top of a TCP connection:

  1. Authentication: prove the server is who it claims to be, with a certificate signed by an authority the client trusts and a signature only the holder of the private key can make.
  2. Key exchange: agree on fresh symmetric keys over a network an attacker can watch. This is where the asymmetric cryptography comes in (see symmetric vs. asymmetric encryption).
  3. Record protection: encrypt and authenticate every byte of application data with those keys so that it can be neither read nor changed in transit.

The handshake does the first two; the record layer does the third. Almost every attack in this article broke one of those two halves, or the negotiation that decides which algorithms they use.

Thirty years in one table#

VersionYearStatus todayWhat retired it
SSL 1.01994Never releasedFlawed before it shipped
SSL 2.01995Prohibited (RFC 6176, 2011)Unprotected handshake, weak MAC; DROWN (2016)
SSL 3.01996Deprecated (RFC 7568, 2015)POODLE (2014)
TLS 1.01999 (RFC 2246)Deprecated (RFC 8996, 2021)BEAST (2011), MD5/SHA-1 in the handshake
TLS 1.12006 (RFC 4346)Deprecated (RFC 8996, 2021)MD5/SHA-1, no AEAD ciphers
TLS 1.22008 (RFC 5246)Acceptable, if configured carefullyStill allows weak options; see below
TLS 1.32018 (RFC 8446)Recommended—

Browsers dropped TLS 1.0 and 1.1 in 2020, PCI DSS stopped allowing TLS 1.0 for card data in 2018, and NIST requires US government servers to support TLS 1.3. The IETF's current best practice (RFC 9325) says implementations must support TLS 1.2, should support TLS 1.3, and must not negotiate anything older.

SSL 2.0 and 3.0: the Netscape years#

Netscape built SSL in 1994–95 to make online shopping possible in its browser. SSL 2.0 shipped in 1995 with serious design flaws: the handshake messages weren't authenticated, so an attacker in the middle could quietly remove the strong cipher suites and leave only 40-bit "export" ciphers; it used the same key for encryption and integrity; and a connection could be cut short without either side noticing.

SSL 3.0 (1996), a redesign led by Paul Kocher, fixed those and introduced the structure TLS still uses: a handshake protocol, a record protocol, and a final Finished message that checks the whole handshake wasn't tampered with. Its weakness was CBC padding: the padding bytes weren't covered by the MAC and could have any value, which POODLE exploited in 2014 to decrypt a cookie a byte at a time.

SSL 2.0 had a long afterlife. In 2016, DROWN showed that a server that still accepted SSL 2.0 connections, or merely shared its RSA key with one that did, let an attacker decrypt that server's modern TLS sessions. Leaving an old protocol enabled "for compatibility" put all the new ones at risk.

TLS 1.0 to 1.2: patching in place#

TLS 1.0 (1999) was SSL 3.0 standardized by the IETF, with small changes; the new name was partly political, to make it the industry's protocol rather than Netscape's. Its main flaw turned out to be in CBC mode: each record's IV was the last ciphertext block of the previous record, so an attacker who could inject chosen plaintext could predict it. BEAST (2011) turned that into a cookie-stealing attack in the browser.

TLS 1.1 (2006) fixed it with a fresh, explicit IV per record, years before BEAST was demonstrated. TLS 1.2 (2008) was the bigger step: SHA-256 instead of the MD5/SHA-1 combination in the handshake, negotiable signature algorithms, and above all AEAD cipher suites such as AES-GCM, which encrypt and authenticate in one operation and have no padding to attack.

But TLS 1.2 kept everything older too, for compatibility: RSA key exchange, CBC with MAC-then-encrypt, RC4, static Diffie-Hellman, compression, renegotiation, and in many libraries even the 1990s export ciphers. A well-configured TLS 1.2 server is still secure. A default one often wasn't, and most of the next decade of attacks targeted exactly those leftovers.

The attacks that shaped the protocol#

AttackYearWhat it brokeGone in TLS 1.3 because
Renegotiation2009Attacker's request spliced into a victim's sessionRenegotiation removed
BEAST2011Predictable CBC IVs in TLS 1.0No CBC
CRIME2012Compression leaks secrets through lengthNo compression
Lucky 132013Timing of CBC padding checksNo CBC
RC4 biases2013–15Statistical biases in the RC4 keystreamNo RC4 (banned in 1.2 too, RFC 7465)
Triple handshake2014Two sessions forced to share a master secretHandshake transcript bound into the keys
POODLE2014SSL 3.0 CBC paddingNo SSL 3.0, no CBC
FREAK, Logjam2015Downgrade to 512-bit export RSA / DHNo export ciphers; the handshake is signed
DROWN2016SSL 2.0 on the same RSA keyNo RSA key exchange
Sweet322016Collisions in 64-bit block ciphers (3DES)Only AES and ChaCha20
ROBOT2017RSA PKCS#1 v1.5 padding oracle in key exchangeNo RSA key exchange

One famous name is missing on purpose. Heartbleed (2014) wasn't a protocol flaw but a missing bounds check in OpenSSL's heartbeat extension, which leaked server memory, private keys included. It's the reminder that the latest protocol needs an up-to-date library too.

TLS 1.3: the redesign#

TLS 1.3 took four years and 28 drafts, and it's the first version designed alongside formal analysis rather than patched after attacks. The working rule was to remove anything that wasn't clearly needed:

  • Key exchange is always ephemeral (ECDHE or DHE), so every connection has forward secrecy. Static RSA and static DH key exchange are gone.
  • Five cipher suites, all AEAD: TLS_AES_128_GCM_SHA256, TLS_AES_256_GCM_SHA384, TLS_CHACHA20_POLY1305_SHA256 and two AES-CCM variants for small devices. A suite now names only the cipher and the hash; the key exchange and signature are negotiated separately, which ended the combinatorial explosion of hundreds of TLS 1.2 suites.
  • Only safe groups and signatures: no custom DH parameters, no MD5 or SHA-1 signatures, RSA signatures only with PSS.
  • More of the handshake is encrypted, including the server's certificate, so a passive observer no longer sees which certificate was used.
  • A new key schedule built on HKDF, with separate keys for the handshake and for application data, and the whole handshake transcript mixed in.
  • One round trip for a full handshake, and an optional zero-round-trip mode for resumed connections.

One detail shows how hard deploying it was. The ClientHello still says version 1.2 in its old version field, and the real versions go in a new supported_versions extension. Firewalls and middleboxes had learned to reject version numbers they didn't know, so TLS 1.3 had to look like TLS 1.2 on the wire to get through.

The TLS 1.3 handshake, step by step#

Client                                          Server
ClientHello
  + supported_versions (1.3, 1.2)
  + key_share (X25519MLKEM768, X25519)
  + signature_algorithms, server_name  ------>
                                                ServerHello
                                                  + key_share (its public key)
                     (both sides now have the handshake keys)
                                                {EncryptedExtensions}
                                                {Certificate}
                                                {CertificateVerify}
                                       <------  {Finished}
{Finished}
[application data]                     <----->  [application data]

{ } encrypted with handshake keys
[ ] encrypted with application keys
  1. The client guesses which key-exchange groups the server will accept and sends a public key for each in its first message. That guess is what saves a round trip: TLS 1.2 first asked, then sent.
  2. The server picks one group, replies with its own public key, and from that moment both sides share a secret. Everything after the ServerHello is encrypted.
  3. The server sends its certificate and a CertificateVerify: a signature over the whole handshake so far, made with the certificate's private key. That proves it owns the certificate and that nobody altered the messages.
  4. Both sides send Finished, a MAC over the transcript, and switch to the application keys. The client can send its request together with its Finished.

If the client guessed wrong, the server answers with a HelloRetryRequest naming a group it supports, which costs one extra round trip. For a returning client, a session ticket allows 0-RTT data in the very first message, but that data can be replayed by an attacker and isn't forward-secret, so servers should only accept it for requests that are safe to repeat, such as a plain GET.

One round trip instead of two, measured#

We added 50 ms of delay in each direction on a Linux loopback interface (a 100 ms round trip, typical between continents) and timed curl against an OpenSSL server, seven times per version. The medians were identical in both runs:

TCP connectTLS handshakeFirst byte of the response
TLS 1.2100 ms203 ms404 ms
TLS 1.3100 ms103 ms303–304 ms

Exactly one round trip saved on every new connection. On a mobile network, where round trips of 100–300 ms are common, that's the most visible improvement of all. The CPU cost goes slightly the other way: an OpenSSL client completed about 3,500–3,650 TLS 1.2 handshakes per CPU-second, 2,600–2,700 TLS 1.3 handshakes with X25519, and 2,290–2,340 with post-quantum X25519MLKEM768. That's 0.3 to 0.4 ms of CPU per handshake, against 100 ms of waiting saved.

Forward secrecy: decrypting a recorded session#

With RSA key exchange, the client picks the session secret and sends it encrypted with the server's RSA public key. Anyone who records the traffic today and gets the server's private key later (a breach, a subpoena, a decommissioned disk) can decrypt every recorded session. With ECDHE, both sides make throwaway key pairs for each connection and the private key only signs; once the connection is over, the secret is gone. This script tests exactly that with tcpdump and Wireshark's command-line tool:

forward-secrecy.sh
#!/bin/sh
# forward-secrecy.sh: record a TLS 1.2 connection, "steal" the server's private key later, and try to decrypt.
# Run as root with OpenSSL, curl, tcpdump and tshark (e.g. Alpine: apk add openssl curl tcpdump tshark).
set -e
openssl req -x509 -newkey rsa:2048 -nodes -keyout rsa-key.pem -out rsa.pem -days 1 -subj /CN=localhost 2>/dev/null

record() { # $1 = cipher suite, $2 = capture file
  openssl s_server -accept 4433 -cert rsa.pem -key rsa-key.pem -tls1_2 -cipher "$1" -www -quiet & server=$!
  tcpdump -i lo -U -w "$2" tcp port 4433 2>/dev/null & dump=$!
  sleep 1
  curl -sk --tlsv1.2 --tls-max 1.2 --ciphers "$1" -H "Authorization: Bearer s3cr3t-token" https://localhost:4433/ >/dev/null
  sleep 1; kill $dump $server
}
decrypt() { # what an attacker with the server's private key reads from the capture
  tshark -r "$1" -o "tls.keys_list:127.0.0.1,4433,http,rsa-key.pem" -Y http.request -T fields -e http.authorization 2>/dev/null
}

record AES128-GCM-SHA256 rsa-kx.pcap               # RSA key exchange: no forward secrecy
record ECDHE-RSA-AES128-GCM-SHA256 ecdhe-kx.pcap   # ECDHE key exchange: forward secrecy
echo "RSA key exchange, decrypted with the server key:   [$(decrypt rsa-kx.pcap)]"
echo "ECDHE key exchange, decrypted with the server key: [$(decrypt ecdhe-kx.pcap)]"
output
RSA key exchange, decrypted with the server key:   [Bearer s3cr3t-token]
ECDHE key exchange, decrypted with the server key: []

Same server, same key, same request. With RSA key exchange, the bearer token came straight out of the capture; with ECDHE, the private key was useless. TLS 1.3 doesn't offer the first option at all.

Downgrade protection: the DOWNGRD sentinel#

A protocol is only as strong as its weakest enabled version if an attacker can force the weaker one. TLS 1.3 defends against that with a marker: when a server that supports TLS 1.3 negotiates an older version, it writes DOWNGRD plus 01 (for TLS 1.2) or 00 (for 1.1 or older) into the last 8 bytes of its random value. That value is signed, so an attacker can't remove it, and a TLS 1.3 client that sees it aborts the connection. We read the ServerHello from live handshakes:

ServerClient offersLast 8 bytes of ServerHello.random
Supports TLS 1.3Up to 1.244 4f 57 4e 47 52 44 01 ("DOWNGRD" 01)
Supports TLS 1.3Up to 1.144 4f 57 4e 47 52 44 00 ("DOWNGRD" 00)
TLS 1.2 onlyUp to 1.2Random bytes

Post-quantum key exchange is already on#

Forward secrecy protects against a stolen key, but not against a future quantum computer, which could break X25519 from a recording made today ("harvest now, decrypt later"). The answer is X25519MLKEM768: X25519 combined with ML-KEM-768, the lattice-based key encapsulation NIST standardized in 2024 (FIPS 203). The connection is safe as long as either one holds.

It's defined only for TLS 1.3, and it's already the default. Our nginx (with OpenSSL 3.5) and clients in Node.js 24, Go 1.25, and OpenSSL 3.5 all negotiated it without being asked; Chrome and Firefox offer it by default too. The same server, asked for TLS 1.2, fell back to plain X25519. The cost is size: the ClientHello grew by about 1.2 KB and the server's reply by about 1.1 KB (written 297 → 1,531 bytes, read about 778 → 1,845 bytes).

Configuring it: servers and clients#

For a server, the whole job is: TLS 1.2 and 1.3 only, ECDHE with AEAD ciphers for TLS 1.2, a modern certificate, and HSTS so browsers never try plain HTTP. This nginx configuration is the one we tested:

nginx.conf
# nginx.conf (the TLS part): TLS 1.2 and 1.3 only, forward-secret AEAD ciphers, post-quantum key exchange first.
events {}
http {
  server {
    listen 443 ssl;
    http2 on;
    server_name example.com;
    ssl_certificate     /etc/nginx/certs/server.pem;
    ssl_certificate_key /etc/nginx/certs/server-key.pem;

    ssl_protocols TLSv1.2 TLSv1.3;
    # TLS 1.2 only: ECDHE (forward secrecy) with AES-GCM or ChaCha20-Poly1305. TLS 1.3 suites are all fine as is.
    ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305;
    ssl_prefer_server_ciphers off;   # let clients without AES hardware pick ChaCha20
    ssl_ecdh_curve X25519MLKEM768:X25519:prime256v1;   # needs OpenSSL 3.5+ for the first one
    ssl_session_tickets off;         # tickets weaken forward secrecy unless their keys rotate often

    add_header Strict-Transport-Security "max-age=63072000" always;
    location / { return 200 "hello over $ssl_protocol with $ssl_cipher\n"; }
  }
}

For clients, modern libraries already default to TLS 1.2 as the minimum; the important thing is not to lower it, and not to disable certificate verification. Each of these connected to that nginx with TLS 1.3 and X25519MLKEM768, and refused a server that only spoke TLS 1.1:

client.mjs
// client.mjs: connect with TLS 1.2 as the minimum and report what was negotiated.
//   node client.mjs host [port]
import { readFileSync } from "node:fs";
import tls from "node:tls";

const [host, port = "443"] = process.argv.slice(2);
const socket = tls.connect({
  host,
  port: Number(port),
  servername: host,
  minVersion: "TLSv1.2",                                  // Node's default too; never lower it
  ca: process.env.CA ? readFileSync(process.env.CA) : undefined, // a private CA for testing; omit for public sites
});
socket.on("secureConnect", () => {
  const key = socket.getEphemeralKeyInfo();
  console.log(`${socket.getProtocol()} ${socket.getCipher().standardName} key exchange: ${key.name ?? key.type ?? "n/a"}`);
  socket.end();
});
socket.on("error", (err) => { console.log(`refused: ${err.code ?? err.message}`); process.exitCode = 1; });
client.py
# client.py: connect with TLS 1.2 as the minimum and report what was negotiated.
#   python client.py host [port]
import os
import socket
import ssl
import sys

host, port = sys.argv[1], int(sys.argv[2]) if len(sys.argv) > 2 else 443
context = ssl.create_default_context(cafile=os.environ.get("CA"))  # verifies the certificate and the host name
context.minimum_version = ssl.TLSVersion.TLSv1_2

try:
    with socket.create_connection((host, port)) as raw, context.wrap_socket(raw, server_hostname=host) as tls:
        print(tls.version(), tls.cipher()[0])
except ssl.SSLError as err:
    print("refused:", err.reason)
    sys.exit(1)
client.go
// client.go: connect with TLS 1.2 as the minimum and report what was negotiated.
//   go run client.go host [port]
package main

import (
	"crypto/tls"
	"crypto/x509"
	"fmt"
	"os"
)

func main() {
	host, port := os.Args[1], "443"
	if len(os.Args) > 2 {
		port = os.Args[2]
	}
	config := &tls.Config{ServerName: host, MinVersion: tls.VersionTLS12}
	if ca := os.Getenv("CA"); ca != "" { // a private CA for testing; omit for public sites
		pem, _ := os.ReadFile(ca)
		config.RootCAs = x509.NewCertPool()
		config.RootCAs.AppendCertsFromPEM(pem)
	}
	conn, err := tls.Dial("tcp", host+":"+port, config)
	if err != nil {
		fmt.Println("refused:", err)
		os.Exit(1)
	}
	defer conn.Close()
	state := conn.ConnectionState()
	fmt.Println(tls.VersionName(state.Version), tls.CipherSuiteName(state.CipherSuite), "key exchange:", state.CurveID)
}
output
node tlsserver: TLSv1.3 TLS_AES_256_GCM_SHA384 key exchange: X25519MLKEM768
node oldserver: refused: ERR_SSL_TLSV1_ALERT_PROTOCOL_VERSION
python tlsserver: TLSv1.3 TLS_AES_256_GCM_SHA384
python oldserver: refused: TLSV1_ALERT_PROTOCOL_VERSION
go tlsserver: TLS 1.3 TLS_AES_128_GCM_SHA256 key exchange: X25519MLKEM768
go oldserver: refused: remote error: tls: protocol version not supported

One surprise worth knowing: Python 3.13 and later verify certificates strictly by default. Our first test certificates, made with a bare openssl req, were rejected with CERTIFICATE_VERIFY_FAILED until the CA had a key-usage extension and the server certificate an authority key identifier, as certificates from public CAs always do. If an internal service suddenly fails after a Python upgrade, check its certificates first.

Who still needs TLS 1.2? Clients that can't speak 1.3: Android 9 and older, Java 8 before update 261, Windows before Windows 11 and Server 2022, and plenty of embedded devices. That's why TLS 1.2 stays as the floor rather than being switched off.

Checking a server#

This script asks a server for each version in turn and reports what it accepts. It lowers OpenSSL's own security level for the old versions, because otherwise the client refuses them before the server can answer:

probe.sh
#!/bin/sh
# probe.sh: which TLS versions does a server accept, and what does it negotiate? Needs OpenSSL 3.x.
#   sh probe.sh example.com [443]
host=$1 port=${2:-443}
for v in tls1 tls1_1 tls1_2 tls1_3; do
  # OpenSSL 3 refuses TLS 1.0/1.1 itself at its default security level, so lower it to see what the SERVER allows.
  level=$([ "$v" = tls1 ] || [ "$v" = tls1_1 ] && echo 0 || echo 2)
  out=$(openssl s_client -connect "$host:$port" -servername "$host" -"$v" -cipher "DEFAULT@SECLEVEL=$level" \
        </dev/null 2>&1)
  protocol=$(echo "$out" | sed -n 's/^ *Protocol *: *//p' | head -1)
  cipher=$(echo "$out" | sed -n 's/^.*Cipher is //p' | head -1)
  group=$(echo "$out" | sed -n -e 's/^Negotiated TLS1.3 group: //p' -e 's/^Peer Temp Key: //p' -e 's/^Server Temp Key: //p' | head -1)
  if [ -n "$cipher" ] && [ "$cipher" != "(NONE)" ]; then
    echo "$v: ACCEPTED  $protocol  $cipher  $group"
  else
    echo "$v: refused"
  fi
done
output
$ sh probe.sh tlsserver        # nginx with the configuration above
tls1: refused
tls1_1: refused
tls1_2: ACCEPTED  TLSv1.2  ECDHE-ECDSA-AES256-GCM-SHA384  X25519, 253 bits
tls1_3: ACCEPTED  TLSv1.3  TLS_AES_256_GCM_SHA384  X25519MLKEM768

$ sh probe.sh oldserver        # a server stuck on TLS 1.1
tls1: refused
tls1_1: ACCEPTED  TLSv1.1  ECDHE-ECDSA-AES256-SHA  X25519, 253 bits
tls1_2: refused
tls1_3: refused

For a public site, Qualys SSL Labs and the open-source testssl.sh go much further: certificate chain, every cipher suite, and known vulnerabilities.

What we tested#

Everything ran in Docker on Linux 6.6: OpenSSL 3.5.9, curl 8.14, tshark 4.4, nginx 1.31 (Alpine, OpenSSL 3.5), Node.js 24.22, Python 3.14 (OpenSSL 3.5.7), and Go 1.25, with a private test CA. Two full runs gave the same results:

  • Versions: a default OpenSSL 3.5 client refused SSL 3.0 ("unknown option": not built), TLS 1.0 and 1.1 ("no protocols available"), and spoke TLS 1.0 only when told to use security level 0.
  • Probe: the article's nginx accepted only 1.2 and 1.3; the old server only 1.1.
  • Clients: Node.js, Python, and Go got TLS 1.3 from nginx and refused the TLS 1.1 server.
  • Forward secrecy: RSA key exchange decrypted with the server key; ECDHE didn't.
  • Downgrade sentinel: DOWNGRD 01 and 00 exactly where RFC 8446 says, and random bytes from a TLS 1.2-only server.
  • Speed and size: 203 vs. 103 ms handshakes at 100 ms round trip; post-quantum key exchange adding about 2.3 KB per handshake.

FAQ#

Is "SSL certificate" wrong, then?

It's a leftover name. Certificates are X.509 certificates and work with any version; nothing on the web has used the SSL protocol itself for a decade. "TLS certificate" is accurate, and both mean the same file.

Is TLS 1.2 still safe?

Yes, with ECDHE key exchange and AEAD ciphers only, as in the nginx configuration above. It just has more ways to be misconfigured, it's a round trip slower, and it can't do post-quantum key exchange.

Does TLS 1.3 hide which site I visit?

Not by itself: the server name is still sent in plain text in the ClientHello so the server can pick a certificate. Encrypted Client Hello (ECH), published as RFC 9849 in March 2026, encrypts it and needs support from the browser, the server, and DNS.

Should I enable 0-RTT?

Only if you know which requests are safe to replay. 0-RTT data can be captured and resent by an attacker, so a request that changes something (a payment, a POST) must never be accepted as early data.

Does mutual TLS work the same way?

Yes: the server also asks for a client certificate, and in TLS 1.3 the client's certificate is encrypted too. It's one of the two strong ways for services to authenticate each other, alongside the private key JWT approach.

Try it in your browser

  • Encrypt / Decrypt: AES-GCM and ChaCha20-Poly1305, the same AEAD ciphers TLS 1.3 uses for every record.
  • Hash Generator: SHA-256 and SHA-384, the hashes behind TLS 1.3's key schedule and its cipher suite names.
  • Base64 Encoder / Decoder: a PEM certificate or key is DER wrapped in Base64; decode one to see what's inside.