COMS W4181 · Security I · Fall 2026 · Lecture 3

TLS and the
Web PKI

Columbia University

$ openssl s_client -connect chase.com:443 # a private, honest channel to the real chase.com, over a hostile network
[!] Feedback - tell us how it's going

The anonymous Slido is open all lecture.

  • Too fast or too slow? Say so, live.
  • Something didn't land? Drop it in and I'll loop back.
  • No name attached. Totally anonymous.
QR code to the anonymous feedback poll

Anonymous feedback

[!] The competition leaderboard is live
security1-leaderboard.netlify.app
The Security-1 competition leaderboard site

Everyone on the board flies under a codename.

  • Sign in with your UNI and competition password to see which codename is yours.
  • You can also see how your points break down.
  • Only you learn your codename. Nothing is stored in your browser.

security1-leaderboard.netlify.app ↗

[↶] Recap · Locking without sharing a key first BOB MAKES A MATCHED PAIR, PUBLISHES ONE HALF, KEEPS THE OTHERKeyGenPKpublic: hand to anyoneSKsecret: Bob only ALICEBOBmessagelock · PKcopen wireunlock · SKmessage sees csees PKShe has PK and c, yet she can lock,never unlock. No secret shared first.

The public key is an open padlock Bob gives away. Anyone can snap it shut; only his private key opens it.

[↶] Recap · Use 1: send ZZ a private message

PK = ZZ’s public key (everyone has it) · SK = ZZ’s private key (ZZ only).

SETUP, ONCE: ZZ PUBLISHES THE PUBLIC KEY ZZ KeyGen PK SK post it on the course page every student has PK ZZ keeps SK and never sends it anywhere a studentEncrypt · PKcwireDecrypt · SKZZ reads
Can AES do this? Yes, but every student would need a key shared with ZZ in advance. 300 students, 300 secret keys to set up. Public key needs none.
[↶] Recap · Use 2: ZZ posts a signed announcement

ZZ signs with the private key; every student checks with ZZ’s public key.

SETUP, ONCE: ZZ PUBLISHES THE PUBLIC KEY ZZ KeyGen PK SK post it on the course page every student has PK ZZ keeps SK and never sends it anywhere ZZSign · SKm, swireVerify · PK✓ really ZZ
Can AES do this? No, a MAC needs a shared key, so any student who can verify could also forge it, and could never prove to others it was ZZ. Signatures give public, non-repudiable proof.
[↶] Recap · Use 3: a student and ZZ agree on a key

They never met, yet end up with the same secret k.

SETUP, ONCE: ZZ PUBLISHES THE PUBLIC KEY ZZ KeyGen PK SK post it on the course page every student has PK ZZ keeps SK and never sends it anywhere 1 · THE STUDENT PICKS A KEY AND SENDS IT LOCKED a student random k Encrypt · PK c open wire Decrypt · SK ZZ has k Eve sees c, never k 2 · BOTH SIDES NOW SHARE k: SWITCH TO FAST AES student · k AES-CTR(k): the real data ZZ · k
Can AES alone do this? No: it needs a secret already shared. Public key is 100 to 1000× slower, so it only sets up k. TLS, SSH and PGP all start this way.

This is how a network uses public-key crypto, and today we watch TLS do it with chase.com.

[↶] Recap · RSA: build the key pair p =61 q =53 two random primes secret multiply n = p·q3233 public factor n back? no fast method known φ(n) = (p−1)(q−1)60·52 = 3120 secret Fact 1: easy only if you know p and q pick e17 public e shares no factor with φ. Why? solve e·d ≡ 1 (mod φ)d = 2753 secret check: 17·2753 = 15·3120 + 1 public key(17, 3233) private key2753 then throw away p, q, φ

? Why must e share no factor with φ? Otherwise no d exists. e = 2: 2·d is even, never ≡ 1 (mod 3120).

[↶] Recap · RSA symbols: what each letter means, and who may see it
PUBLIC – rides on the wire, anyone may hold it: n, e SECRET – never leaves the owner: p, q, φ, d
SymbolWhat it isRelationWho sees it
p, qthe two prime factorschosen at randomsecret
nthe modulusn = p·qpublic
φ(n)Euler totient of nφ(n) = (p−1)(q−1)secret
eencryption exponentshares no factor with φ(n)public
ddecryption exponente·d ≡ 1 (mod φ)secret
(e, n)public keyencrypt / verifypublic
(d, n)private keydecrypt / signsecret

Memory hook: the secret set is everything you need to build the key (p, q, φ) plus the trapdoor d; once d exists, p, q, φ are thrown away. Only n and e are ever published.

[↶] Recap · The three scenarios, with our real numbers ZZ's key: p = 61, q = 53, n = 3233, φ = 3120 public (e, n) = (17, 3233)private d = 2753 ✉️Use 1a private message65 → 6517 mod 3233 = 2790 → 27902753 mod 3233 = 65 ✓Anyone can lock with e = 17. Only ZZ, holding d = 2753, can unlock it.c = me, m = cd (mod n) 📝Use 2a signed announcement123 → 1232753 mod 3233 = 2746 → 274617 mod 3233 = 123 ✓Only ZZ can sign with d = 2753. Anyone can check it with e = 17.s = md, m = se (mod n) 🤝Use 3agree on a keyk = 65 → send 6517 mod 3233 = 2790 → ZZ: 27902753 mod 3233 = 65Both sides now hold k = 65, so they switch to fast AES.This is today’s topic.

Today we see how a browser and a server agree on a key over the network, which is Use 3. TLS needs two of these. Use 2 lets the server prove it is really Chase. Use 3, or its cousin Diffie-Hellman, gives both sides a shared key.

[+] TLS is everywhere, and you use it all day

TLS gives two programs a private, authenticated channel over a network the attacker controls. Here are three places you used it this week.

https://github.com
GitHub home page loaded over HTTPS

The Web. The lock in the address bar means this page arrived over TLS.

https://www.whatsapp.com
WhatsApp home page loaded over HTTPS

Messaging. WhatsApp’s site and WhatsApp Web reach its servers over TLS.

https://platform.openai.com
OpenAI developer quickstart, create and export an API key

APIs. Your secret API key rides in every request. TLS keeps it off the wire.

Authorization: Bearer sk-proj-…

Email, VPNs, card payments, and software updates also run over TLS. If a connection is secure today, TLS is almost certainly underneath.

[ 00 ]

The Internet,
before TLS

Your messages cross the world through machines you do not control. For years, they did so in the clear.

[+] How does a message travel across the Internet? How does your message get from your laptop to Chase?💻youyour laptop🏦chase.comthe bank📶cafe Wi-Fithe routerCafe Wi-FiThe router in the cafe. Whoeverruns it sees all your trafficbefore anyone else.🏢your ISPComcast, etc.ISP = Internet Service ProviderThe company you pay for Internet,like Comcast, Verizon, orColumbia when you are on campus.🌐the backbonecables, routersBackboneLong-distance networks that linkall the ISPs together: bigrouters and undersea cables.None of these machines belong to you or to Chase.Your message is handed from machine to machine, like a postcard passed through the mail.
[x] Without TLS, your login is a postcard anyone can read STAMPPOSTCARDPOST /login HTTP/1.1Host: chase.comuser=alice&pass=hunter2Anyone holding this card can read every word.cafe Wi-Fihunter2your ISPhunter2backbonehunter2Every hop reads your password.

Before TLS, web pages, email, and logins all traveled exactly like this.

[x] A machine in the middle can do three bad things 👁️Eavesdroppass=hunter2👁️(read in passing)It reads your password as it passes by.✏️Tamperpay $10→pay $9000(changed in flight)It changes what you sent, and you never know.🎭Impersonatechase.com(a fake login page)It pretends to be Chase and collects your login.
[x] Story: a stranger at the coffee shop reads your account 2010 · a coffee shop💻☕Alice📶cafe Wi-FiFacebook🎫🎫Bob🎫a copy🎫Welcome, Alice!
[x] Story: a swapped program turns visitors into attackers 2015 · the Great Cannon💻💻💻visitorsthe networka website📜helper program📜✗💣swapped on the wayGitHub💥flooded for days
[x] Story: the free airport Wi-Fi that was not the airport’s the airport · a common trick💻you📶“Free Airport WiFi”a stranger’s laptopchase.comCHASEFAKE🔑real Chasepasses you on, nothing looks wrong
[+] Why TLS was invented: you cannot shop with postcards 1994: a postcardcard no.4111 1111 1111 1111Shopping on the Web meanssending this in the clear.Netscape invents SSLto make online shopping safe✉️🔒a sealed, signed envelopeNobody can read it, change it,or fake who sent it.
[ 01 ]

What TLS
promises

Who is the enemy, what can it do, and what exactly must TLS guarantee?

