task 7.1 · chapter 7 of 8: tls · 20 min
What TLS shows
objective
Capture two HTTPS connections and read what encryption leaves in plain sight: the server name (SNI), the versions offered and chosen, the cipher suite and the application protocols.
answers/7.1.ymlopen a file in VS Code: Ctrl+P (Cmd+P on a Mac), type its name, Enter
| Capture | make capture AT=laptop:eth1 NAME=7.1 X=tls: https://web.lab/ and https://intranet.lab/ |
|---|---|
| Filter | tls.handshake |
| Your answers | answers/7.1.yml |
new to this? step by stepbeginner
make capture AT=laptop:eth1 NAME=7.1 X=tls, open it, filtertls.handshake.- Each Client Hello’s server_name extension; the Server Hello’s supported_versions extension.
- Challenge: the Server Hello’s Cipher Suite; the Client Hello’s ALPN list.
- Fill in answers/7.1.yml, then
make check T=7.1.
more in meet the lab
Encrypted, but not invisible
What TLS hides, and what it can’t
TLS (Transport Layer Security, the S in HTTPS) encrypts the conversation between the laptop and web: the page, the address you typed after the name, cookies, passwords. A capture of HTTPS shows none of that. It’s just Application Data.
But the two sides have to agree on how to encrypt before they can encrypt anything, so the start of the conversation, the handshake, is partly in the clear. And a few things in it are worth a lot to someone troubleshooting:
| In the clear | Where | Why it’s there |
|---|---|---|
| SNI (server name indication) | Client Hello | one server can host many names (web.lab and intranet.lab are the same box). The client says which one it wants, so the server can pick the right certificate |
| versions offered | Client Hello, supported_versions | so the two can pick one they both know |
| version chosen | Server Hello, supported_versions | |
| cipher suites offered, and the one chosen | Client Hello, Server Hello | the encryption method they’ll use |
| ALPN (application-layer protocol negotiation) offered | Client Hello | which protocol will run inside: h2 (HTTP/2) or http/1.1 |
The IP addresses and ports are in the clear too, of course: TLS rides on an ordinary TCP connection.
in one sentence TLS hides the content, but the handshake still shows which name you asked for and how the two ends agreed to talk.
The version that lies
TLS 1.3 kept a trap for old middleboxes. The record and handshake headers still say TLS 1.0 and 1.2,
because some old firewalls dropped anything that said 1.3. The real version is negotiated in an extension,
supported_versions. So Wireshark’s Protocol column shows the Client Hello as TLSv1.2, and you have to open
the Server Hello to see the truth.
What 1.3 hides that 1.2 didn’t
In TLS 1.3, everything after the Server Hello is encrypted, the server’s certificate included, and so is the ALPN the server picks. In TLS 1.2 the certificate went in the clear. Task 7.2 shows the difference.
A Client Hello in two pieces
The TLS frames of the first connection:
8 0.004050375 192.168.1.175 → 192.168.2.10 SSL 1514
9 0.004052292 192.168.1.175 → 192.168.2.10 TLSv1.2 176 Client Hello (SNI=web.lab)
12 0.005881292 192.168.2.10 → 192.168.1.175 TLSv1.3 1514 Server Hello, Change Cipher Spec, Application Data
14 0.005905250 192.168.2.10 → 192.168.1.175 TLSv1.3 1171 Application Data, Application Data, Application Data
...
The Client Hello is 1,558 bytes: too big for one packet on a 1,500-byte network, so TCP split it in two.
Frame 8 is the first piece (Wireshark can’t decode it alone, so it says SSL), and frame 9 completes it. It’s
that big because of its key share: the laptop’s curl offers X25519MLKEM768, a newer key exchange designed
to stay safe against future quantum computers, and its key alone is over a kilobyte. Keep that size in mind for
chapter 8.
The Server Hello, opened (... marks lines left out):
Transport Layer Security
TLSv1.3 Record Layer: Handshake Protocol: Server Hello
Version: TLS 1.2 (0x0303)
Handshake Protocol: Server Hello
Version: TLS 1.2 (0x0303)
...
Cipher Suite: TLS_AES_256_GCM_SHA384 (0x1302)
...
Extension: supported_versions (len=2) TLS 1.3
Supported Version: TLS 1.3 (0x0304)
Extension: key_share (len=1124) X25519MLKEM768
Twice it says TLS 1.2. The extension says 1.3, and that’s the one that counts.
Names and the version
Capture the laptop opening two HTTPS pages:
run in the terminalmake capture AT=laptop:eth1 NAME=7.1 X=tlsOpen
/captures/7.1.pcapngand filtertls.handshake.type == 1(Client Hellos only). The Info column shows each SNI. To see it in the details: Extension: server_name.Now filter
tls.handshake.type == 2(Server Hellos) and open Extension: supported_versions.Fill in the follow-along lines:
editanswers/7.1.ymlCtrl+P → 7.1.ymlsni: web.lab, intranet.lab tls_version: 1.3
The cipher and ALPN
cipher: the cipher suite the server chose, by name or by number;offered_alpn: the application protocols the laptop offered, comma separated.
Then look for the protocol the server chose from that list. Where is it?
hint
The cipher is in the Server Hello. ALPN is an extension in the Client Hello: Extension: application_layer_protocol_negotiation.
show the solutionanswers/7.1.yml
or pull it into your lab: make solve T=7.1, then git diff --staged shows what changed
cipher: TLS_AES_256_GCM_SHA384
offered_alpn: h2, http/1.1
The server’s choice isn’t in the Server Hello: in TLS 1.3 it travels in the Encrypted Extensions, after the
encryption starts. (The lab’s web server doesn’t do HTTP/2, so it picked http/1.1. You can’t see that here.
In task 7.2’s TLS 1.2 handshake, the Server Hello carries it in the clear.)
This is what firewalls and monitoring tools that don’t decrypt rely on: the SNI tells them which site, the handshake tells them how it’s protected, and that’s all they get.
5 check: run it, then prove it
$ make check T=7.1when it's right, you'll see
╭─ task 7.1 · what TLS shows
│ ✓ captures/7.1.pcapng: taken on laptop:eth1, 51 frames
│ ✓ the server names the laptop asked for, both of them (follow along): web.lab, intranet.lab
│ ✓ the TLS version the server chose (follow along): 1.3
│ ✓ the cipher suite the server chose (challenge): ...
│ ✓ the application protocols the laptop offered, ALPN (challenge): ...
╰─ 5/5 checks passed verified