TLS Lecture 3 · HTTPS and the Web PKI: Certificates, and How They Break

The browser half of TLS, rebuilt step by step: exactly what the lock promises, mixed content, sslstrip and the favicon lock as attacks on its edges, and HSTS with preloading as the structural fix; then certificates on the real chase.com chain (reading every field, verifying each signature up to the root, matching hostnames against the SAN list, lookalike domains, DV versus EV); and finally how the PKI broke, with the MD5 rogue CA, Flame, missing hostname checks and Apple's goto fail each traced to the one check it defeated, alongside Certificate Transparency, correct client verification code, revocation and short-lived certificates.

Subject: Computer Security · 68 slides · code lesson

Open the interactive version of this deck

What this lesson covers

The lesson, slide by slide

1. HTTPS and the Web PKI: Certificates, and How They Break

Title

Computer Security — TLS Lecture 3

A perfect channel, a browser that must show it honestly, and the system that decides whose key is whose

2. Part 1 — HTTPS in the browser

Section

The cryptography is done; the attacks move up a layer

3. What you will be able to do

Objectives

The last lecture built the TLS 1.3 channel and found it very good. This lecture is about everything around it: how the browser shows that channel to a person, and how the browser decides that the key on the other end really belongs to the site in the address bar. Almost every real TLS disaster happened here, not in the cipher.

Security I, Lecture 3: TLS and the Web PKI slide s-div-https

4. Warm-up: what does the TLS channel already guarantee?

Warm-up

Recall the three dangers from the start of the TLS lectures: eavesdrop, tamper, impersonate.

Discussion prompt

Which of them does the TLS 1.3 handshake plus record layer stop on its own, and which one depends on something the channel cannot decide by itself?

Hint: CertificateVerify proves the server holds some private key. Whose?

Answer:

Eavesdropping and tampering are stopped by the record layer: AEAD encryption under keys only the two ends know. Impersonation is stopped only if the client checks that the key that signed CertificateVerify really belongs to the name it meant to reach.

That last check is not cryptography. It is a question of names: whose key is this? The browser answers it with certificates, and it shows the answer to a human as a lock. Both halves of that answer are the subject of this lecture.

5. HTTPS is just HTTP inside the TLS tunnel

Concept

HTTPS is not a new protocol. It is ordinary HTTP, the same requests and responses, carried inside a TLS connection, by default on port 443 instead of 80. The attacker is the same network attacker as before, and that now includes any proxy, Wi-Fi hotspot or ISP on the path.

Figure (svg): Browser and server both speak HTTP; between them a TLS tunnel that is authenticated and encrypted; a network attacker below it sees only ciphertext

End to end, from the browser to the server, the tunnel is authenticated and encrypted, so the attacker sees ciphertext and cannot pose as the server, as long as the browser checked the right name and the right certificate. Every attack in this part works at the edges of that guarantee.

Security I, Lecture 3: TLS and the Web PKI slide s-https-model

6. If the tunnel is perfect, where can an attacker still act?

Socratic

Assume TLS 1.3 itself is unbreakable. The attacker still owns the network.

Discussion prompt

Name three places outside the cryptography where an attacker could still get between a user and a site that uses HTTPS correctly.

Hint: Think of: what is not inside the tunnel, when it does not exist yet, and who reads the screen.

Answer:

Content that falls outside the tunnel: a page delivered over HTTPS that loads one resource over plain HTTP. The moment before the tunnel exists: the first request a user makes when they type a name without https. And the human: a user who reads a lookalike name in the address bar, or a fake lock drawn by the page.

None of these touch AES or the handshake. Each is a seam between the protocol and the system it runs in, and the next slides take them one at a time.

7. The lock is showing. What did it just promise?

Prediction

You open a page and the browser shows its usual secure-connection indicator.

Predict first

Which statement is exactly what the indicator guarantees?

  • The site is run by an honest, legitimate company
  • The page came over an authenticated, encrypted channel to the name shown in the address bar
  • The site has been checked for malware
  • The site is the company whose logo appears on the page

Correct: The page came over an authenticated, encrypted channel to the name shown in the address bar

Why: The lock is a statement about the road, not the destination. Anyone can register a lookalike domain and get a perfectly valid certificate for it, so a phishing page shows the same lock as the real bank. The lock only says no network attacker read or changed the page on its way from that name.

8. What the lock does and does not mean

Concept

The lock icon is the most misunderstood symbol on the Internet. It makes one narrow promise, and the precision of that promise is the security lesson.

the lock DOES meanthe lock does NOT mean
an authenticated channel to the exact name in the address barthat the name is the company you think it is
no network attacker read this pagethat the site is honest or safe to give money to
no network attacker changed this pagethat nothing malicious runs inside the page

Attackers obtain valid certificates for their own lookalike domains all the time, because they genuinely own those domains. The channel to them is secure. Security of the channel is not trust in the counterparty.

Security I, Lecture 3: TLS and the Web PKI slide s-lock

9. The indicator itself never sits still

Concept

Even the one honest signal keeps changing. Browsers have never agreed on what the lock looks like or where it lives, and they keep redesigning it.

periodwhat users were shown
early Firefox releasesa lock in a status bar at the bottom of the window
later Firefox releasesa lock in the address bar, sometimes with a coloured field behind the name
EV era, until 2019a green company name beside the lock for some certificates
Chrome since 2023the padlock replaced by a neutral settings icon, because users read the lock as safe

People cannot form a reliable habit of checking a signal that keeps moving and changing shape, and a moving, inconsistent target is exactly what an attacker imitates. The real fixes therefore have to be structural, not look for the lock.

Security I, Lecture 3: TLS and the Web PKI slide s-lock-ui

10. So, precisely, what does the lock guarantee?

Concept

Written as three clauses, each one scoped to the network attacker.

clausemeaningwhat it assumes
originthe page really came from the host shown in the address barthe user read that host correctly
no network viewernobody on the path read the page contentsthe certificate checks all passed
no network editornobody on the path modified the page contentsevery resource came through the tunnel

Every clause says network attacker. HTTPS says nothing about a dishonest server, a script injected by the site itself, or a user who reads amazonaccounts.com as Amazon. Those threats belong to other lectures. Knowing the exact shape of the guarantee is what lets you see where the next attacks slip through.

Security I, Lecture 3: TLS and the Web PKI slide s-https-guarantee

11. Inside or outside the HTTPS guarantee?

Sorting

Each scenario happens on a site served over HTTPS with a valid certificate.

Sort into buckets

Does HTTPS protect against this, or is it outside what the lock promises?

HTTPS protects
Someone on the café Wi-Fi tries to read your password as it is sent; Your ISP tries to inject an advert into the page; A router on the path tries to change the account number in your transfer form
outside the guarantee
The site's own database is breached and passwords leak; You type your card number into paypa1-billing.com, which has a valid certificate; A comment on the page contains a script that steals cookies (cross-site scripting)
in
A network attacker reading or changing bytes in transit: exactly what the authenticated, encrypted channel stops.
out
The channel worked perfectly; the problem is the server, the page's own content, or the name the user chose to trust.

Security I, Lecture 3: TLS and the Web PKI slide s-https-guarantee

12. One HTTP script on an HTTPS page undoes the whole page

Concept

Mixed content is the classic own goal. The page itself arrives over HTTPS, lock and all, but it pulls in one subresource over plain HTTP.

Figure (svg): An https page whose HTML, stylesheet and image come over TLS, but whose widget.js script comes over plain http that anyone on the path can replace

A script runs with the full authority of the page that included it: it can read the page, the form fields and the session. A network attacker cannot touch the HTTPS parts, but the HTTP request for that one script travels in the clear, so it can be replaced on the way. The channel has a hole, and the whole page is only as protected as that hole.

