TLS: the padlock on a web address

9 min 6 sections 3 practice questions 11 sources cited

Transport Layer Security (TLS) protects one conversation between two programs, most often a browser and a website. It proves which site is answering, keeps the conversation secret and shows whether anything was changed on the way. No background is assumed beyond the earlier network units and everyday ideas of keys and certificates. Almost every secure web, email and application connection relies on it, and older versions still in use carry named, well-known attacks.

By the end of this unit you will be able to:

  • Explain the three protections TLS gives a conversation, and where it sits among the layers
  • Put the steps of the TLS 1.3 handshake in order, and say how TLS 1.2 differs
  • Name each SSL and TLS version with its status today
  • Match POODLE, BEAST, Heartbleed, downgrade and stripping attacks to their causes and fixes
  • Explain what a valid padlock does not promise about a website

The hotel Wi-Fi and the bank that lost its padlock

An illustrative example

A sales manager stays at a hotel and signs in to her bank on the hotel's free Wi-Fi. She types the bank's name into the address bar without the https at the front, as she always does. The page looks exactly as usual, but this time there is no padlock beside the address.

She does not notice. At home the next week, the same bank page always shows the padlock, and her browser refuses even to load the plain version.

What could someone on the hotel network have done to remove the padlock, and why did her home browser behave differently?

Three protections for one conversation

Transport Layer Security (TLS) protects the data two programs exchange over a connection. A web address that begins https is the web protocol, HTTP, carried inside TLS, normally on TCP port 443.

  • Authentication: the server proves its identity with a . The client may prove its own as well, but usually does not.
  • : the conversation is , so only the two ends can read it.
  • : any change made on the way is detected, and the connection is ended.

TLS runs above TCP and below the program that uses it, so it fits no single layer neatly. It is most often placed at the , layer 4, and sometimes at layers 5 to 7 because the program chooses to use it. Unlike IPsec, it protects one program's conversation, not every between two machines.

Encrypting a whole conversation with the server's certificate key would be slow. Instead, the two ends use the start of the conversation to agree session keys: fresh used for this connection alone and then thrown away.

The TLS 1.3 handshake, step by step

The opening exchange that agrees the keys and checks the server's identity is the handshake. A cipher suite is the named set of the two ends will use, for example for encryption and for checking integrity.

  1. Client Hello: the browser lists the TLS versions and cipher suites it supports, the name of the site it wants, and its half of a key exchange.
  2. Server Hello: the server chooses one version and one cipher suite and sends its half of the key exchange. Both ends can now compute the same handshake keys. Everything after this is encrypted, starting with the server's other settings, called Encrypted Extensions.
  3. Certificate: the server sends its certificate, the signed statement that binds its public key to its name.
  4. Certificate Verify: the server signs the handshake so far with its private key, proving it holds the key the certificate names.
  5. Finished: each side sends a check over the whole handshake. A message altered by an attacker makes the check fail.
  6. Application data: the request and the page now travel encrypted under the session keys.

How a TLS 1.3 connection is set up

How a TLS 1.3 connection is set upSix messages in time order, the browser's along the top and the server's along the bottom. Client Hello and Server Hello are readable; a frame marked encrypted holds the certificate, both Finished messages and the application data.Client Hellobrowser sendsits key shareServer Helloserver sendsits key shareEncryptedfrom hereafter Server HelloCertificateand CertificateVerifyFinishedthe server'scheckFinishedbrowser'scheckApplicationdataboth waysHow a TLS 1.3 connection is set upSix messages in time order, the browser's along the top and the server's along the bottom. Client Hello and Server Hello are readable; a frame marked encrypted holds the certificate, both Finished messages and the application data.Client Hellobrowser sendsits key shareServer Helloserver sendsits key shareEncryptedfrom hereafter Server HelloCertificateand CertificateVerifyFinishedthe server'scheckFinishedbrowser'scheckApplicationdataboth ways
Read this figure as text