[x] The threat model: the attacker owns the network 💻youThe attacker controls every machine in between.cafe Wi-Fi, DNS, routers, ISPchase.comWHAT IT CAN DO👁️It can read every packetyou send and receive.✏️It can change any packetwhile it is in flight.❌It can drop packets orinject packets of its own.🌐It can answer your DNSlookups with any address.WHAT IT WANTS🔑It wants your passwordand your session cookie.💳It wants to changewhere your money goes.🎭It wants to pass itselfoff as chase.com.🤫And it wants all of thisto go unnoticed.WHAT IT CANNOT DO🧮It cannot break good crypto,like AES or a 2048-bit n.🏦It cannot steal Chase’sprivate key from its servers.💻It cannot run code onyour laptop or in your browser.ℹ️These are assumptions. If onefails, TLS cannot save you.So the attacker cannot break the math. It wins only if the protocol around the math is weak.
[+] TLS answers each danger with one guarantee ConfidentialityIt stops eavesdropping.The eavesdropper sees only9f3a2c 7b1e…and never your password.IntegrityIt stops tampering.If one byte changes,✗ rejectedthe message is thrown away.AuthenticationIt stops impersonation.You can check that it isthe real chase.comand not a look-alike.

The first two come from the encryption you already know. The third, knowing who is really on the other end, is the hard part, and most of this lecture is about it.

[+] TLS is two steps: meet carefully once, then talk fast TLS🤝1. HandshakeThis is done once, with public-key crypto.“Check each other’s ID, then agree on a secret code.”Why only once?Public-key crypto ispowerful but slow.the shared secret code🔒2. Record layerThis runs on every byte, with symmetric crypto.“Now talk in that code for the whole conversation.”Why switch?Symmetric crypto movesgigabytes per second.
[ 02 ]

25 years of
breaking SSL

Every version exists because the one before it broke.

[+] The whole story on one line SSL 1.01994never shippedSSL 2.01995brokenSSL 3.01996POODLETLS 1.01999BEASTTLS 1.12006retiredTLS 1.22008FREAK, LogjamTLS 1.32018current

Six of these seven versions were broken or abandoned. The next pages walk through what happened to each one.

[x] SSL 1.0 (1994): encryption without integrity ROOT CAUSEa stream cipher (RC4) with a plain checksum instead of a MAC: anyone can flip bits.pay Bob $100RC4 stream cipherd4 7e … 08 c4+CRC checksumRC4 is a stream cipher: a one-time pad whose pad is generated from a short key. Next to it, only a CRC checksum, not a MAC.flip one byte: 1 → 9recompute the CRC: no key neededthe bank sees pay Bob $900Flipping a ciphertext bit flips the same plaintext bit, and a CRC is not a secret, so the attacker can fix it.📨📨It also had no sequence numbers, so an old message could be sent again, and it was accepted.↶ Crypto lecture: the one-time pad slide “Can Mallory turn $100 into $900?” Encryption alone never gives integrity.
[x] SSL 2.0 (1995): the keys were too short ROOT CAUSEkeys too short: 56-bit DES, and 40-bit “export” versions of RC4 and DES.SSL 2.0 used RC4 and DES. AES did not exist until 2001.🔨Short keys2⁴⁰ keys: done in daysExport rules capped keys at 40 bits.DES already died at 56 bits, and40 bits is 65,536 times easier.↶ Crypto: DES, a key too short🔧A homemade MACMD5(secret ‖ msg)This is our “first attempt” MAC.Anyone could extend a tagwithout knowing the key.↶ Crypto: MAC = H(K ‖ m)📋An unprotected menuTLS strong ✗40-bit export ✓Nobody checked the cipher list,so the attacker could deletethe strong options.→ Handshake goal 3, later todayThree broken pieces, so Netscape redesigned the protocol within a year.
[x] SSL 3.0 (1996): the padding was never checked ROOT CAUSEthe MAC did not cover the padding, so the server’s yes/no answer leaks data.your dataMACpaddingthe MAC covers only thesenever checkedAn SSL 3.0 record, encrypted with CBCtweaked recordserver decrypts✓ accept✗ rejectone yes/noanswerThe server’s yes or no tells the attacker whether the padding looked right: a padding oracle.↶ Remember CTF #2?Tweak one byte → ask the server “valid padding?” → 256 tries reveal one secret byte.
[x] TLS 1.0 (1999): the next IV was already public ROOT CAUSEthe next IV is predictable: it is a block the attacker has already seen.record 1, already sentC1C2C3reused asrecord 2IV = C3??TLS 1.0 used the last block of one record as the IV of the next.C3 already crossed the wire, so the attacker knowsthe next IV before your browser encrypts anything.🔑Like a lock whose next combination is printed on the last receipt:the attacker can test guesses about what you sent, one at a time.↶ Remember CTF #5?You knew the next IV → sent G ⊕ IV_old ⊕ IV_next → a matching output confirms guess G.
[x] TLS 1.1 and 1.2: good fixes, dragged down by old options ROOT CAUSEbackward compatibility: servers kept 1990s export crypto on, for old clients.TLS 1.1: a fresh random IV for every record. BEAST stops.TLS 1.2: AES-GCM, encryption plus MAC. POODLE stops.But many servers still accepted 1990s “export” RSA, with a tiny 512-bit n, just in case.forces export RSAserver sends 512-bit nfactor n: about 7 hours on rented cloudThis attack, FREAK (2015), cost about $100. Logjam did the same to 512-bit Diffie-Hellman.factor n → p, qp, q → φφ → dd → read m↶ Crypto lecture: “Why RSA is secure” and CTF #6, where you were handed p and q and read m.
[x] The pattern: every version broke, and compatibility kept the broken ones alive 1. A new version ships.2. Someone breaks it.3. A newer version fixes it.4. Old clients keep it alive.The attacker forcesthe old version:a downgrade.TLS 1.3 finally gives up the heavy history.The broken options are deleted, so there is nothing to fall back to.
[ 03 ]

The handshake

Two strangers on a hostile network have one round trip to trust each other and agree on a key.