The developer error is a single http colon slash slash in a script tag. Browsers now block active mixed content, such as scripts and iframes, outright, and upgrade or block passive content such as images. The correct fix is to serve every subresource over HTTPS.

Security I, Lecture 3: TLS and the Web PKI slide s-mixed

13. Audit a page for mixed content

Worked example

A defender's exercise. This page is served from https://bank.example/account. Go through every subresource and decide what a modern browser does with it.

<!-- served from https://bank.example/account -->
<link rel="stylesheet" href="https://bank.example/style.css">
<img src="http://img.example/logo.png">
<script src="http://cdn.example/widget.js"></script>
<iframe src="https://help.example/chat"></iframe>
lineresourceschemekindmodern browser
2style.csshttpsactive (styles)loads normally
3logo.pnghttppassive (image)upgrades to https or blocks; lock degraded
4widget.jshttpactive (script)blocked outright
5help.example/chathttpsactive (frame)loads normally

Figure (svg): The same page: the http script is the hole that voids the lock

Fix the two http lines

Why: Change both to https, and add the response header Content-Security-Policy: upgrade-insecure-requests so any http subresource left in old templates is fetched over https automatically.

Verify: reload with the developer console open

Why: With both lines fixed there are no mixed-content warnings, and the page keeps its full secure indicator.

Security I, Lecture 3: TLS and the Web PKI slide s-mixed

14. sslstrip: attack the moment before TLS starts

Concept

Most people type chase.com, not https://chase.com, and many follow plain http links. So the very first request goes out as plain HTTP, expecting the server to redirect it to HTTPS. That one request is the gap.

Figure (svg): The user's connection to the middle stays http; the middle's connection to the server is genuine https; the user never sees a lock

Moxie Marlinspike's sslstrip (2009) showed what an attacker in the middle can do with it: keep the user's side of the conversation on plain HTTP, while talking genuine HTTPS to the real server itself. The server sees an ordinary client, and the user browses in the clear.

The important observation is about the user, not the attacker: the user is never shown an error or a broken lock. They were never shown a lock at all, so there is nothing missing to notice.

Security I, Lecture 3: TLS and the Web PKI slide s-sslstrip

Moxie Marlinspike — New Tricks for Defeating SSL in Practice (Black Hat DC 2009) sslstrip

15. Why did the server not notice either?

Missing information

During a stripping attack, the real server receives a normal, valid TLS connection.

Discussion prompt

What would the server need to know to detect the attack, and why can it never learn it from its own side of the connection?

Hint: Which of the two connections is the broken one, and who can see it?

Answer:

The server would need to know that the human on the far side intended to use HTTPS but is being served HTTP by someone else. From its side, the attacker is just a well-behaved client completing a correct TLS 1.3 handshake. Nothing about the server's connection is wrong.

So the defence cannot live on the server's connection, and it cannot rely on the user noticing. It has to make the browser refuse to send that first plain request at all. That is HSTS.

16. Trap: “we redirect http to https, so stripping cannot happen”

Trap

The trap

A common belief: the site answers every plain-HTTP request with a 301 redirect to HTTPS, so users always end up on the secure version.

stepwho controls it
the user's first request, http://chase.comsent in the clear, so anyone on the path
the 301 redirect responsealso sent in the clear, so the attacker can drop or rewrite it
whether the browser ever switches to httpswhoever wrote that response

The fix

The redirect is good practice, but it travels over the very channel the attacker controls. An attacker who rewrites the response simply never delivers it. A redirect can only move users who already reached the server honestly.

The fix has to happen before the first packet, inside the browser: that is exactly what HSTS and the preload list do.

Security I, Lecture 3: TLS and the Web PKI slide s-sslstrip

17. The fix: HSTS forbids plain HTTP in advance

Worked example

HTTP Strict Transport Security lets a site declare: only ever reach me over HTTPS. The site sends one response header over HTTPS, and the browser remembers it.

HTTP/1.1 200 OK
Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
Content-Type: text/html
directivevalue hereeffect
max-age63072000 secondsremember for two years (63072000 / 86400 = 730 days)
includeSubDomainspresentthe rule covers every subdomain, so no forgotten host is left on HTTP
preloadpresentasks to be built into browsers so even the first visit is protected

Figure (svg): The user types chase.com; the browser's HSTS store says yes; the URL is rewritten to https before any packet; the first packet is a TLS ClientHello

From then on the browser rewrites any http URL for the site to https itself, before a single packet leaves the machine, so there is no cleartext request for anyone to intercept. HSTS also turns certificate warnings for that site into hard failures that the user cannot click through.

Verify: read the header a real site sends

Why: curl -sI https://github.com on 2026-10-15 returned Strict-Transport-Security: max-age=31536000; includeSubdomains; preload, one year with every subdomain and the preload token. www.chase.com returned max-age=31536000 alone: one year, but no includeSubDomains and no preload.

Security I, Lecture 3: TLS and the Web PKI slide s-hsts

RFC 6797 — HTTP Strict Transport Security (HSTS) sections 6.1 and 8

18. Follow one browser through HSTS

Invariant

A browser visits a site that sends the header from the last slide. Watch what the browser's state is at each step.

Step through it

At which step is the user still exposed, and what removes that step?

  1. Before the header has ever been seen, the first request can still be plain HTTP. This is the one exposed moment.
  2. The header arrives over HTTPS and the browser records it.
  3. Any later http URL is upgraded inside the browser; no cleartext request exists.
  4. A certificate problem on an HSTS host is fatal; the user cannot click past it.
  5. The preload list ships inside the browser, so even the very first visit is covered.

The invariant HSTS keeps: once the browser knows the rule, no plaintext request to the site ever leaves the machine. Preloading closes the first-visit gap by shipping the rule before the first visit.

19. Push HSTS to its edges

Edge cases

HSTS is powerful because it is strict. Strict rules have sharp edges.

Discussion prompt

What goes wrong if a site sends includeSubDomains while one internal subdomain still only works over plain HTTP? And why does the preload list require at least a one-year max-age and includeSubDomains before accepting a site?

Hint: What does the browser do with a subdomain it is told must be HTTPS but cannot reach that way?

Answer:

The HTTP-only subdomain becomes unreachable for every browser that has seen the header, for as long as the max-age lasts. That is the price of the rule, and why sites roll out HSTS with a short max-age first and lengthen it once every subdomain works over HTTPS.

Preloading is effectively permanent, because it ships in browser builds. The preload list only accepts sites that have committed fully: a max-age of at least 31536000 seconds (one year), every subdomain covered, and the preload token present. Removing a site from the list takes months to reach users.

Security I, Lecture 3: TLS and the Web PKI slide s-hsts

20. Even with no lock, will the user notice?

Picture it

After a stripping attack the connection is plain HTTP, so there is no lock. One might hope users notice the absence. Marlinspike tested that hope: he drew a padlock into the site's favicon, the small image the page itself supplies for the browser tab.

Figure (svg): A browser tab with a padlock favicon chosen by the page, beside an address bar that shows plain http with no real lock

People scan for the presence of a lock shape, not for where it is drawn or what it means, and the fake satisfied the glance. Any defence that rests on user vigilance fails at scale. The real fixes are structural: force HTTPS with HSTS, and keep security indicators in browser chrome that the page cannot draw into.

Security I, Lecture 3: TLS and the Web PKI slide s-favicon

Moxie Marlinspike — New Tricks for Defeating SSL in Practice (Black Hat DC 2009) the favicon padlock

21. Why is user training not the fix?

Hypothesis

A security team proposes a campaign: teach every customer to check for the lock before logging in.

Predict first

What is the strongest reason this cannot be the main defence against stripping attacks?

  • Customers are careless and cannot be taught anything
  • The indicator moves between browser versions, the page can draw lookalikes, and a stripped page shows no warning at all, so vigilance fails at scale
  • Training is too expensive
  • Locks are no longer shown in any browser

