Kerberos Network Authentication


Kerberos Network Authentication

Anna
Today we’re unpacking Kerberos, a protocol for authenticating users, computers, and applications across a network using cryptography. The setting is a distributed system: clients on workstations need to reach services such as file, mail, and print servers. The network itself shouldn’t be trusted to authenticate people correctly.

Michael
That’s a big change from a time-sharing system where everyone logs into one machine and uses services on that same machine. And it’s a safer direction than relying on IP addresses alone, as some earlier remote-login commands did. Kerberos has been widely influential: it’s still used at MIT and forms the basis of Microsoft Active Directory.

Anna
The trust model is important. Every party has to trust the Kerberos server, often called the KDC, or Key Distribution Center. A user also has to trust the workstation where they enter their password, because a compromised workstation could capture the password or steal Kerberos tickets.

Michael
The servers don’t necessarily have to trust one another, though. If a mail server gets convenient access to a file server, that creates an additional trust relationship that could be abused. Kerberos aims to let a service verify a user cryptographically without having to trust the network or know every user in advance.

Anna
The KDC keeps a database associating principals with secret keys. A principal is an entity in the system—a user or a service—and each has a key shared with the KDC. For a client, that key is derived from the user’s password; for a service, its key is known to the service and the KDC, but ideally no one else.

Michael
You can think of those keys as a cryptographic version of shared passwords. The KDC’s job includes keeping track of which key belongs to which principal, then helping clients and services establish a key they can use to communicate with each other.

Anna
The architecture has two interfaces to the KDC. First, a client contacts the Kerberos service to get an initial ticket, usually for the Ticket Granting Service, or TGS. Later, the client presents that ticket to the TGS and asks for a ticket to the actual service it wants, such as a mail server.

Michael
Why not ask the KDC directly for every service ticket? Because the initial response is encrypted with the user’s key, derived from their password. Keeping that key around would be dangerous, and repeatedly asking the user to enter the password would be inconvenient. After decrypting the initial response, the client can discard the password-derived key and use the time-limited TGS ticket for later requests.

Anna
Names matter just as much as keys. Kerberos maps principal names to keys, but it doesn’t decide what a principal is allowed to do. The service does that through its own authorization policy, such as an access-control list. Kerberos answers, ‘Who is this?’ The service answers, ‘What may this person do?’

Michael
Principal names can include instances, which let the system distinguish related identities—for example, an ordinary user identity and a separate identity for especially sensitive use. Service principals matter too. When you connect to a host, your client needs to know which service name to expect so it can detect a fake server.

Anna
That’s the basis of mutual authentication. It’s not enough for a file server to learn who you are; you also want confidence that you’re talking to the real file server. Otherwise, an impostor could return false data while pretending to be the service you intended to contact.

Michael
Principal names also shouldn’t be casually recycled. If an old user’s name is removed from the KDC and later assigned to someone new, existing access-control lists may still grant that name access to the old user’s files. The new user could then inherit those permissions because the name is the same.

Anna
The same caution applies to service names: if a name is reused for a different service, clients might still expect it to identify the original one. Kerberos names are plain identities, and other systems may keep referring to them, so replacing or reusing them can have consequences.

Michael
Let’s define the two main pieces of a Kerberos exchange. A ticket identifies the client and server, includes the client’s IP address, a timestamp and expiration information, and carries a session key shared by the client and server. The ticket is encrypted with the server’s secret key.

Anna
The other piece is an authenticator. It contains the client’s name, its IP address, and a timestamp, and it is encrypted with the session key shared by that client and server. The client can create a fresh authenticator for a request, while the service can check it using the key it learned from the ticket.

Michael
For the initial login, the client tells the Kerberos service its principal name and the service principal it wants a ticket for—usually the TGS. The KDC responds with a ticket encrypted under the TGS’s secret key, plus a copy of the client–TGS session key encrypted under the client’s password-derived key.

Anna
Notice what the client does not send: its password. The KDC can return the encrypted response without first proving that the requester is really that user. The intended user demonstrates knowledge of the password-derived key by decrypting the response and using the contents.

Michael
But that design creates an offline password-guessing problem. Someone can request a response for a user, then try candidate passwords locally to see which one decrypts it plausibly. Symmetric decryption is fast, so an attacker can test many guesses without contacting the KDC again.

Anna
Kerberos version 4 also treated successful-looking decryption as if it proved the message was authentic and unmodified. That’s a mistake: encryption alone doesn’t guarantee integrity. Version 5 addresses this by authenticating messages as well as encrypting them.

Michael
A stronger password-derived key function can make guesses more expensive, and salting helps make precomputed password dictionaries less useful. But the source points to a more complete class of solutions: password-authenticated key exchange, or PAKE, including protocols such as SRP. These are designed to avoid exposing a captured exchange to straightforward offline guessing.

Anna
The initial response contains the session key twice in effect: one copy is encrypted for the client, and another is inside the ticket encrypted for the TGS. That lets the KDC give the same new key to both parties without having to contact the TGS separately.

Michael
Exactly. The client can decrypt its copy and later use the ticket as a sealed package for the TGS. The client doesn’t need to know the TGS’s secret key; it just passes along the ticket, and the TGS can open it.

Anna
When asking the TGS for a ticket to a real service, the client sends the desired service name, its existing TGS ticket, and an authenticator encrypted with the client–TGS session key. The TGS decrypts its ticket, checks the authenticator, and returns a new ticket for the requested service.

Michael
That response includes a client–service session key for the client to use, encrypted with the client–TGS session key. It also includes a ticket containing the same session key, encrypted with the target service’s secret key. The client can read its copy, and the service can later read its copy.

