Applied Cryptography for Developers Module 15 – End-to-end encryption and advanced protocols
Kerberos tickets, authenticators and replay checks
How tickets and authenticators let strangers authenticate through a KDC, which checks stop replays, and the RFC 8009 AES keys rebuilt against its vectors.
What you will learn
- Explain how a key distribution centre, tickets and authenticators let parties who share no secret authenticate each other
- Trace the AS, TGS and AP exchanges of Kerberos V5 and name the key that protects each message
- Reproduce the RFC 8009 string-to-key, key-derivation, encryption and checksum vectors for the AES-SHA2 encryption types
- Design and test replay, clock-skew, pre-authentication, key-usage and expiry checks on a teaching ticket protocol
- List the Kerberos encryption types that current guidance retires and the settings that turn them off
Before you start
What you’ll learn · Before you start
What you will learn
- Explain how a key distribution centre, tickets and authenticators let parties who share no secret authenticate each other
- Trace the AS, TGS and AP exchanges of Kerberos V5 and name the key that protects each message
- Reproduce the RFC 8009 string-to-key, key-derivation, encryption and checksum vectors for the AES-SHA2 encryption types
- Design and test replay, clock-skew, pre-authentication, key-usage and expiry checks on a teaching ticket protocol
- List the Kerberos encryption types that current guidance retires and the settings that turn them off
Before you start
On this page
Ten services that may all need to talk to one another need 45 shared keys. A hundred need 4,950, and a thousand need 499,500. Kerberos avoids that growth by giving each party one key, shared only with a central server, which introduces any two parties who want to talk. Kerberos tickets carry the introduction, and authenticators prove that whoever shows a ticket holds its key right now.
Replay checks decide whether that proof can be trusted, because a service that does not refuse replays accepts a recorded authenticator every time an attacker sends it. This lesson follows the three exchanges, runs a teaching realm that applies the replay, clock and expiry checks, rebuilds the key derivation of RFC 8009 against its vectors, and ends with the encryption types that current guidance retires.
A key distribution centre replaces pairwise keys with one key for each party
If every pair among n parties needs its own secret key, each party holds n - 1 keys and the whole system holds n(n - 1)/2. The Handbook of Applied Cryptography calls this the n² key distribution problem. Its answer for symmetric keys is a trusted server at the centre of a star, the key distribution centre: A trusted online server that shares one long-term key with every party and introduces any two of them by issuing a session key. In Kerberos it runs the authentication service and the ticket-granting service.: every party shares one long-term key with it, and it hands out a fresh session key whenever two parties want to talk.
| Parties | Keys if every pair has one | Keys with a KDC |
|---|---|---|
| 10 | 45 | 10 |
| 100 | 4,950 | 100 |
| 1,000 | 499,500 | 1,000 |
The Handbook names the cost: an online server that must be trusted, an attractive target, a bottleneck, and a single point of failure. Needham-Schroeder with shared keys, the protocol that Kerberos builds on, has the server return a session key sealed for the first party, with a copy inside it sealed for the second. Its weakness is freshness. The second party cannot tell whether the key is fresh, so if a session key is ever stolen, an attacker can resend the old copy and pose as the first party. Kerberos limits this with a lifetime in the ticket, the Handbook says, and uses timestamps where Needham-Schroeder uses nonces.
Kerberos tickets are sealed under the key of the party they are meant for, so a client carries one without being able to read or change it. Authenticators are the second piece: each is a name and a timestamp sealed under the session key, and a fresh one goes with every use of a ticket. The ticket says whom the KDC introduced, and the authenticator says that the sender holds the session key now. The replay checks that make this proof hold up are the rest of the lesson: a cache of recent authenticators, a window around the clock, and an end time on every ticket. Without them a recorded request is simply sent again, and a service cannot tell replays from the real thing.
Checkpoint
Check: Pairwise keys against a key distribution centre
Flashcards · 5 cards
Recall it, then check
Say the answer to yourself before you look: recalling it is what makes it stick.
-
Why does Kerberos use a key distribution centre instead of pairwise keys?
If every pair among n parties needs its own key, the system holds n(n − 1)/2 keys: 45 for 10 parties, 4,950 for 100 and 499,500 for 1,000. With a KDC every party shares one long-term key with it, so the system holds n keys, and the KDC hands out a fresh session key whenever two parties want to talk.
-
What does a key distribution centre cost?
An online server that must be trusted, an attractive target, a bottleneck and a single point of failure, as the Handbook names them.
-
What is the weakness of Needham-Schroeder with shared keys, and how does Kerberos limit it?
The server returns a session key sealed for the first party, with a copy inside sealed for the second. The second party cannot tell whether the key is fresh, so if a session key is ever stolen an attacker can resend the old copy and pose as the first party. Kerberos limits this with a lifetime in the ticket, and uses timestamps where Needham-Schroeder uses nonces.
-
What do a Kerberos ticket and an authenticator each prove?
A ticket is encrypted under the key of the service it is meant for, so a client carries it without being able to read or change it; it records whom the KDC introduced. An authenticator is a name and a timestamp sealed under the session key, and a fresh one goes with every use of a ticket; it shows that the sender has the session key at this moment.
-
Which replay checks make a Kerberos authenticator trustworthy?
Three checks together: a cache of recent authenticators, a window around the clock, and an end time on every ticket. Without them a recorded request can simply be sent again, and the service cannot tell a replay from the real thing.
The AS, TGS and AP exchanges, and the key that protects each message Pro: opens with a Pro, Premium or Ultimate pass
In this part:
- A service checks the ticket and the authenticator in a fixed order
- Pre-authentication keeps the KDC from handing out ciphertext to guess against
- The AES-SHA2 encryption types of RFC 8009, rebuilt and checked against its vectors
- Retire the weak encryption types, and turn them off
- Practise: write the service’s checks
- The checks a service makes on a ticket and an authenticator
- Interview questions
- An attacker records a user's Kerberos service ticket from the network. Why can it not be used to log in to the service as that user?
- After a failure of the time source, users of a Kerberos realm get clock skew errors from several services. A colleague proposes to set the allowed skew to one hour on every client and server. Evaluate the proposal and say what you would do instead.
- A review finds that several service principals have keys made from passwords that people chose, and that RC4 is still allowed in the realm. Explain the risk, rank the fixes, and describe how to migrate without breaking existing clients.
- A file service in a Kerberos realm crashes and restarts, and its replay cache lived in memory. Describe the window that this opens, what the service must do after the restart, and how you would design the service so that a restart is not an opening for an attacker.
- Key takeaways
2 diagrams · 3 runnable examples (JavaScript) · 1 exercise with sample tests · 3 interview answers · about 40 minutes
Opening this part with your pass…
This part opens with any MySmartCoPilot pass.
- Pro pass · 1 week₹79$2.99
- 30 days₹179$5.99
- 1 year₹1,699$45
One payment; a pass never renews. The price shown is the total you pay: no fees or charges are added at checkout.
Passes can’t be bought right now, so this part can’t be opened at the moment. The free part above stands on its own. If you have a pass, enter your licence key.
It also opens every other in-depth part in Learn and every Pro tool. Sales are final, except where the law gives you a right to withdraw, for example in the EU and the UK (refund policy).
Terms in this lesson
- authenticator
- In Kerberos, a short message with the client's name and the current time, sealed under the session key from a ticket. It shows that the sender holds the key now, and a service refuses one that is outside the clock skew or that it has seen.
- ciphertext stealing
- A way to run CBC mode on data whose length is not a multiple of the block size without padding: the last two ciphertext blocks swap places and the final one is cut short, so the ciphertext is as long as the plaintext.
- confounder
- A random block put in front of the plaintext before a Kerberos encryption, so that the same plaintext seals to a different ciphertext each time. RFC 8009 uses 16 bytes and the receiver discards them.
- key distribution centre
- A trusted online server that shares one long-term key with every party and introduces any two of them by issuing a session key. In Kerberos it runs the authentication service and the ticket-granting service.
- key usage number
- A number that Kerberos assigns to each purpose of a sealed message. The keys of an encryption type are derived from the base key and the usage, so a message sealed for one purpose does not open for another.
- pre-authentication
- A proof the client gives with its first Kerberos request, such as the current time sealed under its key, so that the KDC does not hand a reply sealed under a password-derived key to just anyone.
- ticket
- A Kerberos credential sealed under the long-term key of the party it is for. It names the client, holds a session key and has a start and an end time, and it proves nothing without an authenticator made under that session key.
- ticket-granting ticket
- The ticket that a Kerberos client receives at login. It is sealed under the KDC's own key, so the client cannot read it, and the client presents it with an authenticator to ask for tickets to services.
References
- RFC 4120: The Kerberos Network Authentication Service (V5) (sections 3, 5.2.7.2, 7.5.1, 8.2 and 10) (Internet Engineering Task Force (IETF))
- RFC 8009: AES Encryption with HMAC-SHA2 for Kerberos 5 (sections 3 to 6 and Appendix A) (Internet Engineering Task Force (IETF))
- RFC 3961: Encryption and Checksum Specifications for Kerberos 5 (Internet Engineering Task Force (IETF))
- RFC 3962: Advanced Encryption Standard (AES) Encryption for Kerberos 5 (Internet Engineering Task Force (IETF))
- RFC 6113: A Generalized Framework for Kerberos Pre-Authentication (Internet Engineering Task Force (IETF))
- RFC 6649: Deprecate DES, RC4-HMAC-EXP, and Other Weak Cryptographic Algorithms in Kerberos (Internet Engineering Task Force (IETF))
- RFC 8429: Deprecate Triple-DES (3DES) and RC4 in Kerberos (Internet Engineering Task Force (IETF))
- Handbook of Applied Cryptography, chapter 12: Key Establishment Protocols (Protocols 12.24 and 12.26, Remark 12.28) (CRC Press (authors' copy, University of Waterloo))
- Handbook of Applied Cryptography, chapter 13: Key Management Techniques (section 13.2.3 and Remark 13.3) (CRC Press (authors' copy, University of Waterloo))
- MIT Kerberos documentation: krb5.conf (libdefaults) (Massachusetts Institute of Technology)
- MIT Kerberos documentation: Encryption types (Massachusetts Institute of Technology)
- OWASP Key Management Cheat Sheet (OWASP Foundation)
- OWASP Application Security Verification Standard 5.0, V11 Cryptography (requirement 11.1.1) (OWASP Foundation)
- Node.js 24 documentation: Crypto (pbkdf2Sync, createHmac, createCipheriv) (OpenJS Foundation (Node.js))
Report a problem with this lesson
Kept only in this browser. Your Learn progress