Correct: The indicator moves between browser versions, the page can draw lookalikes, and a stripped page shows no warning at all, so vigilance fails at scale

Why: The failure is structural, not a moral failing of users. A signal that keeps moving, can be imitated by page pixels, and is simply absent rather than broken under attack cannot be checked reliably by millions of people. HSTS and preloading remove the decision from the user entirely.

Security I, Lecture 3: TLS and the Web PKI slide s-favicon

22. Match each browser-layer attack to its structural fix

Matching

Each attack in this part defeats the lock without touching the cryptography.

Match the pairs

  • a1. an http script on an https page
  • a2. stripping the first plain-HTTP request
  • a3. the first visit to a site, before any header was seen
  • a4. a padlock drawn into the favicon
  • f1. browsers block active mixed content; serve every subresource over HTTPS
  • f2. an HSTS header, so the browser upgrades every request itself
  • f3. the HSTS preload list shipped inside the browser
  • f4. security indicators only in browser chrome the page cannot paint

Why: Every fix moves the decision away from the network and away from the human glance, into the browser itself. That is the theme of this part: the channel was already secure, so the work is in closing the edges around it.

Security I, Lecture 3: TLS and the Web PKI slide s-sslstrip

23. Part 2 — Certificates and the PKI

Section

The handshake proved the server holds a key. Whose key is it?

24. How does Alice know the key she got is really Bob's?

Socratic

Strip the problem to its core. A public key is a number. Nothing in the number says chase.com.

Figure (svg): Alice asks for Bob's key; Bob sends PK_Bob; Mallory in the middle replaces it with PK_M; Alice's handshake then authenticates her to Mallory

Discussion prompt

If Alice receives a key over a network the attacker controls, what goes wrong when she uses it in the handshake? What would a fix have to bind together?

Hint: CertificateVerify proves possession of a private key. It does not say whose.

Answer:

Mallory substitutes her own key, which looks every bit as valid. Alice's handshake then confirms, perfectly, that she is talking to the holder of that key: Mallory. Bare keys cannot be distributed over an untrusted network.

A fix must bind a key to a name in a way the attacker cannot forge. That binding is a certificate, and the rest of this part is how certificates are made, checked, and trusted.

Security I, Lecture 3: TLS and the Web PKI slide s-div-pki

Security I, Lecture 3: TLS and the Web PKI slide s-authenticity

25. Bind the key to a name, with a signature nobody can forge

Concept

Publishing keys in a directory does not help: the attacker tampers with the directory, or with the answer on its way back. The answer is a certificate: a statement that this name owns this public key, signed by a certificate authority (CA).

Figure (svg): A certificate box: names www.chase.com and beta.chase.com, an RSA 2048-bit key, a validity window, and a signature by DigiCert EV RSA CA G2

To trust the statement you need the signer's public key, which seems to recurse forever: who vouches for the CA? The browser breaks the recursion by shipping, built in, the public keys of a set of root CAs. The naming problem becomes a signature-checking problem, which the cryptography lectures already solved.

certificate authority (CA) — an organisation that checks who controls a name, then signs a certificate binding that name to a key

root store — the list of CA public keys a browser or operating system trusts from the moment it is installed

Security I, Lecture 3: TLS and the Web PKI slide s-distribution

26. How many root CAs does your browser trust?

Estimation

Every browser and operating system ships a root store: CA keys it trusts with no further question.

Predict first

Roughly how many root certificates are in a major browser's root store?

  • About 5
  • About 15
  • About 150
  • About 15,000

Correct: About 150

Why: Major root stores hold on the order of 150 root certificates, run by dozens of organisations in many countries, and each root may have signed many intermediate CAs. The next slide is why that number matters so much.

Security I, Lecture 3: TLS and the Web PKI slide s-trusted-cas

27. Any one of them can sign for any site

Concept

This is the single most important fact about the web PKI. The browser trusts every root in its store equally, and by default any CA may issue a certificate for any domain in the world. The browser will accept it.

questionanswer
what power does a CA have?to make the browser accept any key as any site's key
who trusts each CA?every user of that browser, automatically
how many CAs can do this?every root, and every intermediate each root has signed
so your bank's security depends onthe weakest of all of them, not only on the bank's own CA

Your bank chose DigiCert, but an attacker does not need DigiCert. One sloppy or compromised CA anywhere in that set can mint a certificate for your bank. Every rogue-certificate incident in Part 3 is this property going wrong.

Security I, Lecture 3: TLS and the Web PKI slide s-trusted-cas

28. The chain of trust: roots sign intermediates sign leaves

Concept

Certificates form a chain. A root CA, built into the browser, signs certificates for intermediate CAs; intermediates sign leaf certificates for servers. Intermediates exist so the precious root private key can stay offline in a vault and be used rarely.

Figure (svg): The real chain: depth 2 DigiCert Global Root G2, self-signed, in the browser store; depth 1 DigiCert EV RSA CA G2, signed by the root; depth 0 www.chase.com, signed by the intermediate

In the handshake the server sends its leaf and the intermediates. The browser checks each signature upward until it lands on a root it was born trusting. If any signature fails, or the chain ends somewhere the browser does not trust, the connection stops.

Security I, Lecture 3: TLS and the Web PKI slide s-ca-hierarchy

RFC 5280 — Internet X.509 Public Key Infrastructure Certificate and CRL Profile section 6, certification path validation

29. Verify the real chase.com chain, one link at a time

Worked example

This is the chain chase.com sent on 2026-10-15. Walk it the way a browser does: start at the leaf, and at each step check the signature with the key of the certificate above.

$ openssl s_client -connect www.chase.com:443 -servername www.chase.com
Certificate chain
 0 s:O=JPMorgan Chase & Co., CN=www.chase.com
   i:O=DigiCert Inc, CN=DigiCert EV RSA CA G2
 1 s:O=DigiCert Inc, CN=DigiCert EV RSA CA G2
   i:O=DigiCert Inc, CN=DigiCert Global Root G2
 2 s:O=DigiCert Inc, CN=DigiCert Global Root G2
   i:O=DigiCert Inc, CN=DigiCert Global Root G2
Verification: OK
# run 2026-10-15; subject lines shortened
stepcertificatesigned bycheck withresult
1www.chase.com (depth 0)DigiCert EV RSA CA G2the intermediate's public keyvalid; leaf, CA:FALSE
2DigiCert EV RSA CA G2 (depth 1)DigiCert Global Root G2the root's public keyvalid; an intermediate CA
3DigiCert Global Root G2 (depth 2)itselfalready in the root storetrusted by fiat: the chain ends

Figure (svg): The same three links, checked upward

Check the dates on every link

Why: The leaf runs to 2027-01-05, the intermediate to 2030, the root to 2038. All three cover today, so no link has expired.

Verify: openssl agrees

Why: The last line of the openssl output is Verification: OK. Note that a self-signed root proves nothing by its own signature: it is trusted only because it is already in the store.

Security I, Lecture 3: TLS and the Web PKI slide s-ca-hierarchy

30. Put certificate validation in order

Ranking

Order what a browser does with the certificates it receives in the handshake.

Put in order

  1. Receive the leaf and intermediate certificates in the handshake
  2. Build a path from the leaf up to a root in the local root store
  3. Verify each signature on the path with the key of the certificate above
  4. Check every certificate's dates, CA flags and revocation status
  5. Check that the leaf's SAN list covers the hostname in the address bar
  6. Check CertificateVerify: the server signed this handshake with the leaf's key

Why: The chain must exist and every signature on it must hold before any field can be believed. Dates and CA flags are then checked on each link. Only after the leaf is trusted does it matter which names it covers, and only a matching leaf key makes CertificateVerify meaningful: it proves the server holds that private key right now.

Security I, Lecture 3: TLS and the Web PKI slide s-ca-hierarchy