The handshake agrees the keys and checks the server's identity before any request is sent. In TLS 1.3 it takes one round trip, and the server's certificate already travels encrypted.

  1. Client Hello, from the browser: the TLS versions and cipher suites it supports, the name of the site it wants, and its half of a key exchange. It is sent readable.
  2. Server Hello, from the server: the one version and cipher suite it has chosen, and its half of the key exchange. It is sent readable. Both ends can now compute the same handshake keys.
  3. Everything after this point is encrypted, starting with the server's other settings, called Encrypted Extensions. The server sends its Certificate, which binds its public key to its name, and then Certificate Verify, a signature over the handshake so far made with its private key.
  4. The server sends Finished, a check over the whole handshake. A message altered by an attacker makes the check fail.
  5. The browser checks the certificate: it must chain back to a trusted authority, be in date, not be revoked and carry the name asked for. If any check fails the browser ends the connection; otherwise it sends its own Finished.
  6. Application data, the request and the page, now travels in both directions encrypted under the session keys. TLS 1.2 takes one more round trip and sends the certificate in the open.

Before it trusts the server, the browser checks the certificate. It must chain back to an authority the browser trusts, be in date, not be revoked and carry the name the browser asked for. If any check fails, the browser must end the connection.

In mutual TLS, the server asks the client for a certificate too, and both ends prove who they are. It is common between services that call each other, and rare for people browsing.

Agreeing keys: Diffie-Hellman, and the TLS 1.2 method 1.3 removed

A normal certificate-authenticated TLS 1.3 handshake uses an ephemeral Diffie-Hellman exchange: each side sends a public value, and both compute the same secret that an eavesdropper cannot. This gives forward secrecy when the temporary secrets are erased: stealing the server's signing key later does not reveal conversations already recorded. There is a narrow exception. A resumed or pre-shared-key connection may use PSK-only mode, named psk_ke; that mode does not provide . Pairing the PSK with a fresh key exchange, psk_dhe_ke, restores it.

TLS 1.2 takes one more round trip before data flows, and the server sends its certificate in the open. Its key exchange takes one of two forms. In the Diffie-Hellman form, the server signs its public value, as in 1.3. In the older RSA key transport form, named after the RSA public-key method, the client makes a random secret called the pre-master secret. It encrypts that secret with the public key in the server's certificate and sends it. Only the server's private key can recover it, and both ends derive the session keys from it. Each side then sends Change Cipher Spec, a notice that it is switching to the new keys, and Finished. RSA key transport gives no forward secrecy: whoever later steals the server's private key can recover every recorded secret and read every recorded conversation. That is why TLS 1.3 removed it.

SSL is retired, and only TLS 1.2 and 1.3 remain

The Secure Sockets Layer (SSL) was designed by Netscape. TLS is its successor under a new name. People still say when they mean TLS, but every version of SSL is forbidden.

SSL and TLS versions and their status today
VersionReleasedStatus
SSL 2.01995Prohibited since 2011
SSL 3.01996Must not be used since 2015, after POODLE
TLS 1.01999Must not be used since 2021
TLS 1.12006Must not be used since 2021
TLS 1.22008Acceptable with strong cipher suites
TLS 1.32018Current and preferred

TLS 1.3 removed much of the legacy design that enabled past attacks. It keeps only cipher suites that encrypt and check integrity in one step. It removed static RSA and static Diffie-Hellman public-key exchanges, compression, renegotiation and several old algorithms. Public-key exchanges provide forward secrecy, subject to erasing temporary secrets; PSK-only psk_ke and 0-RTT early data are exceptions. TLS 1.3 also encrypts the handshake from the Server Hello onwards, so the certificate is no longer visible to passive onlookers.

Common misconception

“A website with an SSL certificate is using the SSL protocol.”

SSL certificate is an old name for the certificate TLS uses. The certificate is the same kind whatever the version. The protocol in use should be TLS 1.2 or 1.3.

Named attacks on SSL and TLS, and what fixed each