[?] What is the handshake for? 💻youbrowser🏦chase.comserverYou have never met, and every message passes through the attacker.Who are you, really?Goal 1: authenticateWhich key do we share?Goal 2: agree on a keyDid anyone change our deal?Goal 3: negotiate safelyThe handshake answers all three questions before any of your data is sent.
[?] Goal 1: are you really chase.com? You type chase.com and expect to reach the bank.💻youchase.comthe real bankredirectedblockedchase.comCHASESign inusernamepasswordSign inFAKEThe attacker sends you toits own copy of theChase login page.It looks exactly right.Even over an encryptedconnection, your passwordnow goes to the attacker.So the client must first check that it is really talking to chase.com.
[?] Goal 2: how do two strangers agree on a secret key? 💻youkey = ?chase.comkey = ?AES needs the same secret key on both sides.Sending the key directly hands a copy to the attacker.Instead, both sides build the same key from public pieces,and the attacker, who sees every piece, still cannot build it.→ How? We build it with real numbers later in this section.
[?] Background: every client and server supports different options An option is a protocol version plus a cipher suite, the set of algorithms to use.TLS 1.3 · AES_256_GCM · SHA384versionencryptionhashchase.com supportsTLS 1.3 · AES-256-GCMTLS 1.2 · AES-128-GCMTLS 1.0 · AES-CBC💻Chrome, 2026speaks TLS 1.3, TLS 1.2agree on TLS 1.3📱an Android phone, 2014speaks TLS 1.2 onlyagree on TLS 1.2🏧an old card readerspeaks TLS 1.0 onlyagree on TLS 1.0Every connection begins by finding the best option that both sides share.
[?] Goal 3: did anyone change what we agreed on? What I can speakTLS 1.3, AES-256TLS 1.2, AES-128TLS 1.0, 40-bitchase.comalso speaksall threeBoth sides should pick the strongest option they share.The attackerdeletes the strongoptions.Chase sees only TLS 1.0, 40-bit.Chase picks the weak option, and neither side notices.So at the end, both sides must check that they saw exactly the same messages.
[+] The whole handshake, one message at a time youchase.com🎲secret a → makes A① ClientHello, you → chase.com📋Here is what I support.🔑My key half A.🎲secret b → makes B?mystery boxA, B → AES key② chase.com → you✅This is what we will use.🔑My key half B.encrypted with the new AES key📄Certificate✍️CertificateVerify🧾Finished?mystery boxA, B → AES keyNow both sides hold the same AES key, and it never crossed the wire.③ you → chase.com, encrypted🧾Finished: my summary matches yours.Your password and pages, encrypted with the AES key.1 round trip✍️ signed, not encrypted
[?] Why is the clear part signed instead of encrypted? Q: Encrypt them with the AES key?A, B? boxAES key✗ The key is made from A and B.Q: Encrypt with Chase’s RSA key?flight ①flight ②: certificate✗ The certificate arrives only in flight ②.Q: So A and B travel in public. Is that a problem?A = 8B = 19→ still needs a or b✓ No. Seeing A and B does not reveal the key.(the key slide shows why, with these numbers)What must be protected is that A and B arrive unchanged:you sent AChase got A*Chase signs a fingerprint with A*you check with A: ✗ hang up
[+] ClientHello: hello, here is what I support
🔓 Not encrypted: anyone on the path can read it.🧾 Tampering is caught later by Finished.
ClientHello🌐server namewww.chase.comOne server can host many sites, sothis says which site you want.📋what I supportTLS 1.3 · AES-256-GCM, AES-128-GCM, ChaCha20This is the menu. The strongest choicescome first.🎲random32 fresh random bytesThis makes every handshake unique,so an old one cannot be replayed.🔑my key half: a one-time public keyA (made from my secret a), for x25519This is your public piece of the key.We look at it after ServerHello.
[+] ServerHello: this is what we will use
🔓 Not encrypted: anyone on the path can read it.🧾 Tampering is caught later by Finished.
ServerHello✅chosenTLS 1.3 · TLS_AES_256_GCM_SHA384Chase picks one option fromyour menu.🎲random32 fresh random bytesThe server adds its own randomness.🔑my key half: a one-time public keyB (made from Chase’s secret b)This is Chase’s public piece.It is used once, then thrown away.📄Chase’s long-term public keynext, inside the CertificateThe RSA public key that proves whoChase is comes right after, encrypted.
$ openssl s_client -connect www.chase.com:443 New, TLSv1.3, Cipher is TLS_AES_256_GCM_SHA384 Server Temp Key: X25519, 253 bits # Chase’s half of the key
[?] Detour: how can two strangers agree on a secret in public?
DETOUR · OUTSIDE TLS
👩Alice👨BobEve hears every word.Alice and Bob have never met, and everything they say is public.Can they still end up with a secret number that Eve cannot compute?Yes. Whitfield Diffie and Martin Hellman showed how in 1976.We leave TLS for a few slides to see how, then come back.
[+] Diffie-Hellman, precisely: the protocol and the proof
DETOUR · OUTSIDE TLS
PUBLIC SETUPA large prime p and a base g. Everyone knows them.toy: p = 23, g = 5ALICEpicks a random secret asends A = ga mod pBOBpicks a random secret bsends B = gb mod pcomputes K = Ba mod pcomputes K = Ab mod pWHY BOTH GET THE SAME KBa ≡ (gb)a ≡ gab ≡ (ga)b ≡ Ab (mod p)(5¹⁵)⁶ = (5⁶)¹⁵ = 5⁹⁰ ≡ 2WHY EVE CANNOTEve knows p, g, A and B. To get K she must find a from A = gᵃ mod p.This is the discrete logarithm problem: no fast method is known for a 2048-bit p.WHY ALICE AND BOB ARE FASTg15 = g8·g4·g2·g3 squarings and 3 multiplications, not 14. A 2048-bit a needs about 3,000.
[+] The same exchange with numbers
DETOUR · OUTSIDE TLS
In public: p = 23 and g = 5. Everyone, Eve included, knows them.AliceBobsecret a = 6secret b = 15Each picks a secret and never sends it.A = 56 mod 23 = 8B = 515 mod 23 = 19A = 8B = 19196 mod 23 = 2815 mod 23 = 2shared secretshared secretBoth get 2 = 590 mod 23.Eve sees 23, 5, 8 and 19.She needs 6 or 15 to get 2.
[+] Back to TLS: Diffie-Hellman lives inside the hellos you (Alice)chase.com (Bob)secret aClientHello carries A = gᵃsecret bServerHello carries B = gᵇBa = gabAb = gab?mystery boxThe shared secret is the input to the mystery box, which we open next.Neither side needed the other’s key first, so A rides in the very first message: one round trip.Real TLS uses X25519: the same idea, with elliptic-curve math and 253-bit numbers.
[?] Which g and p? TLS 1.3 allows only a short, fixed list FINITE FIELD: THE g AND p FROM OUR SLIDESg = 2 for all of them; p is one fixed prime per size.ffdhe2048ffdhe3072ffdhe4096ffdhe6144ffdhe8192p of ffdhe2048, in hex (RFC 7919):FFFFFFFF FFFFFFFF ADF85458 A2BB4A9A … FFFFFFFFELLIPTIC CURVES: SAME IDEA, DIFFERENT MATHEach name fixes one curve and one starting point.x25519x448secp256r1secp384r1secp521r1x25519 is what most connections use today.Browsers now also offer X25519MLKEM768, a post-quantum hybrid.you → chase.comClientHello:supported_groups = x25519, secp256r1, ffdhe2048key_share = x25519: Ayou guess Chase’s favoritechase.com → youServerHello:key_share = x25519: BChase picks from your listThe key point: there are only a few groups, and ClientHello simply names them.
[+] Opening the mystery box: from the shared secret to AES keys
🏠 Computed on each side. These values are never sent.
INPUTSOUTPUTS1the shared secret gᵃᵇfrom Diffie-Hellman, known only to you two2a fingerprint of the hellosSHA-384(ClientHello, ServerHello)3a label naming the output“client key”, “client iv”, ...HKDFHMAC as a blenderyou → Chase: key32 bytes, AES-256you → Chase: IV12 bytesChase → you: key32 bytes, AES-256Chase → you: IV12 bytesone HKDF run per labelHow this protects integrity:Nothing changed on the way:both fingerprints match, so both sides getthe same keys, and Certificate decrypts. ✓The attacker changed A or the menu:the fingerprints differ, so the keys differ,and the first encrypted message fails. ✗After Finished, the same box runs again with a fingerprint of the whole handshake, to make the keys for your data.
[?] A correction: why not start with Chase’s public key? 💻youchase.comClientHellonot encryptedlock it with Chase’s key?✗ you do not have it yet📄 Chase’s key arrives here, in flight ②ask the CA first?🏛️CA⏱️ slower💥 CA down: no site works👀 CA sees every site you visitSo the CA signs Chase’s key in advance. That is the certificate.
[↶] Recap · what TLS is, and the three attacks it stops 💻youchase.comTLS gives you a protected channel through a network the attacker controls.👁️Confidentialitystops: stealing informationNobody can read it.✏️Integritystops: changing somethingAny change is caught.🎭Authenticationstops: faking who sends itIt really is Chase.
[↶] Recap · the most typical attack: the man in the middle you (A)chase.com (B)you think: one connection to ChaseMconnection 1connection 2① password: hunter2② password: hunter2👁️③ balance: $5,000④ balance: $5,000👁️looks fine to youlooks fine to ChaseM read everything
[↶] Recap · TLS has two phases 🤝1. Handshakeonce, at the start✓ agree on the options✓ check it really is Chase✓ agree on a secret keyuses public-key crypto: slow, so only oncekeys🔒2. Data transferevery byte, until the end✓ encrypt every record✓ catch any change (AES-GCM tag)✓ your password, your pagesuses AES: fast, gigabytes per second
[↶] Recap · what the two hellos contain ClientHello🌐server namewww.chase.com📋versions and ciphers I supportTLS 1.3 · AES-256-GCM, ...🎲random32 fresh bytes🧮groups I supportx25519, secp256r1, ...🔑my key halfA = gᵃServerHello✅chosen version and cipherTLS 1.3 · AES_256_GCM_SHA384🎲random32 fresh bytes🔑my key halfB = gᵇthen, encrypted with the new key:Certificate · CertificateVerify · Finishedmy ID, proof it is mine, a summary
[↶] Recap · how g and p work p and g are fixed.g = 2ffdhe2048, RFC 7919p =FFFFFFFF FFFFFFFF ADF85458 A2BB4A9A AFDC5620 273D3CF1 D8B9C583 CE2D3695 A9E13641 146433FB CC939DCE 249B3EF9 7D2FE363 630C75D8 F681B202 AEC4617AD3DF1ED5 D5FD6561 2433F51F 5F066ED0 85636555 3DED1AF3 B557135E 7F57C935 984F0C70 E0E68B77 E2A689DA F3EFE872 1DF158A1 36ADE735 30ACCA4F 483A797ABC0AB182 B324FB61 D108A94B B2C8E3FB B96ADAB7 60D7F468 1D4F42A3 DE394DF4 AE56EDE7 6372BB19 0B07A7C8 EE0A6D70 9E02FCE1 CDF7E2EC C03404CD 28342F619172FE9C E98583FF 8E4F1232 EEF28183 C3FE3B1B 4C6FAD73 3BB5FCBC 2EC22005 C58EF183 7D1683B2 C6F34A26 C1B2EFFA 886B4238 61285C97 FFFFFFFF FFFFFFFFyouknows:a (secret)g, pB = gbBa = gab ✓easychase.comknows:b (secret)g, pA = gaAb = gab ✓easyattackerknows:A = gaB = gbg, pgab = ? ✗very hardWhy is it hard for the attacker?Diffie and Hellman, “New Directions in Cryptography” (1976), the paper that started it all.ee.stanford.edu/~hellman/publications/24.pdf
[↶] Recap · how the AES key is made 1. the shared secretgᵃᵇ mod pfrom Diffie-Hellman2. a fingerprint of the hellosSHA-384(ClientHelloServerHello)exactly the two hellos each side saw3. a label: which output?“client key”HKDFbuilt from HMACAES-256 key32 bytes48 bytes come out; the first 32 are keptChase runs the exact same computation and gets the exact same key, so the key never crosses the wire.The label “server key” gives the key for Chase’s direction.
[↶] Recap · how the IV is made 1. the shared secretgᵃᵇ mod pfrom Diffie-Hellman2. a fingerprint of the hellosSHA-384(ClientHelloServerHello)exactly the two hellos each side saw3. a label: which output?“client iv”HKDFbuilt from HMACIV12 bytes48 bytes come out; the first 12 are keptSame inputs, different label: a completely different, unrelated value.The IV is the starting nonce for AES-GCM: record n uses IV ⊕ n, so a nonce never repeats.
[+] Certificate: what is inside, and how your laptop checks it
🔒 Encrypted with the AES handshake key (from HKDF).✍️ Signed by DigiCert, the CA.
the whole message is encrypted with the AES handshake keyCERTIFICATE for chase.com🌐namewww.chase.com🔑Chase’s public keyRSA 2048-bit (n, e)📅validDec 29 2025 → Jan 5 2027🏛️issued byDigiCert, a CA✍️CA signature over everything abovemade with DigiCert’s private key💻your laptopCA public keys that came with your OS and browser:DigiCertLet’s EncryptGlobalSign… about 150 CAsDigiCert is one of these CAs (more in a later lecture).So no call to the CA is needed during the connection.We verify DigiCert’s signature with DigiCert’s public key.✓ This certificate really was signed by DigiCert.I trust DigiCert, so I trust that thispublic key really is Chase’s.
[+] CertificateVerify: what is inside, and how your laptop checks it
🔒 Encrypted with the AES handshake key (from HKDF).✍️ Signed by Chase’s own private key.
the whole message is encrypted with the AES handshake keyCERTIFICATEVERIFY from chase.com⚙️algorithmRSA-PSS with SHA-256✍️the signatureChase’s signaturemade withChase’s private keyoverClientHelloServerHelloCertificatethe fingerprint includes today’s random bytes, A and B💻your laptopChase’s public keyfrom the certificate it just checkedWe verify the signature with Chase’s public key.✓ It was made with Chase’s private key.Only Chase has that key, so the otherend is Chase, in this very conversation.
[+] Finished: what is inside, and where its key comes from
🔒 Encrypted with the AES handshake key.#️⃣ Its content is an HMAC, keyed by a finished key from HKDF.
the whole message is encrypted with the AES handshake keyFINISHED from chase.comIt contains just one value:HMAC(finished key,made by HKDF from the shared secret, like the AES keyfingerprint of every message so far:ClientHelloServerHelloCertificateCertificateVerifywhat Chase saw, from the first byte on)→ one 48-byte valueWhere does the finished key come from?gᵃᵇ (shared secret)SHA-384(two hellos)label “finished”HKDFfinished keySame HKDF as the AES key, just a different label.The attacker cannot make it without gᵃᵇ.Then you send back the same kind of Finished,so Chase can run the same check (next slide).
[+] Your Finished: the same check, in the other direction
🔒 Encrypted with your AES handshake key.→ sent by you, checked by Chase.
the whole message is encrypted with your AES handshake keyFINISHED from youThe same kind of message, with two differences:HMAC(your own finished key,① from HKDF on your side, so not the same key as Chase’sfingerprint of every message so far:ClientHelloServerHelloCertificateCertificateVerifyChase’s Finished② now also covers Chase’s Finished)→ one 48-byte value
[+] The whole handshake ① you → chase.com② chase.com → you③ you → chase.comClientHelloserver namewww.chase.comversions and ciphersTLS 1.3, AES-256-GCM, ...random32 fresh bytesgroupsx25519, secp256r1, ...my key halfA = gᵃnot encryptedflight ②: four messages, back to backServerHellochosen: TLS 1.3, TLS_AES_256_GCM_SHA384random: 32 fresh bytesmy key half: B = gᵇencrypted with the AES handshake keyCertificatename: www.chase.comChase’s public keyvalid: 2025-12-29 to 2027-01-05issuer: DigiCertDigiCert’s signature💻your laptopCA public keys, already installed:DigiCertLet’s Encrypt… about 150 CAs✓ checks DigiCert’s signature offlineCertificateVerifyChase’s signaturewithChase’s private keyoverClientHelloServerHelloCertificateFinishedHMAC(Chase’s finished key,ClientHelloServerHelloCertificateCertificateVerify)flight ③: Finished + dataencrypted (AES)FinishedHMAC(your finished key,ClientHelloServerHelloCertificateCertificateVerifyChase’s Finished)your datapassword, page requestsright behind Finished
[?] Security analysis: TLS against a man in the middle youchase.comMM sits on the path and sees every message. What can it do to TLS?1. Passiveonly watchesyouchase👁️It reads every message as it passes,and changes nothing.Goal: learn your secrets.2. Activewatches and interferesyouchase✏️It can change, drop, or inject messages,or answer as Chase itself.Goal: pass itself off as Chase.
[x] A passive man in the middle: watching only youM (watching)chase.com① ClientHello (M sees it)server nameciphersrandomA = gᵃ② ServerHello (M sees it)chosen cipherrandomB = gᵇM has A and B. To get gᵃᵇ it needs a or b.✗ it cannot compute the key② the rest of flight 2 (a black box to M)CertificateCertificateVerifyFinished③ your flight (a black box to M)Finishedyour dataA passive M sees A and B, and nothing else: everything after the hellos is a black box.
[x] An active man in the middle: swap the key halves youMchase.comClientHellociphersA = gᵃfake ClientHello*ciphersA* = gᵐM keeps its own secret mServerHellocipherB = gᵇfake ServerHello*cipherB* = gⁿand another secret nyour keygᵃⁿshared with M!Chase’s keygᵐᵇshared with M!M knows both keysit can decrypt, read, re-encryptEach side thinks it shares a key with the other. So far, M is winning.
[x] An active man in the middle: the signature gives it away youMchase.comCertificate + CertificateVerify (key gᵐᵇ)CertificateCertificateVerifyM can decrypt this: it knows gᵐᵇforwarded, re-encrypted with gᵃⁿCertificateCertificateVerifybut it cannot change the signatureInside CertificateVerify: what Chase signedfake ClientHello* (A*)ServerHello (B)✍️Chase’ssignatureWhat you saw: your check of CertificateVerifyClientHello (A)fake ServerHello* (B*)≠≠compare✗Chase signed a different conversation, so the signature does not verify.You hang up. M is caught, and it never saw your password.
[?] Why can’t M fake the signature? A chain of trust Chase’s signature just caught M. Why can’t M simply fake it? Follow the chain back:✍️Chase’s signatureinside CertificateVerifyTo trust it, we must check it withChase’s real public key.checked with🔑Chase’s public keythe key that checks itTo trust it, we must make sure thisreally is Chase’s key, not M’s.says who owns it📄the Certificate“chase.com owns this key”, signed by DigiCertTo trust it, we must check DigiCert’ssignature on it.checked with🔑DigiCert’s public keythe key that checks the certificateTo trust it, we must make sure thisreally is DigiCert’s key.trusted because it wasinstalled on your laptopby your OS and browser: the root of trust⚓ ROOT OF TRUSTIt came with your laptop, so we trust it.How M could still win: break one link.steal a private key(Chase’s or DigiCert’s)🏛️get a CA to signa fake certificateEverything rests on the CA keyson your laptop.More on CAs in a later lecture.
[>] CTF #8: become the man in the middle base URL · 165.22.35.184:54328clientwants chase.comYOUthe relayerserverplays chase.com/start?s=ID → A/server?s=ID&A=→ B, cert, CertVerify/client?s=ID&B=&cert=&sig=→ recordForward the real A and B, the key is theirs, so the record is ciphertext.START HERE/relayer▶ run it first, as isa working relay with every tool inside/source-clientread it: what does the client check?
[?] CTF #8 · hint 1: read what the client checks