31. What is actually in a certificate

Worked example

The chase.com leaf, printed by openssl on 2026-10-15. Read each field as a claim the CA signed.

$ openssl x509 -noout -text            # the chase.com leaf, 2026-10-15
Issuer:  C=US, O=DigiCert Inc, CN=DigiCert EV RSA CA G2
Validity
    Not Before: Dec 29 00:00:00 2025 GMT
    Not After : Jan  5 23:59:59 2027 GMT
Subject: jurisdictionC=US, businessCategory=Private Organization,
         serialNumber=691011, O=JPMorgan Chase & Co., CN=www.chase.com
Subject Public Key Info: rsaEncryption, Public-Key: (2048 bit), Exponent: 65537
X509v3 Subject Alternative Name: DNS:www.chase.com, DNS:beta.chase.com
X509v3 Basic Constraints: CA:FALSE
Signature Algorithm: sha256WithRSAEncryption
fieldvalue on chase.comwhat it claimsreal attack that targeted it
IssuerDigiCert EV RSA CA G2who signed thisany of ~150 roots could have signed instead
Validity2025-12-29 to 2027-01-05 (372 days)when to believe ita leaked key stays usable until expiry
Subject Alternative Namewww.chase.com, beta.chase.comthe hostnames this key may serveloose matching, lookalike names
Public keyRSA 2048, e = 65537the key being bounda substituted key with no binding
Basic ConstraintsCA:FALSEa leaf, may not sign other certificatesthe MD5 rogue CA flipped this to TRUE
Signature algorithmsha256WithRSAEncryptionthe CA signed a SHA-256 hash of all of the aboveMD5-signed certificates were forged

Figure (svg): The same certificate as a browser displays it

The extra Subject fields, jurisdictionC, businessCategory and serialNumber 691011 (a Delaware company registration number), are there because this is an Extended Validation certificate. Notice that the bare name chase.com is not in the SAN list.

Verify: compute the lifetime

Why: From 2025-12-29 00:00:00 to 2027-01-05 23:59:59 is 372 days, under the 398-day maximum that applied when it was issued.

Security I, Lecture 3: TLS and the Web PKI slide s-cert-example

RFC 5280 — Internet X.509 Public Key Infrastructure Certificate and CRL Profile section 4.2.1.6 (SAN) and 4.2.1.9 (Basic Constraints)

32. The same certificate, as your browser shows it

Picture it

Click the site-information icon and open the certificate, and you see the openssl dump as a dialog.

Figure (svg): A certificate viewer: the hierarchy DigiCert Global Root G2, then DigiCert EV RSA CA G2, then www.chase.com; then Issued To, Issued By, Validity, Public Key and Extensions

The hierarchy at the top is the chain you just verified. The fields below are the claims. That one dialog is the whole trust decision the browser makes on every connection: a leaf, the CA that vouches for it, and a root the browser already trusted.

Security I, Lecture 3: TLS and the Web PKI slide s-cert-gui

33. Which field answers which question?

Matching

A browser asks one question of each certificate field.

Match the pairs

  • q1. Is this key allowed for the host I am visiting?
  • q2. May this certificate sign other certificates?
  • q3. Who vouches for this binding?
  • q4. Is it still in force today?
  • q5. Was the binding really made by the issuer?
  • f1. Subject Alternative Name
  • f2. Basic Constraints
  • f3. Issuer
  • f4. Validity
  • f5. Signature

Why: Each field carries one check, and every one of these fields has been the pivot of a real attack. The old Common Name field is deliberately absent: browsers now ignore it for hostname matching and use only the SAN list.

Security I, Lecture 3: TLS and the Web PKI slide s-cert-example

34. X.509: one format everywhere, and you sign a hash of it

Concept

X.509 is the one certificate format used across TLS, secure email (S/MIME), IPsec VPNs and code signing. Version 3 added the extensions everything now depends on, such as Subject Alternative Name and Basic Constraints.

Figure (svg): The certificate body is hashed with SHA-256, the CA signs the hash with its private key, and the result is the signature

The mechanism to carry forward: a certificate is not signed directly. The body is hashed and the CA signs the hash. So the collision resistance of that hash is the entire security of the certificate, exactly the lesson from the hash-function lecture. If two different bodies ever share a hash, one CA signature is valid for both.

Security I, Lecture 3: TLS and the Web PKI slide s-x509

35. What if the hash has collisions?

Prediction

A CA signs certificates as sign(H(body)). Suppose someone can produce two different bodies B1 and B2 with H(B1) = H(B2), and the CA signs B1.

Predict first

What can be said about the signature on B1?

  • It is valid only for B1, because signatures cover the exact bytes
  • It is also a valid signature for B2
  • It becomes invalid for both
  • It is valid for B2 only if the CA also signs B2

Correct: It is also a valid signature for B2

Why: Verification recomputes H of the body and checks the signature against that hash. B2 gives the same hash as B1, so the signature checks out on B2 too. The CA never saw B2. This is why certificate signatures moved from MD5 to SHA-1 to SHA-256, and why Part 3 starts here.

Security I, Lecture 3: TLS and the Web PKI slide s-x509

36. Does this certificate match the name in the address bar?

Worked example

A valid, trusted certificate is not enough: it must be valid for this host. Otherwise an attacker simply presents a genuine certificate for a domain he owns. The browser compares the address-bar name with each SAN entry, following RFC 9525.

def matches(host, pattern):
    h = host.lower().split(".")
    p = pattern.lower().split(".")
    if len(h) != len(p):              # a wildcard covers exactly one label
        return False
    if p[0] == "*":                   # only the leftmost label may be *
        return h[1:] == p[1:]
    return h == p
address barSAN entrylabelsrulematch?
login.chase.com*.chase.com3 vs 3* covers exactly one leftmost labelyes
chase.com*.chase.com2 vs 3a wildcard never covers the bare domainno
a.b.chase.com*.chase.com4 vs 3a wildcard never spans two labelsno
chase.comwww.chase.com2 vs 3exact names must match exactlyno
beta.chase.combeta.chase.com3 vs 3exact matchyes

Figure (svg): The SAN list being matched comes from this certificate

Apply it to the real leaf

Why: The chase.com SAN list is www.chase.com and beta.chase.com, with no wildcard and no bare chase.com. So this certificate is valid only for those two names; a request to bare chase.com must be answered with a different certificate or redirected.

Verify: historical caution

Why: Browsers once disagreed about whether * could be part of a label (f*.chase.com) or cross dots. Every bit of looseness was an impersonation opportunity, which is why the modern rules are this strict.

Security I, Lecture 3: TLS and the Web PKI slide s-cn-san

RFC 9525 — Service Identity in TLS (successor to RFC 6125: hostname and wildcard matching) section 6.3, wildcard matching

37. Your turn: match four names

Fill the middle

Use the rules from the last slide. Answer yes or no.

Fill in the blanks

host SAN entry match?
shop.example.org *.example.org yes
example.org *.example.org no
x.shop.example.org *.example.org no
evil.com *.example.org no

Why: shop.example.org has three labels and the wildcard replaces exactly the first, so it matches. example.org has only two labels: a wildcard never covers the bare domain. x.shop.example.org has four labels: a wildcard never spans two. evil.com shares nothing with example.org. A certificate for *.example.org therefore needs a separate example.org entry to cover the bare name.

Security I, Lecture 3: TLS and the Web PKI slide s-cn-san

38. When the name itself is a lie: lookalike domains

Concept

The hostname is the one thing the user is supposed to read, so attackers attack the hostname itself. Internationalised domain names allow non-Latin characters, and many Unicode letters look identical to Latin ones: the Cyrillic letters а and р are pixel-for-pixel the Latin a and p in most fonts.