Five attacks on SSL and TLS, with cause and fix
AttackWhat it doesCauseFix
POODLERecovers secret data, such as a cookieA flaw in how SSL 3.0 pads encrypted blocksDisable SSL 3.0
BEAST parts of the traffic, such as a cookiePredictable values in TLS 1.0's block encryptionTLS 1.2 or later
HeartbleedReads the server's memory, including private keys and passwordsA coding bug in OpenSSL's heartbeat feature, not in the protocol, then replace keys and certificates
DowngradeForces the two ends onto an older, weaker versionClients that retried with older versions after a failureDisable old versions; downgrade protection in TLS 1.3
StrippingKeeps the victim on plain HTTP so TLS never startsThe first request goes out without httpsHTTP Strict Transport Security

Stripping is a form of man in the middle. The attacker talks plain HTTP to the victim and HTTPS to the real site, and relays between them.

HTTP Strict Transport Security (HSTS) defeats it. A site sends a header named Strict-Transport-Security, and the browser remembers it for a stated time. From then on the browser rewrites every plain link to that site as https, and refuses to let the user click past a certificate warning. Its gap is the very first visit, which browsers close with a built-in preload list of HSTS sites.

The hotel Wi-Fi, explained

On the hotel network an attacker intercepted the plain request and served the bank's page over HTTP, keeping HTTPS to the bank for himself. At home, the browser had stored the bank's HSTS , so it never sent a plain request at all.

What the padlock does not promise

A padlock proves that the conversation is encrypted and that the server holds a valid certificate for the name in the address bar. It proves nothing about the people who run the site.

  • A fraudulent site can hold a valid certificate for its own look-alike name.
  • Data is protected only in transit. Once it reaches the server, its safety depends on the server.
  • A device already infected with malware sees everything before it is encrypted.
  • Addresses, ports, timing and the amount of data stay visible to the network.

Common misconception

“A padlock in the address bar means the website is genuine and safe to trust.”

It means the connection is encrypted to whoever holds a certificate for that exact name. A phishing site with a near-identical name can show the same padlock.

A question, worked through

An online retailer's payment page uses TLS 1.2 with strong settings. A review finds that the server still accepts TLS 1.0 and SSL 3.0 for old browsers, and that the site does not send HSTS. Customers often type the address without https. The security manager can approve one change to the web server's settings this month.

Which change BEST reduces the risk to customers' payment details?

  1. Replace the certificate with one from a better-known authority
  2. Disable SSL 3.0 and TLS 1.0 and send an HSTS header
  3. Require mutual TLS so every customer presents a certificate
  4. Move the payment page to its own server on a separate port
Decide on your answer, then open the reasoning
  1. Two weaknesses are stated: old versions that allow downgrade and known attacks, and no HSTS while customers type plain addresses, which allows stripping.
  2. Rule out a: the certificate is not the weakness. Any trusted authority's certificate proves the name equally well.
  3. Rule out d: a separate server or port changes where the page lives, not how the connection is protected.
  4. Between b and c: mutual TLS identifies customers, but customers do not hold certificates, so the site would stop working for them, and stripping would still bypass TLS altogether.
  5. Disabling the forbidden versions and sending HSTS closes both stated weaknesses. The answer is b.

Answer: B. Disable SSL 3.0 and TLS 1.0 and send an HSTS header

Choosing between good answers

A question offers SSL or TLS 1.0 or 1.1 as a fix
reject it. Only TLS 1.2 and TLS 1.3 are acceptable, and 1.3 is preferred.
Users reach a site by typing its name, and an attacker keeps them on plain HTTP
the attack is stripping and the control is HSTS, not a stronger certificate.
Recorded traffic must stay safe even if the server's private key is stolen later
the property is forward secrecy. A normal certificate-authenticated TLS 1.3 exchange provides it; PSK-only psk_ke and 0-RTT early data do not.
A question describes the client encrypting a secret with the server's public key
that is TLS 1.2 RSA key transport. If forward secrecy is required, choose a Diffie-Hellman exchange or TLS 1.3.
A flaw is in one product's code rather than in the protocol, such as Heartbleed
patch the product and replace any keys it may have exposed.

Try it