Open /source-client. A certificate is just { name, public_key }. The client makes two checks — and only two:

✓name in the cert ischase.com ✓CertVerify validates undercert.key ✗a CA signed this certificatenever checked — the root of trust is empty So the key in the cert can be anyone’s.Put your own key in a cert that sayschase.com, and both green checks pass.

This is the empty box from the backtrace: no CA, no root of trust. The client trusts a name and a self-made signature.

[?] CTF #8 · hint 2: edit the relayer

Stop forwarding the real ServerHello. Send the client your own, with a cert you made. Every helper below comes from /tools — and is already baked into /relayer:

g, p = params() A = start() # the client's key half n, B = dh_keygen(g, p) # YOUR DH secret + half (from /tools) my_n, my_e, my_d = rsa_keygen() # YOUR very own RSA key (from /tools) cert = make_cert("chase.com", my_n, my_e) # a cert for chase.com with YOUR key tr = H(A, B, cert) # the transcript the client will see sig = rsa_sign(tr, my_n, my_d) # CertVerify, signed with YOUR key rec = client(B=B, cert=cert, sig=sig) # client accepts -- no CA to ask! key = hkdf(dh_shared(A, n, p), tr) # A^n = g^(a*n): the key you both hold print(aead_decrypt(key, rec)) # the flag