>>> [hex(ord(c)) for c in "аррle"]      # Cyrillic a, r, r + Latin "le"
['0x430', '0x440', '0x440', '0x6c', '0x65']
>>> "аррle.com" == "apple.com"
False
>>> "аррle.com".encode("idna")             # what DNS and the CA really see
b'xn--le-6kc8da.com'
what the user seeswhat the computer comparescertificate?
аррle.com (looks like apple.com)xn--le-6kc8da.com, a different domainvalid: the attacker really owns this domain
apple.comapple.comvalid: Apple's own

Because the attacker genuinely owns the lookalike domain, a CA correctly issues a real certificate for it, and the lock appears. Nothing in the PKI is broken. The defence is in the browser: when a label mixes scripts, such as Cyrillic with Latin, it displays the punycode form xn--le-6kc8da.com, so the disguise shows through.

Security I, Lecture 3: TLS and the Web PKI slide s-idn

39. Can the address bar alone be trusted here?

Discrimination

For each name, decide whether reading the address bar is enough, or whether the name itself is the risk.

Sort into buckets

Trustworthy name, or a name designed to mislead?

the real organisation's name
www.chase.com; accounts.google.com
designed to mislead
chase.com-secure-login.net; xn--le-6kc8da.com shown in place of a familiar brand; amazonaccounts.com
ok
The registrable domain (chase.com, google.com) is the one the organisation owns; everything left of it is their subdomain.
bad
The registrable domain is someone else's: com-secure-login.net, an IDN lookalike, or amazonaccounts.com. All can have valid certificates and a lock.

Security I, Lecture 3: TLS and the Web PKI slide s-idn

40. DV versus EV: what does a fancier certificate buy?

Comparison

Two kinds of certificate. Fill in the missing cells, then decide whether the difference is a security difference.

Comparison matrix