Check a website's certificate chain link by link, then break one link and see where the browser stops trusting it.

Loading the preview.

Check your understanding

3 questions on this unit, easiest first. Confirm an answer to see the reasoning for it, then the right answer, the other options and the rule to reuse. Your answers are kept in this browser and feed readiness and review.

These questions are drafts that no named reviewer has approved yet.

Question 1 of 3

A trainee is watching a capture of a browser connecting to a website over TLS 1.3. Put the handshake messages in the order they occur.

Put the steps in order with the buttons beside each one. The whole order has to be right.

  1. 1Client Hello: versions, cipher suites, the site name and the browser's half of the key exchange
  2. 2Finished: a check over the whole handshake
  3. 3Server Hello: the chosen version and cipher suite, and the server's half of the key exchange
  4. 4Application data: the request and the page, encrypted under the session keys
  5. 5Certificate: the server's signed statement binding its public key to its name
  6. 6Certificate Verify: the server's signature over the handshake so far

What to remember

  • TLS gives one conversation server authentication, confidentiality and integrity. HTTPS is HTTP inside TLS on port 443.
  • The TLS 1.3 handshake runs Client Hello, Server Hello, then the encrypted Certificate, Certificate Verify and Finished messages, and only then application data.
  • TLS 1.2 adds a round trip and sends the certificate in the open. Its older RSA key transport, in which the client encrypts a secret with the server's public key, gives no forward secrecy, so TLS 1.3 removed it.
  • Every SSL version, TLS 1.0 and TLS 1.1 are forbidden. TLS 1.2 is acceptable with strong suites, and TLS 1.3 is preferred.
  • POODLE broke SSL 3.0, BEAST broke TLS 1.0's block encryption, Heartbleed was an OpenSSL bug, downgrade forces old versions, and stripping avoids TLS altogether. HSTS stops stripping.
  • A padlock proves an encrypted link to whoever holds that name's certificate. It does not prove the site is honest.

Say it from memory

  1. List the TLS 1.3 handshake messages in order and say what the certificate check confirms.

    Client Hello, Server Hello, then encrypted Encrypted Extensions, Certificate, Certificate Verify and Finished from the server, and Finished from the client. The browser checks that the certificate chains to a trusted authority, is in date, is not revoked and carries the site's name.

    Read this part again

  2. How does the TLS 1.2 handshake with RSA key transport agree keys, and why did TLS 1.3 remove it?

    The client makes a pre-master secret, encrypts it with the public key in the server's certificate and sends it; both ends derive the session keys from it, then send Change Cipher Spec and Finished. It gives no forward secrecy, because stealing the server's private key later recovers every recorded secret. TLS 1.3 removed static RSA key transport; its public-key exchanges provide forward secrecy, while PSK-only psk_ke remains an explicit exception.

    Read this part again

  3. Give the status of SSL 2.0, SSL 3.0, TLS 1.0, 1.1, 1.2 and 1.3.

    SSL 2.0 prohibited; SSL 3.0, TLS 1.0 and TLS 1.1 must not be used; TLS 1.2 acceptable with strong cipher suites; TLS 1.3 current and preferred.

    Read this part again

  4. What is SSL stripping, and what stops it?

    A man in the middle keeps the victim on plain HTTP while talking HTTPS to the real site, so TLS never protects the victim's side. HTTP Strict Transport Security stops it by making the browser use only https for that site, with a preload list covering the first visit.

    Read this part again

  5. What three protections does TLS give, and what are session keys?

    Authentication, where the server proves its identity with a certificate; confidentiality, where the conversation is encrypted; and integrity, where any change on the way is detected and the connection ended. Session keys are fresh secret keys agreed at the start, used for this connection alone and then thrown away.

    Read this part again

  6. What does the padlock in the address bar prove, and what does it not promise?

    It proves that the conversation is encrypted and that the server holds a valid certificate for the name in the address bar. It proves nothing about the people who run the site: a fraudulent site can hold a valid certificate for its own look-alike name. Data is protected only in transit.

    Read this part again

Sources