What is Kerberos?
*****************

     Now this Cerberus had three heads of dogs,
     the tail of a dragon, and on his back the
     heads of all sorts of snakes.
     --- Pseudo-Apollodorus Library 2.5.12

Kerberos is a system for authenticating users and services on a network. It is built upon the assumption that the network is ``unsafe''.  For example, data sent over the network can be eavesdropped and altered, and addresses can also be faked.  Therefore they cannot be used for authentication purposes.

Kerberos is a trusted third-party service.  That means that there is a third party (the kerberos server) that is trusted by all the entities on the network (users and services, usually called principals).  All principals share a secret password (or key) with the kerberos server and this enables principals to verify that the messages from the kerberos server are authentic.  Thus trusting the kerberos server, users and services can authenticate each other.

Basic mechanism
===============

     Note This discussion is about Kerberos version 4, but version 5 works similarly.

In Kerberos, principals use tickets to prove that they are who they claim to be. In the following example, A is the initiator of the authentication exchange, usually a user, and B is the service that A wishes to use.

To obtain a ticket for a specific service, A sends a ticket request to the kerberos server. The request contains A's and B's names (along with some other fields). The kerberos server checks that both A and B are valid principals.

Having verified the validity of the principals, it creates a packet containing A's and B's names, A's network address (AADDR), the current time (TISSUE), the lifetime of the ticket (LIFE), and a secret session key (KAB). This packet is encrypted with B's secret key (KB).  The actual ticket (TAB) looks like this: ({A, B, AADDR, TISSUE, LIFE, KAB}KB).

The reply to A consists of the ticket (TAB), B's name, the current time, the lifetime of the ticket, and the session key, all encrypted in A's secret key ({B, TISSUE, LIFE, KAB, TAB}KA). A decrypts the reply and retains it for later use.

Before sending a message to B, A creates an authenticator consisting of A's name, A's address, the current time, and a ``checksum'' chosen by A, all encrypted with the secret session key ({A, AADDR, TCURRENT, CHECKSUM}KAB). This is sent together with the ticket received from the kerberos server to B.  Upon reception, B decrypts the ticket using B's secret key.  Since the ticket contains the session key that the authenticator was encrypted with, B can now also decrypt the authenticator. To verify that A really is A, B now has to compare the contents of the ticket with that of the authenticator. If everything matches, B now considers A as properly authenticated.

Different attacks
=================

Impersonating A
---------------

An impostor, C could steal the authenticator and the ticket as it is transmitted across the network, and use them to impersonate A. The address in the ticket and the authenticator was added to make it more difficult to perform this attack.  To succeed C will have to either use the same machine as A or fake the source addresses of the packets. By including the time stamp in the authenticator, C does not have much time in which to mount the attack.

Impersonating B
---------------

C can hijack B's network address, and when A sends her credentials, C just pretend to verify them. C can't be sure that she is talking to A.

Defence strategies
==================

It would be possible to add a replay cache to the server side.  The idea is to save the authenticators sent during the last few minutes, so that B can detect when someone is trying to retransmit an already used message. This is somewhat impractical (mostly regarding efficiency), and is not part of Kerberos 4; MIT Kerberos 5 contains it.

To authenticate B, A might request that B sends something back that proves that B has access to the session key. An example of this is the checksum that A sent as part of the authenticator. One typical procedure is to add one to the checksum, encrypt it with the session key and send it back to A.  This is called mutual authentication.

The session key can also be used to add cryptographic checksums to the messages sent between A and B (known as message integrity).  Encryption can also be added (message confidentiality). This is probably the best approach in all cases.

Further reading
===============

The original paper on Kerberos from 1988 is Kerberos: An Authentication Service for Open Network Systems, by Jennifer Steiner, Clifford Neuman and Jeffrey I. Schiller.

A less technical description can be found in Designing an Authentication System: a Dialogue in Four Scenes by Bill Bryant, also from 1988.

These documents can be found on our web-page at http://www.pdc.kth.se/kth-krb/.