Domain Validation (DV)Extended Validation (EV)
what the CA checksyou control the domain (an automated DNS or HTTP challenge)a human vets the legal organisation behind it
cost and speedfree, issued in seconds (Let's Encrypt)paid, takes days
channel securityTLS 1.3, same keys, same AEADidentical
browser display todaythe normal indicatorthe normal indicator: the green name bar was removed in 2019

EV certifies who runs the company, not the strength of the connection. chase.com uses EV, yet an attacker holding a valid DV certificate for the same name would get the same origin and the same power. Studies found users did not notice the EV indicator, so browsers dropped it.

41. Two truths and a myth about certificate types

Two truths and a lie

Three claims about DV and EV. Two are true.

Eliminate the wrong options

Which claim is the myth?

  • d1. Free automated DV certificates are a big reason HTTPS is now used almost everywhere
  • d2. An EV certificate makes the encrypted connection stronger than a DV certificate
  • d3. The chase.com certificate carries EV fields, but modern browsers show it like any other

Survives elimination: d2

Why: The certificate type changes what the CA checked about the owner, not the handshake or the record layer. Both lead to the same TLS 1.3 connection with the same keys and the same AEAD cipher.

Security I, Lecture 3: TLS and the Web PKI slide s-dv-ev

42. The full checklist before the browser shows the lock

Pattern

Pull the whole part together into the browser's actual checklist. All four must hold, every time.

  1. Every element over HTTPS: no mixed content, since one HTTP subresource voids the page
  2. Issued by a trusted CA: the chain verifies, signature by signature, up to a root in the store
  3. The certificate is valid: inside its dates, not revoked, CA flags correct, signed with a strong hash
  4. The name matches: a SAN entry covers the host in the address bar

And under all four, a fifth that browsers get right and other software often does not: the checks must actually run. Every failure in Part 3 is a trick to make one of these checks pass when it should have failed.

Security I, Lecture 3: TLS and the Web PKI slide s-when-lock

43. Which check should have caught it?

Sorting

Each scenario is a connection that should not have been trusted.

Sort into buckets

Sort it to the check that should have failed.

every element over HTTPS
An HTTPS page loads its login script from an http:// URL
trusted CA chain
The certificate is signed by a CA the browser has never heard of
certificate valid
The certificate's Not After date was last March; A leaf certificate marked CA:FALSE was used to sign another certificate
name matches
The certificate is for evil.example, but the user visited bank.example
https
One plain-HTTP subresource reopens the channel, whatever the certificate says.
chain
With no path to a root in the store, nobody trusted vouched for the binding.
valid
Dates and Basic Constraints are part of whether a certificate may be used at all.
name
A perfectly valid certificate for the wrong name is the attacker's own certificate.

Security I, Lecture 3: TLS and the Web PKI slide s-when-lock

44. Part 3 — When the PKI breaks

Section

Each failure makes one check pass that should have failed. None of them break the cipher.

45. Before the case studies: what will break?

Step zero

The next slides are real incidents from 2008 to 2014. Each one led to valid-looking TLS connections to the wrong party.

Discussion prompt

Before reading them, predict: will any of these attacks need to break AES, recover a TLS session key, or factor an RSA modulus? If not, what will they attack instead?

Hint: Look back at the five-item checklist.

Answer:

None of them break the cipher or the handshake. They attack the checklist: a weak hash under a CA signature, a CA bit that should have been false, a hostname check that was never written, and a signature check that was written but never ran.

Keep the four checks from Part 2 beside you, and for each incident name the one that was defeated. The cryptography is never the thing that breaks.

Security I, Lecture 3: TLS and the Web PKI slide s-div-break

46. The signature is only as strong as its hash: CAs still used MD5 in 2008

Concept

A certificate's signature is sign(H(body)). MD5 collisions had been practical since 2004, and chosen-prefix collisions, where two different chosen starting texts are completed to the same hash, were published in 2007. Yet CAs were still signing certificates with MD5.

what Sotirov and colleagues measured (2008)value
live certificates collectedabout 30,000
of those, signed with MD5about 9,000
share of the MD5 ones from a single CA (RapidSSL)97%
that CA's issuancefully automated, cheap, seconds per certificate, predictable serial numbers

Figure (svg): Certificate body, hashed, signed: if two bodies share the hash, one signature fits both

Every one of those properties mattered. A broken hash meant two bodies could share a signature; automation meant no human would look at an odd request; predictable fields meant the attacker could know in advance what the CA itself would write into the certificate.

Security I, Lecture 3: TLS and the Web PKI slide s-md5-ca

Sotirov, Stevens, Appelbaum, Lenstra, Molnar, Osvik, de Weger — MD5 considered harmful today: creating a rogue CA certificate (2008) the certificate survey

47. Why did predictable serial numbers matter?

Socratic

The CA fills in some fields of every certificate itself, such as the serial number and validity dates. The requester does not choose them.

Discussion prompt

A collision has to cover the whole body the CA hashes, including the fields the CA writes. Why does it help an attacker if those fields are predictable, and what rule would take that help away?

Hint: Can you prepare a collision for bytes you do not know yet?

Answer:

If the CA's own fields are unpredictable, the attacker cannot know the exact bytes that will be hashed, so a collision prepared in advance does not line up. Predictable fields hand the attacker the full body before the CA signs it.

The industry rule that followed: certificate serial numbers must contain at least 64 bits of output from a cryptographically secure random generator (CA/Browser Forum baseline requirements, 2016). The chase.com leaf's serial is 128 random-looking bits, 01BA36D85D79F704DF4E5653B6BB63ED. Randomising what the signer adds is a defence in depth that holds even if the hash weakens.

Security I, Lecture 3: TLS and the Web PKI slide s-md5-ca

48. Colliding certificates: one signature, two certificates

Concept

The idea in one picture, without the recipe. Two certificate bodies are prepared so that they have the same MD5 value. One is an ordinary request for a harmless domain with CA:FALSE: that is the one shown to the CA. The other carries a different name and key and CA:TRUE.

Figure (svg): Left, the body shown to the CA: an ordinary name and CA:FALSE. Right, the body that was wanted: a different name and key and CA:TRUE. Both lead to the same MD5 value, so the CA's signature on the left verifies on the right

The CA verifies the innocent request, computes its MD5 and signs it, exactly as designed. Because the other body has the same MD5, the very same signature is valid on it. The CA believes it signed a harmless leaf; it has in effect signed a trusted intermediate CA.

Which check did this defeat? Certificate valid: specifically, signed with a strong hash. The CA's private key was never stolen and RSA was never broken.

Security I, Lecture 3: TLS and the Web PKI slide s-colliding

Sotirov, Stevens, Appelbaum, Lenstra, Molnar, Osvik, de Weger — MD5 considered harmful today: creating a rogue CA certificate (2008) the colliding certificate pair

49. The CA did everything right, and still signed a CA

Anomaly

RapidSSL checked the requester's domain correctly, set CA:FALSE correctly, and signed with its genuine key.

Predict first

Where, then, was the failure?

  • RapidSSL's private key had been stolen
  • The signature covered an MD5 hash, so it also covered every other body with the same MD5
  • The browser forgot to check Basic Constraints
  • RSA had been broken

Correct: The signature covered an MD5 hash, so it also covered every other body with the same MD5

Why: Every step the CA performed was correct for the body it saw. The failure was in what a signature means: a signature over MD5(body) is a signature over the whole collision class of that body. Choosing a collision-resistant hash is part of the meaning of the signature, not an implementation detail.

Security I, Lecture 3: TLS and the Web PKI slide s-colliding

50. The result: a skeleton key for the whole Web

Concept

The rogue certificate said CA:TRUE and chained to a root every browser trusted. Its holder was therefore a trusted intermediate CA, and could issue a certificate for any domain, chase.com, google.com, anything, that every browser would accept. The researchers deliberately gave theirs an expiry date in the past, so it could not be misused.

what made it possiblewhat fixed it
MD5 still accepted for certificate signaturesMD5, then SHA-1, banned for certificates; SHA-256 required
CA-written fields such as serial numbers were predictableat least 64 random bits in every serial number
fully automated, unmonitored issuanceissuance audits, and every certificate published in public logs (CT)
any CA can sign for any nameCT monitoring, and CAs that misbehave are removed from root stores

The collision itself cost about one to two days on a cluster of 200 PlayStation 3 consoles. The lesson is not the cost but the shape: a deprecated hash anywhere in a trust chain turns one ordinary purchase into authority over every site.

Security I, Lecture 3: TLS and the Web PKI slide s-rogue-ca

Sotirov, Stevens, Appelbaum, Lenstra, Molnar, Osvik, de Weger — MD5 considered harmful today: creating a rogue CA certificate (2008) the rogue CA, presented at 25C3, December 2008

51. This was not just academic: Flame, 2012

Real world

Flame was espionage malware found in 2012 after years of operation in the Middle East. Its most striking feature: infected machines accepted its modules as Windows updates signed by Microsoft.

Discussion prompt

Using the checklist, explain how a Microsoft signature could appear on malware without Microsoft's key being stolen, and what Microsoft had to change afterwards.

Hint: Same weakness as the rogue CA; different victim and a far more serious attacker.

Answer:

Flame carried a fake certificate that chained up to a Microsoft root. It was made with an MD5 chosen-prefix collision against an obscure Microsoft Terminal Server Licensing certificate that was still MD5-signed and, by a configuration mistake, also allowed code signing. The defeated check is the same as in 2008: certificate valid, signed with a strong hash, plus a CA that could sign more than it should.

The collision technique differed from the published academic one, which suggests a well-resourced team had its own cryptanalysis first. Microsoft revoked the affected intermediate certificates (Security Advisory 2718704), moved the licensing service off code-signing trust, and hardened Windows Update. A deprecated hash left anywhere in a trust chain is not a theoretical risk.

Security I, Lecture 3: TLS and the Web PKI slide s-flame

52. The modern defence: make every certificate public

Concept

You cannot prevent every mis-issuance, so make it impossible to hide. That is Certificate Transparency (CT). Every certificate a CA issues must be submitted to public, append-only, cryptographically verifiable logs. Each log returns a signed certificate timestamp (SCT), a promise that the certificate is now in the log.

Figure (svg): The CA submits to public logs and receives SCTs; the browser demands SCTs and rejects certificates without them; monitors and domain owners watch the logs for certificates they never requested

pieceon the real chase.com leaf
SCTs embedded in the certificate3, from independent logs
browser policyChrome and Safari reject publicly trusted certificates without enough valid SCTs
anyone can search the logsfor example crt.sh lists every logged certificate for a domain

CT does not stop a bad CA from signing. It guarantees the act is visible: a domain owner watching the logs sees a certificate they never requested within hours. Repeatedly caught CAs, including large ones, have been distrusted and removed from browsers. Detection plus accountability, rather than prevention.

Security I, Lecture 3: TLS and the Web PKI slide s-ct

RFC 9162 — Certificate Transparency Version 2.0 (successor to RFC 6962) sections 1 and 8

53. A CA mis-issues a certificate for your domain. What happens now?

Prediction

Suppose a CA somewhere, by mistake or under pressure, issues a certificate for your company's domain to someone else. Your company monitors CT logs.

Predict first

What is the most likely course of events in today's web PKI?

  • Nothing visible: the certificate is used quietly for years
  • To be accepted by browsers it must be logged, so your monitor sees it, you report it, and it is revoked and the CA investigated
  • Browsers detect that the certificate is a fake by inspecting its cryptography
  • The certificate cannot be issued at all, because CT prevents signing

Correct: To be accepted by browsers it must be logged, so your monitor sees it, you report it, and it is revoked and the CA investigated

Why: The certificate is cryptographically perfect, so nothing in the math gives it away. What changed is that an unlogged certificate is rejected, and a logged one is public. Mis-issuance becomes a short, visible incident with consequences for the CA, instead of a silent skeleton key.

Security I, Lecture 3: TLS and the Web PKI slide s-ct

54. “The most dangerous code in the world”: forgetting to check the name

Concept

A certificate can be perfectly valid, chain to a trusted root, and still belong to the attacker, because it was issued to the attacker's own domain. The hostname check is what catches that: does a name in the certificate match the host I meant to reach?

Browsers do this check. In 2012, Georgiev and colleagues showed that outside browsers, the check was routinely skipped: in payment SDKs from major processors, in cloud client libraries, in mobile banking apps, and in many Android apps. The reason was not malice. The SSL library interfaces were confusing, and their defaults often validated the chain but not the name.

checkbrowserthe broken apps
chain to a trusted rootyesusually yes
certificate dates and flagsyesusually yes
hostname matches a SAN entryyesskipped
result against an attacker with any CA-signed certificateconnection refusedsilently accepted

The cipher was flawless. The missing piece was an if statement.

Security I, Lecture 3: TLS and the Web PKI slide s-hostname

Georgiev, Iyengar, Jana, Anubhai, Boneh, Shmatikov — The Most Dangerous Code in the World: Validating SSL Certificates in Non-Browser Software (ACM CCS 2012) sections 1 and 7

55. Write a client that checks both the chain and the name

Worked example

In Python, the safe default is one call: ssl.create_default_context() turns on chain verification and hostname checking. Pass server_hostname so the library knows which name to check. This script was run on 2026-10-15 against chase.com and three public test hosts.

import socket, ssl

ctx = ssl.create_default_context()   # verify_mode = CERT_REQUIRED, check_hostname = True
hosts = ["www.chase.com", "wrong.host.badssl.com",
         "expired.badssl.com", "self-signed.badssl.com"]
for host in hosts:
    try:
        with socket.create_connection((host, 443), timeout=10) as s:
            with ctx.wrap_socket(s, server_hostname=host) as t:
                print("OK  ", host, t.version())
    except ssl.SSLCertVerificationError as e:
        print("FAIL", host, "|", e.verify_message)
hostwhat is wrong with itresult printed
www.chase.comnothingOK, TLSv1.3
wrong.host.badssl.comvalid certificate for a different nameFAIL: Hostname mismatch, certificate is not valid for 'wrong.host.badssl.com'
expired.badssl.compast its Not After dateFAIL: certificate has expired
self-signed.badssl.comno path to a trusted rootFAIL: self-signed certificate

Figure (svg): The checks behind each OK: a chain to a root, valid dates on each link, and a matching leaf

Read the three failures as the checklist

Why: wrong.host fails the name check, expired fails the validity check, self-signed fails the trusted-chain check. Each test host defeats exactly one check, and the default context catches all three.

Verify: what the library is doing

Why: create_default_context sets verify_mode to CERT_REQUIRED and check_hostname to True, and loads the system root store. Printing ctx.verify_mode and ctx.check_hostname shows 2 and True.

Security I, Lecture 3: TLS and the Web PKI slide s-hostname

Python documentation — ssl.create_default_context and SSLContext.check_hostname create_default_context, check_hostname

56. Code review: a payment client that trusts everyone

Error analysis

A teammate's client code for a payments integration. It connects, and it works in testing. Open each note.

Annotate

  • Line 5: check_hostname = False accepts a valid certificate for any domain, including the attacker's own. This is exactly the bug from the 2012 study.
  • Line 6: CERT_NONE skips chain verification entirely, so even a self-signed certificate made by the attacker is accepted.
  • Line 8: wrap_socket is called without server_hostname, so no name could be checked even if checking were on, and no SNI is sent.
  • Line 12: verify=False in requests disables all certificate checks for the payment request. It usually appears to silence a test-environment error and then ships.
  • Fix for all of it: delete lines 5 and 6, pass server_hostname=host, and remove verify=False. If a test server uses a private CA, load that CA with ctx.load_verify_locations or verify='ca.pem' instead of turning verification off.

Every one of these lines encrypts perfectly and authenticates nobody. An encrypted connection to an unverified party is a secure channel to the attacker.

Security I, Lecture 3: TLS and the Web PKI slide s-hostname

Georgiev, Iyengar, Jana, Anubhai, Boneh, Shmatikov — The Most Dangerous Code in the World: Validating SSL Certificates in Non-Browser Software (ACM CCS 2012) the broken payment SDKs

57. Apple's “goto fail” (2014): one stray line skips the whole check

Worked example

The mirror image of the last slide: here the check is written, but never runs. This is a code review of Apple's Secure Transport, the function that verifies the server's signature over the key-exchange parameters. Find the bug before reading the table.

static OSStatus
SSLVerifySignedServerKeyExchange(SSLContext *ctx, bool isRsa,
                                 SSLBuffer signedParams, ...)
{
    OSStatus err;
    ...
    if ((err = SSLHashSHA1.update(&hashCtx, &clientRandom)) != 0)
        goto fail;
    if ((err = SSLHashSHA1.update(&hashCtx, &serverRandom)) != 0)
        goto fail;
    if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0)
        goto fail;
        goto fail;                       /* the duplicated line */
    if ((err = SSLHashSHA1.final(&hashCtx, &hashOut)) != 0)
        goto fail;

    err = sslRawVerify(ctx, ctx->peerPubKey, dataToSign, dataToSignLen,
                       signature, signatureLen);   /* the actual check */
    ...
fail:
    SSLFreeBuffer(&signedHashes);
    SSLFreeBuffer(&hashCtx);
    return err;
}
linestatementruns?err afterwards
7-8hash clientRandom; on error goto failyes, succeeds0
9-10hash serverRandom; on error goto failyes, succeeds0
11-12hash signedParams; on error goto failyes, succeeds0
13goto fail (not inside any if)yes, always0
14-18finish hash; sslRawVerify: the actual signature checknever-
20-23fail: free buffers, return erryes0, which the caller reads as success