You only change the middle: make your own B with dh_keygen, forge the cert, sign it, then read the record with the key you now share. The crypto toolkit is /tools, bundled inside /relayer.

[!] Two quick links before we continue

The leaderboard is live.

Sign in to see your codename and your points.

QR code to security1-leaderboard.netlify.app

security1-leaderboard.netlify.app ↗

Tell us how it is going.

The feedback form is anonymous and open all lecture.

QR code to the anonymous feedback poll

No name is attached.

[!] Meanwhile, the web caught fire this morning 🐘PHP2Shell went public today, October 21.Two bugs in PHP let anyone run commands on a web server, without a password.💻An attacker,anywhere.No account, no login.🌐A PHP website,like a forum.Running old PHP.POST /any-page.php … one crafted requestthe server runs the attacker’s command and sends the output back🐛The bug fires.No check runs.🔫A shell opens.They own the box.One request in, a shell out. That is the whole attack.🌐About 69% of the web runsPHP.📅One bug was known since2024, unfixed.🤖AI helped turn it into anexploit.🏫Our CS department serverwent down yesterday.The fix is in PHP 8.5.12, 8.4.27, 8.3.36, and 8.2.35.If you run PHP anywhere, including your homework server, update it today.
[!] A stranger signed a note with a CA’s own key 🏛️Also this week, eMudhra, a CA, lost eight of its CA keys.It made the keys so badly that anyone could work them out from the certificates.🔍1. He finds a key.He works out one CA’sprivate key from its publiccertificate.✍️2. He signs a note.He writes “We have aproblem here - Wayne”and signs it with that key.📦3. He publishes it.The note, the signature, andthe CA’s public key goin proof.zip.💻4. Anyone checks it.Scan the code below to getproof.zip, then check thesignature.Scan to downloadproof.zip yourself.$ openssl dgst -sha384 -verify EM-DV-TLS-CA-G3B.pub.pem -signature EM-DV-TLS-CA-G3B.sig message.txtVerified OK# Only the CA’s private key could make this signature.Every browser maker raced to block these CAs:Oct 17 2026Firefox and ChromeOct 19 2026AppleOct 20 2026Microsoftall within 3 daysHow can every browser drop a trusted CA in days? That is exactly today’s lecture.
[?] Why could anyone recover eMudhra’s keys? 🔑A CA’s private key is a secret number d.Normally d is random, anywhere between 1 and about 3.9 × 10¹¹⁵.That upper limit has 116 digits, so nobody can guess d.Here are the eight eMudhra keys, worked out from their certificates.EM DV TLS CA - G3Bd = 156EM DV TLS CA - G3Cd = 230EM EV TLS CA - G3Bd = 115EM EV TLS CA - G3Cd = 56EM OV CS CA - G3Bd = 66EM OV CS CA - G3Cd = 237EM OV TLS CA - G3Bd = 155EM OV TLS CA - G3Cd = 4Every key is below 256. Trying all 255 numbers takes under 0.1 seconds.
[+] Recap: this is the whole handshake ① you → chase.com② chase.com → you③ you → chase.comClientHelloserver namewww.chase.comversions and ciphersTLS 1.3, AES-256-GCM, ...random32 fresh bytesgroupsx25519, secp256r1, ...my key halfA = gᵃnot encryptedflight ②: four messages, back to backServerHellochosen: TLS 1.3, TLS_AES_256_GCM_SHA384random: 32 fresh bytesmy key half: B = gᵇencrypted with the AES handshake keyCertificatename: www.chase.comChase’s public keyvalid: 2025-12-29 to 2027-01-05issuer: DigiCertDigiCert’s signature💻your laptopCA public keys, already installed:DigiCertLet’s Encrypt… about 150 CAs✓ checks DigiCert’s signature offlineCertificateVerifyChase’s signaturewithChase’s private keyoverClientHelloServerHelloCertificateFinishedHMAC(Chase’s finished key,ClientHelloServerHelloCertificateCertificateVerify)flight ③: Finished + dataencrypted (AES)FinishedHMAC(your finished key,ClientHelloServerHelloCertificateCertificateVerifyChase’s Finished)your datapassword, page requestsright behind Finished
[ 04 ]

Who vouches
for the key?

TLS proved the server holds the key in the certificate. Now we ask why we should believe the certificate.

[?] Each link in the chain is a promise Each link in the chain we just traced is a promise. Who keeps each one?✍️Chase signed CertificateVerify.It verifies with the certificate’s key.Promise 1 says the server has the matching private key.📄The certificate binds the key to chase.com.DigiCert’s signature makes this claim.Promise 2 says this public key belongs to chase.com.🏛️DigiCert’s root key is on your laptop.Your OS put it in the root store.Promise 3 says DigiCert’s public key(on your laptop) can be trusted.💻Your laptop verifies each link above.Its code decides what passes.Promise 4 says your laptop runs every check.✓ The handshakeproves this one.? Math alonecannot provethese three.The PKI coversthem today.A lie is a certificatethat names the wrongkey for a site. We alsocall it a fakecertificate.M wins if any one promise is false. Each story today makes one of them false.
[+] Today we cover promises 2 to 4 in order Promise 2 asks this.Is this key reallychase.com’s?🏛️Here is how it works.A CA makes the requester provecontrol of the name.Here is how it broke.Lookalike names still get realcertificates.Promise 3 asks this.Can DigiCert’s keybe trusted?🔑Here is how it works.Root keys stay offline, and rootprograms choose them.Here is how it broke.A hacked root let M lie for weeks.Promise 4 asks this.Does your laptop runevery check?💻Here is how it works.The laptop runs eight checks on thechain.Here is how it broke.In CTF #8, a client skipped one.Each part shows the mechanism first, then the real failures.
[?] Can M just write his own certificate? M writes this certificate.The name is www.chase.com.The key is M’s own RSA key.The issuer is DigiCert.M cannot make DigiCert’s signature.That needs DigiCert’s private key,and he does not have it.💻Your laptop checks it withDigiCert’s public key.✗ The check fails, so it rejects it.So everything rests on one thing, which is DigiCert’s signature.So the question is what DigiCert checks before it signs.If DigiCert signs for M, the laptop has no way to tell.

? How does a certificate say which site it is for?

[?] Does this certificate match the address bar? The certificate lists two names.www.chase.combeta.chase.comChrome has ignored the old name field, called CN, since 2017.www.chase.com✓It is in the list.beta.chase.com✓It is in the list.chase.com✗It is not in the list.www.chase.com.evil.io✗It is a different name.So how does https://chase.com work? The server holds a second certificate.It picks one using the server name in your ClientHello. That one lists chase.com.The second one lists www.chase.com, chase.com, and www-ndc.chase.com.

? Does a huge site need millions of certificates?

[?] How does one certificate cover GitHub Pages? GitHub Pages hosts millions of sites, such as zhangzhuosjtu.github.io.One certificate per site would mean millions of certificates. GitHub uses one instead.The github.io certificate lists six names.*.github.com*.github.io*.githubusercontent.comgithub.comgithub.iogithubusercontent.comLet’s Encrypt signed it on Sep 30 2026.zhangzhuosjtu.github.io✓It matches *.github.io.a.b.github.io✗The star covers only one label.github.io✓It matches only because github.io is listed too.A star matches exactly one label, the piece between two dots.So *.github.io never covers github.io itself, and GitHub lists both names.

? How does a website get its certificate from a CA?

