Skip to content
Tutorials Center
My learning

Topics

Lesson 17 of 37 ยท Protocol Analysis

HTTP and the TLS Handshake

Analyze HTTP requests and responses in Wireshark, then see what you can and cannot read in TLS: Client Hello, SNI, ALPN, versions, certificates and encrypted data.

Web traffic is where most people first open Wireshark. Plain HTTP is completely readable, which makes it a perfect teaching protocol. Almost all real traffic, however, is HTTPS: HTTP inside TLS. A capture still tells you a lot about a TLS connection (who, when, how much, which versions and which site name), even though the content is encrypted. This lesson shows how to read both.

HTTP/1.1 on the wire

HTTP/1.1 is a text protocol on top of TCP (default port 80). A request is a request line, headers, a blank line and an optional body; a response is a status line, headers, a blank line and a body:

TEXT
GET /index.html HTTP/1.1
Host: example.org
User-Agent: demo-client/1.0
Accept: text/html

HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Content-Length: 1256

<!doctype html>...

Wireshark reassembles the TCP segments, parses the message, and shows GET /index.html HTTP/1.1 in the Info column. Fields and filters:

Filter Meaning
http Any HTTP/1.x message
http.request / http.response Requests / responses
http.request.method == "POST" A method
http.host == "example.org" Host header
http.request.uri contains "/api/" Path and query
http.response.code == 404 A status code
http.response.code >= 500 Server errors
http.content_type contains "json" Content type of the message
http.cookie, http.set_cookie Cookies
http.time > 1 Response time (the time between a request and its response) above 1 second
http.request_in, http.response_in Links between the pair

Useful columns: http.host, http.request.uri, http.response.code, http.time. Remember that a failed request (404, 500) is still a successful TCP exchange: the network worked, the application said no.

HTTP status code families

1xx informational (100 Continue, 101 Switching Protocols), 2xx success (200 OK, 204 No Content), 3xx redirect (301, 302, 304 Not Modified), 4xx client error (400, 401, 403, 404, 429 Too Many Requests), 5xx server error (500, 502 Bad Gateway, 503, 504 Gateway Timeout). A burst of 502 or 504 from a proxy means the proxy could not get an answer from the server behind it.

Clear-text means readable

Anything sent over plain HTTP, including form fields, cookies and API keys, is visible to everyone who can see the packets. That is the practical reason for HTTPS everywhere. In your own lab you can see it with Follow > HTTP Stream; in real networks, report clear-text credentials as a finding rather than collecting them.

The stand-in below parses an HTTP request and response from the text of a reassembled stream (invented) into the same pieces Wireshark exposes as fields.

Python Parse HTTP messages into fields (stand-in)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

HTTP/2 and HTTP/3

HTTP/2 is binary and multiplexed: many requests share one TCP connection as separate streams. It is almost always inside TLS, so you only see it with decryption keys. Wireshark shows http2 frames (HEADERS, DATA, SETTINGS) and http2.streamid. HTTP/3 uses QUIC over UDP port 443 and is always encrypted; the filter is quic (and http3 when decrypted). If a site "does not show up as http" in your capture, it is probably one of these, or it uses a port that Wireshark does not map to HTTP (use Analyze > Decode As).

TLS: what stays visible

TLS (the "S" of HTTPS) first runs a handshake and then protects the data. In TLS 1.3, everything after the first two handshake messages is encrypted, including the server certificate.

sequenceDiagram
    participant C as Client
    participant S as Server
    C->>S: ClientHello (versions, ciphers, SNI, ALPN, key share)
    S->>C: ServerHello (chosen version and cipher, key share)
    S->>C: Encrypted: certificate, finished (TLS 1.3)
    C->>S: Encrypted: finished
    C->>S: Application data (encrypted)
    S->>C: Application data (encrypted)

A simplified TLS 1.3 handshake. Only the first two messages are readable in a capture.

In the Client Hello you can read:

  • Supported versions and cipher suites. tls.handshake.type == 1 finds Client Hellos. Old clients offering only TLS 1.0 or weak ciphers can be identified here.
  • SNI (Server Name Indication) tls.handshake.extensions_server_name: the host name the client wants. It is sent in clear text (unless Encrypted Client Hello is used), so you can see which site was contacted even over HTTPS.
  • ALPN tls.handshake.extensions_alpn_str: the application protocols offered, such as h2 and http/1.1.
  • Fingerprints: JA3/JA4 hashes of the Client Hello (tls.handshake.ja3, tls.handshake.ja4 in recent versions) identify the client software even when addresses change; defenders use them to spot unusual clients.

The Server Hello names the chosen version (tls.handshake.version, and the supported_versions extension for TLS 1.3) and cipher suite. In TLS 1.2 the Certificate message is also visible, so you can see the issuer, subject, validity dates and the chain (tls.handshake.type == 11, x509sat.printableString). After the handshake you see Application Data records with sizes and timing only.

The stand-in builds a minimal TLS 1.3-style Client Hello (invented, with a few cipher suites) and parses out the SNI, the ALPN list and the offered versions with plain byte arithmetic, the same fields shown above. Nothing is sent anywhere.

Python Extract SNI and ALPN from a Client Hello (stand-in)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Reading a TLS conversation: a checklist

  1. Find the handshake: tls.handshake.type == 1 (Client Hello). Add the tls.handshake.extensions_server_name column to see the site names.
  2. Did it complete? After the Server Hello you should see Change Cipher Spec/Application Data. A reset or an Alert right after the Client Hello usually means a version or cipher mismatch or a blocked site. Alerts: tls.alert_message.desc (for example 40 handshake failure, 42 bad certificate, 46 certificate unknown).
  3. Certificate problems (TLS 1.2 captures): expired, wrong name or untrusted issuer are shown in the certificate fields, and clients respond with an alert.
  4. Time: the gap between the TCP handshake and the first application data is the cost of the TLS handshake (one more round trip for TLS 1.3, two for TLS 1.2).
  5. Resumption: a returning client skips part of the handshake (tls.handshake.extension.type == 41 for a pre-shared key).

To read the encrypted content of your own sessions you can log the session secrets from the browser or client (the SSLKEYLOGFILE environment variable) and point Wireshark at the file; a later lesson covers decryption in detail.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. You capture an HTTPS visit. Which of these can you normally read in a plain capture?

    The SNI is sent in clear text in the Client Hello; the content, cookies and passwords are inside the encrypted records.
  2. 2. A server returns 404 for a request. What does that say about the network?

    An HTTP status code is carried by a successful TCP and HTTP exchange; 404 is an application-level answer.
  3. 3. Which filter finds all TLS Client Hello messages?

    Handshake type 1 is ClientHello.
  4. 4. Why is HTTP/3 not shown by the 'http' filter?

    HTTP/3 uses QUIC over UDP, with encryption built in, so use the quic filter (and keys to decrypt).

Summary

  • HTTP/1.1 is readable text: request line, headers, body; filter by method, host, URI and status code.
  • A 4xx or 5xx status is an application result, not a network failure.
  • HTTP/2 and HTTP/3 are binary and encrypted, so you need keys to read their contents.
  • In TLS you can read the Client Hello (versions, ciphers, SNI, ALPN) and, in TLS 1.2, the certificate; the rest is encrypted.
  • Alerts, resets and timing around the handshake explain most HTTPS connection problems.

Next: DHCP and Other Everyday Protocols