Figure (svg): Three successful hash steps, then an unconditional goto fail that jumps past sslRawVerify to return err, which is still 0

Name the defeated check

Why: The server's signature over the handshake, which is what proves the other end holds the certificate's key. Every iOS and macOS device accepted a forged signature on the key exchange: a full man-in-the-middle, the exact attack TLS exists to stop (CVE-2014-1266, fixed in iOS 7.0.6 and OS X 10.9.2).

Verify: why indentation lied

Why: Line 13 is indented like line 12, so it looks guarded. In C, an if without braces controls only the next single statement. The indentation was for humans; the compiler followed the grammar.

Security I, Lecture 3: TLS and the Web PKI slide s-gotofail

CVE-2014-1266 — Apple Secure Transport fails to verify the ServerKeyExchange signature (goto fail) Apple Secure Transport

58. What would have caught goto fail?

Explain it to yourself

The bug was one duplicated line in a security-critical function, and it shipped to every Apple device.

Discussion prompt

List three engineering practices, each of which would independently have caught or prevented this bug, and say what each one would have reported.

Hint: One is about code style, one is about the compiler, one is about tests.

Answer:

Braces on every if: with if (...) { goto fail; }, the duplicated line would sit outside the braces in plain sight, or would be harmless inside them. Many style guides require braces for exactly this reason.

A compiler warning for unreachable code, such as clang's -Wunreachable-code, flags the sslRawVerify call as never executed. And a negative test, a handshake with a deliberately invalid signature that must be rejected, fails immediately. A security check that has never been seen to reject anything has not been tested.

Security I, Lecture 3: TLS and the Web PKI slide s-gotofail

59. A key leaks. Can you take a certificate back?

Concept

Certificates sometimes have to be withdrawn early: a private key is compromised, a CA is breached, or a certificate was mis-issued. That is revocation, and it has never worked well.

mechanismhow it worksthe catch
expirationthe certificate stops being valid after Not Aftercrude: a leaked key stays usable until then
CRLthe CA publishes a signed list of revoked serial numberslarge, and stale between updates
OCSPthe browser asks the CA: is this certificate still good?slow, tells the CA which sites you visit, and usually soft-fails
OCSP staplingthe server attaches a fresh signed still-good answer to the handshakebetter, but optional, so an attacker simply omits it
short-lived certificatescertificates live only weeks or days, so they expire before revocation would matterthe modern answer

The chase.com leaf lists both a CRL (crl3.digicert.com and crl4.digicert.com) and an OCSP responder (ocsp.digicert.com). Browsers today mostly rely on their own pushed revocation lists, such as Chrome's CRLSets and Firefox's CRLite, rather than asking each CA live.

Security I, Lecture 3: TLS and the Web PKI slide s-revocation

RFC 5280 — Internet X.509 Public Key Infrastructure Certificate and CRL Profile section 5, CRLs

60. Soft-fail: does revocation stop an attacker?

Prediction

An attacker holds a stolen private key and its certificate, which the CA has already revoked. The browser checks revocation with OCSP, but treats can't reach the OCSP server as fine, to avoid breaking sites when responders are down.

Predict first

The attacker is in the middle of the victim's network. What happens?

  • The browser learns of the revocation and refuses the connection
  • The attacker blocks the OCSP request, the browser soft-fails, and the revoked certificate is accepted
  • The certificate's own signature fails because it was revoked
  • TLS 1.3 forbids revoked keys in CertificateVerify

Correct: The attacker blocks the OCSP request, the browser soft-fails, and the revoked certificate is accepted

Why: The only party who can stop the check is exactly the attacker the check is for. A revoked certificate is still a correctly signed certificate, so nothing in the math changes. Soft-fail revocation protects against everyone except the attacker, which is why the industry moved to short lifetimes instead.

Security I, Lecture 3: TLS and the Web PKI slide s-revocation

61. How long may a certificate live from 2029?

Estimation