[?] How should a CA decide whether to sign? M fills in a web form.“I am www.chase.com.Sign my key, please.”🏛️The CA getsmillions ofthese requests.What should the CA checkbefore it signs?Should the CA ask for a passport?A passport proves a person exists, not who runs a website.Should the CA call the phone number on the request?M wrote the request, so he picks the number.Should the CA make M prove he controls www.chase.com now?Only whoever controls Chase’s server can change what www.chase.com serves.That last idea is how almost every certificate is issued today.
[+] The CA asks you to prove you control the name 👤Chase’s admin asks.The admin wants a certificate.🏛️Let’s Encrypt checks.It is the CA.🌐The server answers.It serves www.chase.com.1. I want a certificate for www.chase.com.The admin has an account with the CA.2. Prove it. Publish this random token.The token is LoqXcYV8q5ONbJQx…3. The admin puts the token on the server./.well-known/acme-challenge/LoqXcYV8…4. The CA fetches the token over HTTP.It fetches from several places in the world.The server returns the token.5. It matches. Send your key, and I sign it.M cannot pass step 3, because he cannot put a file on Chase’s server.
[?] What does EV check that OV does not? DV means Domain Validation.www.amazon.com is a DV certificate.Its subject field says:CN = www.amazon.comThe CA checked only the domain.Policy 2.23.140.1.2.1 marks it DV.OV means Organization Validation.www.microsoft.com is an OV certificate.Its subject field says:CN = www.microsoft.comO = Microsoft CorporationL = RedmondST = WAC = USThe CA also checked the company and city.Policy 2.23.140.1.2.2 marks it OV.EV means Extended Validation.www.chase.com is an EV certificate.Its subject field says:CN = www.chase.comO = JPMorgan Chase & Co.L = New YorkST = New YorkC = USbusinessCategory = Private OrganizationjurisdictionC = USjurisdictionST = DelawareserialNumber = 691011The CA also checked these four lines.Policy 2.23.140.1.1 marks it EV.To write those four lines, EV rules make the CA check more than OV does:the company record in the government registry, the physical address,and that a company officer approved the request. Encryption is the same for all three.
[x] What does a valid certificate not prove? https://www.chase.comThis is the real Chase.DigiCert checked the name.https://chase-secure-login.comM registered this name.Its free DV certificate is valid.https://сhase.comThe first letter is Cyrillic с.Its real name is xn--hase-k6d.com.The browser calls every one of these secure, and every certificate is genuine.M does control chase-secure-login.com, so its certificate is not a lie.Browsers now show the xn-- form for mixed-script names like the third one.Here is what the lock means.You have a private channelto the name in the address bar.Nobody on the path can read it,or change it without being caught.Here is what the lock does not mean.It says nothing about who runs the site.It does not mean it is the siteyou meant.Checking the name is still your job.

? What does a CA look like from the inside?

[+] Why is there a CA between DigiCert and Chase? A CA’s signing key can sign for any site. Where should the CA keep it?🏦DigiCert’s root certificate is Global Root G2.It is valid from 2013 to 2038.Roots stay offline and sign only in rare, recorded ceremonies.DigiCert,a CA, ownsthese two.🏛️DigiCert’s intermediate certificate is EV RSA CA G2.It is valid from 2020 to 2030, with pathlen: 0.It is online and signs customer certificates every day.signs🌐Chase’s own certificate, the leaf, names www.chase.com.It is valid from Dec 2025 to Jan 2027, with CA: FALSE.So it is not a CA. It may not sign other certificates.signsChase ownsthis one.It is not a CA.Why is there an extra level?If the intermediate leaks,DigiCert revokes it andmakes a new one.The root never touchesthe network, sonobody can steal it remotely.pathlen: 0 limits what theintermediate may sign.The next slide shows how.Chase’s server sends the leaf and the intermediate. Your laptop already has the root.Chase also sends the root, but your laptop ignores that copy and uses its own.
[?] What does pathlen: 0 mean? pathlen sits in a CA certificate. It counts how many more CA levels may hang below it.A sub-CA is a CA that another CA signed. A leaf never counts. Each sub-CA level uses up one.DigiCert Global Root G2.It has no pathlen.There is no limit.EV RSA CA G2, the real one.It says pathlen: 0.0 levels are left.Suppose a CA says pathlen: 1.This one is an example.1 level is left.www.chase.comIt is a leaf. ✓beta.chase.comIt is a leaf. ✓A sub-CANo level is left.A sub-CA.It is allowed. ✓0 levels are left.a siteIt is a leaf. ✓a siteIt is a leaf. ✓Another sub-CANo level is left.The rule is simple: a CA with 0 levels leftmay sign leaves, but no more CAs.Chase’s intermediate has 0, so it can only sign leaves.$ openssl verify -CAfile root.pem -untrusted inter-and-subca.pem fake-leaf.pemerror 25 at 2 depth lookup: path length constraint exceeded# This is the red sub-CA on the left, in a toy chain.
[?] How many CAs can sign for chase.com? Your laptop holds 158 root keys. We counted them in this Mac’s root keychain.Chase’s certificate chains to one of them, DigiCert Global Root G2.DigiCertChase picked this one.Let’s EncryptIt is based in the US.GlobalSignIt is based in Belgium.TUBITAKIt is based in Turkey.FNMTIt is based in Spain.153 more rootsMany countries run them.A certificate for www.chase.com.Each arrow means a root signs it.DigiCert signed Chase’sreal certificate.This is what happened.Any other root could also sign one,with M’s key in it.Your laptop would accept it too.Your laptop asks only one question.Does the chain end at a root in my store?It never asks which CA Chase picked.$ dig +short chase.com CAA0 issue "entrust.net"0 issue "digicert.com"This DNS record, called CAA, lists the CAs Chase allows.Honest CAs check it, but a hacked CA can skip it.So M needs to break only one of the 158 roots to sign a lie for chase.com.
[?] How does the laptop check a chain from the root? It is in your store.DigiCert Global Root G2.The root’s public key.✍️It signs itself.The server sends it.DigiCert EV RSA CA G2.The intermediate’s key.✍️The root signed it.The server sends it.www.chase.com.Chase’s public key.✍️The intermediate signed it.123CertificateVerify from the handshake.Chase signed it during this connection.1The root key from your store checks the intermediate’s signature. Now that key is trusted.2The intermediate’s key checks the signature on Chase’s certificate. Now Chase’s key is trusted.3Chase’s key checks CertificateVerify. So the server has the key, which is promise 1.Each check hands a trusted key to the next one. All trust starts at the root in your store.
[?] What does the server actually send? ② chase.com → youflight ②: four messages, back to backServerHellochosen: TLS 1.3, TLS_AES_256_GCM_SHA384random: 32 fresh bytesmy key half: B = gᵇencrypted with the AES handshake keyCertificateIt carries a list of three certificates.[0]www.chase.com, leafChase’s public keysigned by EV RSA CA G2[1]EV RSA CA G2, intermediateintermediate’s keysigned by Global Root G2[2]Global Root G2, rootroot’s public keyit signs itselfCertificateVerifyChase’s signature over the handshake so farFinishedHMAC with Chase’s finished key💻your laptopRoot keys are already installed.DigiCert Global Root G2Let’s Encrypt’s root… and more rootsEntry [2] is the same root,so it uses its own copy.This is the chain we just checked.The root key on your laptopchecks the signature on [1].Entry [2] matches that root,so the laptop ignores [2].Then [1]’s key checks [0].

? How do we add a new root to the world?

[+] How does a root key get onto your laptop? 1🔐The root CA makes its key.Let’s Encrypt made its rootin a recorded ceremony.2📋An audit firm checks it.An outside accounting firmaudits it every year.3📨The CA applies to programs.Apple, Microsoft, Mozilla,and Google each decide.4💻Each program ships the root.It arrives in an OSor a browser update.The root arrives.💻This is your laptop’s root store. Mozilla’s holds 172 roots from 50 organizations.DigiCertLet’s EncryptGlobalSignSectigoTUBITAKFNMTAmazon… and moreThis path is for root CAs only.A root CA signs its intermediate CAs itself.Those must be disclosed and audited too,but no program approves them one by one.What does the audit check?The CA validates every name before signing.Its private keys stay inside hardware.The auditor also tests sample certificates.
[?] How can a new root work before laptops update? Laptops update at different times, so a new root is missing on many of them.This is the old root.Its own intermediate.The new root.A site’s certificate.It is signed bythe old root.This is the new root.Its own intermediate.The old root.A site’s certificate.It is signed bythe new root.Each root signs the other one too. This is called a cross-sign.So every laptop finds a path to a root it already has.
[?] How did a brand new CA get trusted on day one? Let’s Encrypt is a free CA that opened in 2015.It now issues more certificates than any other CA. This course’s github.io site uses one.Here is the problem in 2015.💻A laptop’s root store:DigiCert’s root is here.✓IdenTrust, an older CA, has its root here.✓Let’s Encrypt’s new root is missing.✗Here is the fix: IdenTrust cross-signed it.A site’s certificate from Let’s Encrypt.The Let’s Encrypt intermediate.Let’s Encrypt’s root signed it.No laptop had this root yet.IdenTrust’s root signed it too.Every laptop has this root.Jun 2015It makes its root.Oct 2015IdenTrust signs too.Dec 2015Let’s Encrypt opens.Aug 2018Every store has its root.Sep 30 2021IdenTrust’s root expires.The borrowed root had an end date.On Sep 30 2021, IdenTrust’s root expired. Updated laptops now used Let’s Encrypt’s own root.Old devices that never got Let’s Encrypt’s root started to reject its sites.This hit old iPhones, smart TVs, and embedded devices that no longer get updates.

? How do we remove a CA that went bad?