Anna
The fields in the ticket each serve a purpose. The service name helps ensure a ticket is being used for the intended service, and the client name tells the service who it is dealing with. The timestamp and lifetime bound how long the ticket should remain valid.

Michael
The IP address was intended as another check: if a ticket was issued while the client was at one address, a server could reject its use from a different address. That approach reflects older assumptions about IP addresses providing security. Kerberos 5 makes address restrictions largely optional, because cryptography should do the real authentication work.

Anna
A ticket’s lifetime limits the damage if the ticket is stolen, but it does not by itself stop someone replaying a still-valid ticket. That’s why authenticators are used. The server can reject authenticators it has already seen, or ones whose timestamps are outside an accepted time window.

Michael
This depends on machines having reasonably synchronized clocks. If your workstation’s clock is too far off, a server may reject a legitimate ticket or authenticator as too old or too far in the future.

Anna
There was a weakness in the older authenticator design: it proved that a client had recently made a request, but it wasn’t tied to the contents of that request. An attacker could capture a fresh authenticator and pair it with an older command. Version 5 fixes this by including information that binds the authenticator to the message being sent.

Michael
Once the client has a service ticket, the service can use its own secret key to decrypt it, learn the client’s identity and session key, and then process the client’s request. For example, a mail client might send a ticket and a request to delete a message, protected with the client–mail-server key.

Anna
That example highlights another version 4 flaw: the same session key was used for traffic in both directions. Suppose a client asks the mail server to fetch a message, and the server replies with encrypted data. If the response can be replayed as though it were a client request, the server may be fooled into performing an action.

Michael
That’s called a reflection attack: the attacker reflects a message from one direction into the other, exploiting the fact that both sides use the same key. Kerberos 5 avoids this by using separate keys for client-to-server and server-to-client traffic, so a message from one direction won’t authenticate as a message from the other.

Anna
The encryption algorithm itself also needs to be replaceable. Kerberos 4 built in DES, which was a reasonable choice at the time, but its 56-bit key later became practical to brute-force. Kerberos 5 supports multiple encryption algorithms, including AES, rather than locking the protocol to one aging choice.

Michael
The KDC is critical, but it’s not in the middle of every service interaction. If it goes down, users may be unable to log in or get new tickets, but existing tickets can still be used until they expire. That makes the KDC less of a bottleneck for ongoing connections.

Anna
There can also be read-only KDC replicas. They can respond to login and ticket requests using a copy of the database, though they don’t accept changes such as registering users or updating keys. The master remains responsible for updates.

Michael
Compromising the KDC would be catastrophic: an attacker could create tickets impersonating users to services. So it needs strong protection, including careful software security and a small attack surface. By comparison, a compromised individual service can often be recovered from—but only if its secret key is changed.

Anna
Why change the service key after a compromise? If the attacker still knows the old key, they can decrypt tickets for that service and potentially make their own convincing tickets, even after the vulnerable server software is replaced. Rotating the key in the KDC and installing it on a clean service prevents continued use of the compromised key.

Michael
Changing keys requires trusted administration. If someone can alter the KDC’s database, they can affect the system’s security. Initial account registration and recovery when a key is lost therefore depend on people or processes that are part of the trusted computing base.

Anna
There’s also a password-login scenario. A remote machine might accept a user’s password and ask the KDC for a response encrypted with the user’s key, then check whether the supplied password decrypts it. But if the remote machine accepts any response that decrypts correctly, an attacker could forge a response and trick the machine into logging the user in.

Michael
The problem is that the machine has not proved that the response came from the real KDC. A more sensitive shared machine can check again by requesting a service ticket for itself through the TGS. If it can decrypt that ticket using its own secret key, it knows the response was produced by the KDC.

Anna
A personal workstation may not make that second check because it has no secret key shared with the KDC, and the user effectively controls that machine anyway. A shared dial-up machine is different: it has other users’ processes and resources, so it needs stronger assurance before assigning someone an identity on the system.

Michael
Kerberos also has a password-changing service, often called kpassword. The user gets a ticket for it and sends the new password encrypted with the session key. The service updates the user’s key in the KDC database.

Anna
But not every ticket should be enough to change a password. A stolen TGS ticket could otherwise let an attacker get a password-changing ticket. So the password service checks whether the ticket was obtained directly through the initial Kerberos exchange, which requires the password-derived key, rather than through the TGS.

Michael
That protects against someone who steals a ticket after the user logs in, but it doesn’t protect against someone who knows the current password. If an attacker knows your password, they can authenticate as you and change it—just as in other password-based systems.

Anna
There’s a subtler problem with the older password-changing protocol. If someone recorded the encrypted password-change exchanges, then later learned an old password, they could decrypt an earlier exchange and recover the next password. By following the recorded exchanges, they might work their way forward to the current password.

Michael
Kerberos 5 addresses that with Diffie–Hellman key exchange. The client chooses a random value and sends a corresponding exponentiation; the password service chooses its own random value and sends its exponentiation back. Both can compute a shared secret, but an observer who records the exchanged values is not supposed to be able to compute that secret.

Anna
The new password can then be protected with that newly established secret. The mathematical difficulty involved is related to the discrete logarithm problem. The key lesson is broader than Kerberos: use a sound key-exchange protocol when you need a fresh shared secret, rather than assuming old encrypted exchanges will stay harmless forever.

Michael
So the big picture is that Kerberos uses a trusted KDC to connect names, keys, tickets, and session keys across a distributed network. It separates authentication from a service’s authorization decisions, limits ticket lifetimes, and supports mutual authentication. Its history also shows why encryption, integrity, replay protection, key choice, and password handling all need careful design.

Ask anything
We've read this whole study set, so questions about it get the best answers.