The chase.com leaf was issued on 2025-12-29 and lasts 372 days, under the old 398-day maximum. CA/Browser Forum ballot SC-081 (2025) shortens the maximum in steps: 200 days from 2026-03-15, 100 days from 2027-03-15, and then again from 2029-03-15.

Predict first

What is the maximum lifetime of a publicly trusted TLS certificate issued after 2029-03-15?

  • 398 days
  • 200 days
  • 47 days
  • 7 days

Correct: 47 days

Why: SC-081 ends at 47 days. A certificate that cannot be revoked reliably can at least be made to expire quickly, which caps how long a stolen key or a mis-issued certificate is useful. It also forces automation, since nobody renews by hand every six weeks; Let's Encrypt's automated issuance is the model. Under the new rules chase.com could not get a 372-day certificate again.

Security I, Lecture 3: TLS and the Web PKI slide s-revocation

62. Part 4 — The whole lecture

Section

The channel is solved; the naming is not

63. Takeaways

Concept

Five lines summarise the TLS lectures.

takeawaywhere you saw it
The channel is solved; the naming is not. Almost every real TLS disaster is a failure of whose key is this, not of the cipher.rogue CA, Flame, hostname bugs, goto fail
Ephemeral keys buy forward secrecy. Delete the Diffie-Hellman secrets after each handshake and a stolen long-term key cannot decrypt the past.TLS 1.3 made it mandatory
Backward compatibility is an attack surface. Authenticate the negotiation, and delete the weak options.downgrades, FREAK, Logjam, POODLE
The lock secures the road, not the destination.lookalike domains, phishing with valid certificates, mixed content
You trust the weakest CA, hash and if statement.MD5 CAs, missing name checks, an unbraced if

If you remember one thing: be suspicious of the authenticity story and the checks around it, never of the AES. The next topic is authentication of the human on the other end.

Security I, Lecture 3: TLS and the Web PKI slide s-takeaways

64. Draw what happens when you open https://www.chase.com

Connect it up

Put the whole lecture on one diagram.

Draw it

Draw the browser, the network attacker and the server. Mark, in order: the HSTS lookup before any packet; the TLS 1.3 handshake; the certificate chain from www.chase.com through DigiCert EV RSA CA G2 to DigiCert Global Root G2; the name check against the SAN list; the CT timestamps; and the record layer carrying HTTP. Beside each, write the attack it stops (sslstrip, eavesdropping, a rogue certificate, a lookalike or wrong-host certificate, a hidden mis-issuance, tampering).

A good diagram has every check before the first byte of HTTP is sent, and one attack per check. Anything left unlabelled is a check you would be trusting without knowing why.

65. Checkpoint: a hostname

Check

Solve it on paper before you click.

Check your understanding

A server presents a valid, unexpired certificate chaining to a trusted root, with SAN entries *.shop.example and shop.example. Which address-bar host does it NOT cover?

  • A. shop.example
  • B. cart.shop.example
  • C. eu.cart.shop.example (correct)
  • D. www.shop.example

Answer: C

Why: The wildcard replaces exactly one leftmost label, so it covers cart.shop.example and www.shop.example, and the explicit entry covers the bare name. eu.cart.shop.example is two labels deep, which no wildcard covers.

Why A tempts people
Covered by the explicit shop.example entry, which is why certificates list the bare name separately.
Why B tempts people
One label in place of the star: covered.
Why D tempts people
One label in place of the star: covered.

66. Checkpoint: the right fix

Check

Solve it on paper before you click.

Check your understanding

Users of bank.example sometimes type the name without https on public Wi-Fi. Which change most directly stops a stripping attack on them, including on their very first visit?

  • A. Switch to an Extended Validation certificate
  • B. Send Strict-Transport-Security with a long max-age and includeSubDomains, and submit the domain to the HSTS preload list (correct)
  • C. Redirect every http request to https with a 301 response
  • D. Show a banner telling users to check for the lock

Answer: B

Why: HSTS makes the browser upgrade to https itself, before any packet, and preloading ships that rule inside the browser so even the first visit never sends plain HTTP.

Why A tempts people
EV changes what the CA checked about the owner; the stripped user never reaches TLS at all.
Why C tempts people
The redirect is itself sent over plain HTTP, which is exactly the response the attacker rewrites.
Why D tempts people
Vigilance fails at scale, and a stripped page shows no broken lock to notice.

67. Exit ticket

Exit ticket

One question to check the central idea.

Predict first

An app encrypts all its traffic with TLS 1.3 but sets check_hostname = False. What does an attacker on the network need to read the traffic?

  • To break AES-GCM
  • Any valid certificate from a trusted CA, for any domain the attacker owns
  • Chase's private key
  • Nothing: the traffic is already in plaintext

Correct: Any valid certificate from a trusted CA, for any domain the attacker owns

Why: The app checks that some trusted CA vouched for the key, but not for which name. The attacker gets a free DV certificate for a domain they own, completes a perfect TLS 1.3 handshake with the app, and relays traffic to the real server. Encryption without authentication is a secure channel to whoever answered.

68. What you can do now

Recap

The single thread: TLS 1.3 gives a channel that is cryptographically excellent, and every remaining risk is in deciding, and showing, who is on the other end.

threatstructural defence
stripping the first HTTP requestHSTS and the preload list
a rogue or mis-issued certificateCertificate Transparency and CA distrust
a weak hash under a CA signatureSHA-256 only, random serial numbers
a client that skips a checklibrary defaults (create_default_context), negative tests
a key that leaksshort-lived certificates

Security I, Lecture 3: TLS and the Web PKI slide s-ack — Lecture materials by Suman Jana (Columbia University), with slides originally from Vitaly Shmatikov; re-typeset and extended with TLS 1.3 and Certificate Transparency in the Security I course. Figures and results credited there: Sotirov et al. (rogue CA), Moxie Marlinspike (sslstrip, favicon), Stephan Schultze (lock-icon evolution), Georgiev et al. (most dangerous code), Debian DSA-1571

Sotirov, Stevens, Appelbaum, Lenstra, Molnar, Osvik, de Weger — MD5 considered harmful today: creating a rogue CA certificate (2008) rogue CA

Georgiev, Iyengar, Jana, Anubhai, Boneh, Shmatikov — The Most Dangerous Code in the World: Validating SSL Certificates in Non-Browser Software (ACM CCS 2012) non-browser certificate validation

Sources

  1. Security I, Lecture 3: TLS and the Web PKI
  2. RFC 5280 — Internet X.509 Public Key Infrastructure Certificate and CRL Profile
  3. RFC 6797 — HTTP Strict Transport Security (HSTS)
  4. RFC 9162 — Certificate Transparency Version 2.0 (successor to RFC 6962)
  5. RFC 9525 — Service Identity in TLS (successor to RFC 6125: hostname and wildcard matching)
  6. Sotirov, Stevens, Appelbaum, Lenstra, Molnar, Osvik, de Weger — MD5 considered harmful today: creating a rogue CA certificate (2008)
  7. Georgiev, Iyengar, Jana, Anubhai, Boneh, Shmatikov — The Most Dangerous Code in the World: Validating SSL Certificates in Non-Browser Software (ACM CCS 2012)
  8. CVE-2014-1266 — Apple Secure Transport fails to verify the ServerKeyExchange signature (goto fail)
  9. Moxie Marlinspike — New Tricks for Defeating SSL in Practice (Black Hat DC 2009)
  10. CA/Browser Forum Ballot SC-081 — Introduce schedule of reducing validity and data reuse periods
  11. Let's Encrypt — How It Works (automated domain validation)
  12. Python documentation — ssl.create_default_context and SSLContext.check_hostname
  13. HSTS preload list submission requirements

Want this taught 1-on-1? Alexander tutors Computer Security — $55/session, free consultation.

Book on Wyzant · Text (657) 465-8108