[x] Browsers have removed bad CAs many times Apple, Microsoft, Mozilla, and Google ship the root stores.So they decide when a CA is removed.2011DigiNotar washacked.2015CNNIC signed fakeGoogle certificates.2016WoSign backdatedcertificates.2018Symantec misissuedcertificates.2024Entrust keptbreaking rules.Each of these CAs was removed. Who did it hurt, and how fast did it work?
[?] How does a root take back a hacked intermediate? Case 1An intermediate is hacked, but the root is fine.The root still has its key, so it can revoke the intermediate.🌐The hacked intermediate’s certificate.✓ The root’s signature on it still fits.✓ It has not expired.Revoking it does not change these bytes.The root’s revocation list, a separate file.serial 03:47:45:3C:…serial 0B:8A:5B:9D:… ← the hacked one… 33 serials, signed by the root.💻This laptop skips the list.It checks only the signatures.So M’s chain passes.✗💻This laptop checks the list.It finds the serial on it.So M’s chain fails.✓A revocation works only if the laptop checks the list.
[+] How does a browser learn a CA was revoked? 1🏛️The root CA liststhe bad serial.2📋It reports it tothe root programs.3📦Browser vendorsmerge every list.Mozilla and Google do this.4📡They push it toyour browser daily.5. In the handshake, your browser checks its own copy.The root is in your store.✓The intermediate is listed.✗Chase’s certificate.So the whole chain fails.Your laptop never asks the root CA.It already has the list.Firefox calls this list OneCRL. Chrome calls it CRLSet.
[x] This week, eight CA keys leaked at eMudhra This happened this week. Eight intermediate CA keys at eMudhra, an Indian CA, leaked.The CA had made their private keys so badly that anyone could recover them from the certificates.Two roots sign these CAs.One is eMudhra’s, one is Sectigo’s.Eight intermediate CA keys leaked.They appear in 16 certificates.# A researcher signed a message with one of the leaked keys.$ cat message.txtWe have a problem here - Wayne$ openssl dgst -sha384 -verify EM-DV-TLS-CA-G3B.pub.pem \ -signature EM-DV-TLS-CA-G3B.sig message.txtVerified OK# So whoever signed it holds the CA’s private key.Oct 17 2026Firefox and Chrome block them.Oct 18 2026eMudhra revokes them.Oct 19 2026Apple blocks them.Oct 20 2026Microsoft blocks them.Browsers were fixed fast.Each pushed the bad CAs in its daily list,with no full update needed.No public log shows a fake made with these keys.Many other programs were not.Many apps and scripts never check the list.They needed their own software updates.Examples are curl, Python, Go, and Node.js.
[?] What if the root itself is hacked? Case 2The root itself is hacked.Nothing sits above the root, so nobody can revoke it.🌐The hacked root’s certificate.✓ It signs itself.✓ It sits in every root store.M now holds this root key too.Who could sign a revocation for it?A key above the root does not exist.The root’s own key is the stolen one.So no revocation list can cover a root.💻Every laptop still trusts it.The root is in its own store.So M can sign for any site.✗💻The only fix is to delete it.The root must leave every store.Only an update can do that.✓A hacked root must be deleted from every laptop. The next slide shows how.
[x] How does a hacked root get deleted? 🏛️1. A root is hacked.No key above it cansign a revocation.🗑️2. Each vendordeletes the root fromits own root store.📦3. Each vendor shipsan OS or browserupdate on its own date.💻4. Your laptopinstalls the update,and the root is gone.After the update, the chain no longer ends at a root in your store.The deleted root.✗Its intermediate.A site’s certificate.So check 1 fails: the issuers lead to no root.Every certificate this root ever vouched for fails,the honest ones too.This works only on laptops that installed the update.Each laptop is safe only after its own update.💻It updated today.It is safe.✓💻It updates next month.It is unsafe until then.!💻It never updates.It is unsafe for years.✗
[?] What happens when a browser removes a root? Before the update, all three pass.The root.Its intermediate.🏦A bank.✓🛒A shop.✓🕵️M’s fake site.✓After the update, all three fail.The root.Its intermediate.🏦A bank.✗🛒A shop.✗🕵️M’s fake site.✗Deleting a root also breaks every honest site under it.
[x] In 2011, a hacked root let M read Gmail DigiNotar’s root.A Dutch CA. It is hacked.A fake *.google.com.It holds M’s key.💻A userin Iran.📧The realGmail.Jul 10 2011The first fakecertificate issigned.Aug 4 2011M starts readingGmail in Iran.Aug 28 2011Chrome spots it anda user reports it.M attacks for seven weeks, and nobody sees it.Aug 29 2011Microsoft andFirefox delete theroot.Sep 9 2011Apple deletes theroot.Macs wait 11 more days.531fake certificates were signed.300,000IP addresses in Iran were hit.0sites outside Google were warned.Chrome caught it only because it knew Google’s real keys.Any other site, in any browser, had no warning at all. Next, we see how Chrome knew.
[?] How did Chrome spot the fake certificate? 💻Chrome shipped with a pin list.google.com→Google’s own CA keys only.The list holds a hash of each allowed public key.Google added it for its own sites in 2011.M sends this chain.DigiNotar’s root.A DigiNotar intermediate.A fake *.google.com.The normal checks pass.✓ The root is in the store.✓ Each signature fits.✓ The name matches.📌The pin check: is any key in this chain on Google’s list?No. Every key in the chain belongs to DigiNotar.✗⚠️Chrome blocksthe page.It is Aug 28 2011.A user in Iran poststhis error to aGoogle help forum.Google sees it within a day.Who did this protect?✓ Google’s sites in Chrome.✗ Google’s sites in other browsers.✗ Every other site, in any browser.
[?] What if a server’s own key is stolen? Case 3A server’s own key is stolen.The root and the intermediate are fine. Only the site’s key leaks.🌐This really happened in 2014.🩸A bug called Heartbleed letanyone read pieces of aserver’s memory.The memory could hold the private key.Hundreds of thousands of sites were exposed.Can we list stolen site keys, like CAs?This dot is everyCA certificate.This square isevery sitecertificate.Mozilla lists about 2,700 CA certificates.Let’s Encrypt alone serves over 700 million sites.So the limit that always works is the certificate’s expiry date.A list that big cannot reach every laptop daily. After expiry, the key is useless.
[?] How long can a stolen site key be used?

A stolen key works until the certificate expires. So the rules keep making certificates expire sooner.

Each bar shows the longest lifetime allowed from that year on.5 years201239 months2015825 days2018398 days2020200 daysMar 2026100 daysMar 202747 daysMar 2029This is today’s rule.The www.chase.com certificate was issued Dec 29 2025.It is valid for 372 days, under the old 398-day rule.It was issued just before the March 2026 cut.The chase.com certificate was issued Sep 8 2026.It is valid for 198 days, under the new 200-day rule.A leaked key now lasts months, not years, and soon only weeks.

? What if a CA itself is bad and signs a fake chase.com?

[+] A CA may only sign in public The idea: a CA may only sign in public. Every certificate is logged first.🏛️1. The CA sends it.It goes to several logs.📜2. Each log records it.It returns a signed receipt.💻3. Your browser checks.It needs the receipts.👀4. Chase watches.It reads every log.Suppose a CA signs a fake for chase.com.If it is logged, Chase sees it within minutes.If it is not logged, browsers reject it.This is Certificate Transparency.People call it CT for short.Chrome and Safari have required it since 2018.
[?] What does a public log look like? 📜A public log, such as Cloudflare’s Nimbus2027.rowcertificate forsigned byC0*.github.ioLet’s EncryptC1www.google.comGoogleC2en.wikipedia.orgLet’s EncryptC3www.cnn.comGlobalSignC4www.chase.comDigiCert← newThe log only adds rows at the end. It never edits or deletes one.🧾The log hands back a receipt.I am the Nimbus2027 log.I have www.chase.com as row C4.I got it on Dec 29 2025, 00:17:07.Signed with my log key.DigiCert puts the receiptinside Chase’s certificate.
[+] Chase’s certificate carries three receipts Chase’s certificate.www.chase.comChase’s public keyDigiCert’s signatureIt carries 3 receipts.🧾This receipt is from Cloudflare.Its log is Nimbus2027.🧾This receipt is from Sectigo.Its log is Tiger2027h1.🧾This receipt is from Let’s Encrypt.Its log is Willow2027h1.Why three companies?Chrome wants receiptsfrom more than onecompany that runs logs.So one bad logcannot hide acertificate.
[?] Where are these logs, and how big are they? A log is a public server. Anyone can read it over the web.companyweb address of the logrows today📜Googlect.googleapis.com/logs/us1/argon2026h23,449,621,901📜Let’s Encryptlog.willow.ct.letsencrypt.org/2027h1707,382,060📜Cloudflarect.cloudflare.com/logs/nimbus2027616,986,889📜Sectigotiger2027h1.ct.sectigo.com518,386,309Each log is huge.Google’s log holds 3.4 billion rows.Your laptop stores none of these rows.Chrome trusts 43 logs, run by 11 companies.Watchers read every new row.🔍Google🏦Chase📊crt.sh$ curl -s https://ct.cloudflare.com/logs/nimbus2027/ct/v1/get-sth"tree_size": 616986889
[?] Why can only the log make a receipt? 📜A log server, such as Nimbus2027.private keyIt never leaves.public keyAnyone may copy it.The log’s public list.C0 *.github.ioC1 www.google.comC2 en.wikipedia.orgC3 www.cnn.comC4 www.chase.com👀Chase’s watcher reads this list.ItaddsIt signs.🧾A receipt forwww.chase.com.It is signed with the private key.It ships inevery browser.💻Your browser hasthe public key.It came with the browser.✓It checks.🏛️A bad CA wants areceipt for its fake.It has no private key.Only the log server can sign a receipt, and every browser can check it offline.So a certificate that was never sent to a log has no valid receipt,and browsers reject it without contacting anyone.
[?] How does your browser check a receipt? 💻It keeps each log’s public key.Nimbus2027Tiger2027h1Willow2027h1Argon2026h2Tiger2026h2… and 38 more keys.It stores 43 keys, a few kilobytes. It stores no rows.Chase’s certificate.🧾Nimbus2027 signed this receipt.🧾Tiger2027h1 signed this receipt.🧾Willow2027h1 signed this receipt.✓✓✓GitHub’s certificate.🧾Argon2026h2 signed this receipt.🧾Tiger2026h2 signed this receipt.✓✓The browser never reads the log. It only checks these signatures, offline.
[x] What if a log signs a receipt but hides the row? What if the log server is bad too, working with a bad CA?🏛️A bad CAsigns a fakechase.com.A bad log server.It signs a receipt for it,but it does not publish it.The row never goes into its list.receipt💻Browsers check the receipt.It is real, so they accept.listThe log’s public list.C0 *.github.ioC1 www.google.comC2 en.wikipedia.orgThere is no chase.com row.👀Chase’s watcherreads the list.It finds nothing.So the fake works, and nobody can see it.We need the log to commit to every row, so that hiding one row can be caught.
[+] How does a log build its tree, row by row? This tree of hashes is a Merkle tree, from the hash lecture. The log rebuilds it after each row.1 rowheight 0C0root = H(C0)2 rowsheight 1C0C1root3 rowsheight 2C0C10-1C2root4 rowsheight 2C0C10-1C2C32-3root5 rowsheight 3C0C10-1C2C32-30-3C4root6 rowsheight 3C0C10-1C2C32-30-3C4C54-5root7 rowsheight 3C0C10-1C2C32-30-3C4C54-5C64-6root8 rowsheight 3C0C10-1C2C32-30-3C4C54-5C6C76-74-7rootEach level doubles the rows, so the height is O(log n).8 rows need 3 levels. 1,000,000 rows need 20. Cloudflare’s 616,986,889 rows need 30.The log server stores every hash: at most 2n - 1 for n rows, which is easy.
[+] What does the log publish? Every few seconds, the log publishes one small signed message, called a tree head.The tree head of Cloudflare’s Nimbus2027 log.The size is616,986,889 rowsThe root is548b3767b7daca4d…98efe70dThe time isOct 21 2026The log’s private key signs all three fields.Who gets this tree head?👀Watchers, such as Chase’s.💻Browsers that want to check.🌐Anyone, over the web.$ curl -s https://ct.cloudflare.com/logs/nimbus2027/ct/v1/get-sth{"tree_size":616986889, "sha256_root_hash":"VIs3Z7fayk39bUKN...", "tree_head_signature":"BAMARjBE..."}This one tree head commits the log to all 616,986,889 rows at once.If the log changes any row, the root changes, and its own signature no longer matches.
[?] What does a proof that C3 is in the log look like? C0C1C2C3C4C5C6C7H(0,1)H(2,3)H(4,5)H(6,7)H(0..3)H(4..7)signed rootA watcher holds a receipt for C3. Is C3 really in the log?C3This is C3.H(C2)H(0,1)H(4..7)The log sends these3 red hashes.The watcher recomputes the root by itself.a = H( H(C2), H(C3) )b = H( H(0,1), a )root = H( b, H(4..7) )= signed root ✓A wrong hash would give a different root, so the watcher need not trust the log.Where do the red hashes come from?The log stores the whole tree,2n − 1 hashes for n rows.It sends the 3 when asked.A proof is O(log n): 30 hashes for 617M rows.
[?] Who can catch a log that hides a fake? A bad log signed a receipt for a fake chase.com, but left the fake out of its tree.M sends the fakeand its receipt toone victim’s laptop.💻Only this laptopholds the receipt.Nobody else ever sees it.👀Chase’s watcher reads the tree.The fake is not in it.So the watcher has nothing to check.The tree the log signed.*.github.iogoogle.comH(0,1)wikipedia.orgcnn.comH(2,3)root⏰1. The laptop waits 24 hours.The log has 24 hours to add any row.📩2. It asks for a proof.Is this receipt’s row under the signed root?❌3. No proof comes back.No leaf holds the fake, so the hashes cannot fit.The laptop now holds evidence, and it reports it. The log is then removed from every browser.Unfortunately, this defense is passive: it catches the fake after the attack, not before.
[?] Why doesn’t every laptop check every time? Asking the log on every connection would cost too much.👁️Privacy.The log sees your sites.⏰Delay.A row can take 24 hours.🔌Outages.A slow log stalls pages.🌐Scale.Billions of checks a day.So Chrome checks a few receipts later, and one catch is enough.🎲It samples.About 1 in 1,000 visits.⏰It waits.It checks after 24 hours.🚨Google reports the log.The evidence is rare, but final.🚫One caught attack ends it.Every browser removes the log.Why is sampling enough?A log cannot tell which receiptswill be checked. One hidden fakerisks signed evidence and removal.Chrome also wants receipts from two logcompanies, so M needs two bad logs.This is a trade-off.We give up instant blocking to keepprivacy and fast pages. A fake canwork for a day or more before a report.Certificate Transparency deters and detects.It does not block every fake at once.Fortunately (or unfortunately), we have never caught such an attack so far.
[+] Who has signed for www.chase.com?
# We ask the logs for every live certificate that names www.chase.com. $ curl -s "https://api.certspotter.com/v1/issuances?domain=www.chase.com&expand=dns_names" | jq issued expires issuer names 2025-11-03 2026-11-02 DigiCert beta.chase.com, chasetravelcorporatesolutions.com, … 2025-11-25 2026-11-24 DigiCert beta.chase.com, chasetravelcorporatesolutions.com, … 2025-12-29 2027-01-05 DigiCert www.chase.com, beta.chase.com # This one is ours. 2026-07-13 2027-01-27 DigiCert beta.chase.com, creditcards.chase.com, … 2026-09-08 2027-03-25 DigiCert chase.com, www-ndc.chase.com, www.chase.com # There are 8 in total, and DigiCert issued every one.
Chase sees this list. Every certificate with its name shows up here, from any CA.
A fake would stand out. It would come from a CA that Chase never uses.

You can search your own site the same way at crt.sh.

[?] What must my laptop check before the lock? Chase sent three certificates. Before the lock, the laptop checks eight things.1The issuers lead to a root in my store.Who signed this, and is that root in my store?2Each signature fits the issuer’s key.The laptop hashes the fields and checks the signature.3Each issuer is allowed to be a CA.It must say CA: TRUE, and pathlen must allow it.4Every certificate is inside its dates.It is not too early, and it is not expired.5No certificate is revoked.This uses the revocation list we saw.6The leaf lists the name in the address bar.This is the name check we saw.7The leaf carries valid receipts from public logs.Each receipt fits a log key, from two companies.8The CertificateVerify signature fits the leaf key.This is promise 1, from the handshake.If any check fails, the browser warns you.⚠️Your connection is not private.Attackers might be trying to stealyour information from www.chase.com.NET::ERR_CERT_AUTHORITY_INVALIDAll eight pass, so the browser shows the lock.Each check stops a different M.If we skip one, that M wins.
[+] Here is what you should remember
  • The channel is solved; the naming is not. Almost every TLS disaster is about whose key it is, not about the cipher.
  • A certificate is a signature. The CA signs a name and a key, and your laptop checks it with a root key it already has.
  • Any root can sign for any name. M needs to break only one of 158 roots.
  • The lock is about the name, not the site. It means a private channel to the name in the bar.
  • One skipped check is enough. In CTF #8, the client skipped a single check.
  • A CA may only sign in public. Browsers require log receipts, and Merkle trees let anyone catch a lying log.
[+] We thank the people behind this material

These lecture materials were provided by Suman Jana (Columbia University), and this deck is a re-typeset and modernized version of his Security I slides.

Slides in the original material are borrowed from Vitaly Shmatikov.

The DigiNotar numbers come from the Fox-IT investigation. Moxie Marlinspike found the IE basicConstraints bug. Certificate Transparency was designed by Laurie, Langley, and Kasper. The icons come from Twemoji under CC-BY 4.0.

Errors introduced in the re-working, and the move to TLS 1.3 framing, are mine.

← all lectures