Beta

Create a tenant

A new tenant starts with its own users, OAuth settings, audit history and logs. You are its first Tenant Admin.

How Kerberos tickets work

Riley types a password once on Monday morning at Cedar Inc., and the finance team's file server opens without ever seeing it. This lesson follows that morning through Kerberos: the ticket-granting ticket, the service ticket, the fresh authenticator that makes a ticket worth trusting, and what each one does and does not prove to the file server.

A ticket for a particular service

At 08:52 on Monday, Riley opens a laptop at Cedar Inc., types a password once, and starts the week. Twenty minutes later Riley opens the finance team's shared folder, \\files.cedar.example\finance, and it simply opens. Nobody asked for the password again, and the file server never saw it. What reached the file server instead was a ticket: a small encrypted message that tells the server who Riley is.

Cedar's office network is run by Active Directory, Microsoft's directory service for office networks. It keeps the accounts for Cedar's people, computers and services in a domain, and the servers that hold that directory and answer sign-ins are called domain controllers. The protocol behind Riley's tickets is Kerberos, and it solves a problem every office network has. Riley will use dozens of services in a day. Sending the password to each one would spread it everywhere and trust every server to handle it carefully. Kerberos adds a third party that everyone already shares a secret with, the Key Distribution Center (KDC). In Active Directory, every domain controller runs a KDC.

Each user, computer and service that takes part is a principal, named within a realm. Cedar's realm is CEDAR.EXAMPLE, and Riley is [email protected]. A service is named by a service principal name (SPN) that says what kind of service it is and which host runs it. The file server's SPN is cifs/files.cedar.example, registered on the file server's computer account in the directory.

The KDC knows a long-term key for every principal. Riley's key is derived from Riley's password. The file server's key is derived from its computer account's password, a long random value the computer changes on its own. The KDC also holds one key nobody else has, belonging to a special account called krbtgt. Because the KDC shares a key with both Riley and the file server, it can introduce one to the other. All names and hosts in these examples are fictional.

Two kinds of ticket

Riley's morning involves three exchanges. The first happens at sign-in. The laptop sends the KDC an AS-REQ, an authentication service request, including the current time encrypted with Riley's key. That encrypted timestamp, called pre-authentication, lets the KDC check that the request comes from someone who knows the password before it answers. The reply, the AS-REP, carries a ticket-granting ticket (TGT) and a fresh session key.

The TGT is encrypted with the krbtgt key, so the laptop cannot read or change it. It can only hand it back to the KDC. The session key also arrives in a part of the reply encrypted with Riley's key, so the laptop can read that copy. From now on the laptop uses the TGT and its session key instead of the password. Cedar's TGTs last ten hours.

When Riley opens the finance folder, the laptop starts the second exchange. It sends a TGS-REQ to the ticket-granting service, part of the same KDC, with the TGT, the SPN cifs/files.cedar.example, and a short message encrypted with the TGT session key. The KDC answers with a service ticket encrypted with the file server's key, plus a new session key for Riley and the file server to share.

The third exchange goes to the file server itself. The laptop sends an AP-REQ containing the service ticket. The server decrypts the ticket with its own key, finds Riley's name and the session key inside, and now knows who is asking.

Riley's ticket exchanges on Monday morning (illustrative)
TimeMessageWhat it carriesEncrypted with
08:52AS-REQ to the KDC on dc1.cedar.exampleRiley's name and an encrypted timestampThe timestamp: Riley's key
08:52AS-REP to the laptopA TGT valid until 18:52, and a TGT session keyThe TGT: the krbtgt key. The session key copy: Riley's key
09:12TGS-REQ to the KDCThe TGT, the SPN cifs/files.cedar.example and an authenticatorThe authenticator: the TGT session key
09:12TGS-REP to the laptopA service ticket and a service session keyThe ticket: the file server's key. The session key copy: the TGT session key
09:12AP-REQ to files.cedar.exampleThe service ticket and a fresh authenticatorThe authenticator: the service session key

Notice what the KDC did not check at 09:12. It issued a ticket for the file server without asking whether Riley may read the finance folder. That decision belongs to the file server. The service ticket carries Riley's identity and, in Active Directory, the groups Riley belonged to when the TGT was issued. Those groups travel in a Privilege Attribute Certificate (PAC), a Microsoft extension carried inside the ticket's authorization data. It is defined in the MS-PAC specification, not in the base Kerberos protocol (RFC 4120), and despite the name it is not an X.509 certificate. The file server reads the PAC and compares those groups with the folder's permissions:

Riley's Monday morning. The KDC issues tickets; the file server checks each one and then decides the folder permission itself, so a valid ticket is not permission to read every file.

A TGT lets Riley ask for tickets. It is not permission to read every file in the domain, and the PAC inside each ticket is what the file server reads to decide.

A ticket alone is not the whole proof

A service ticket sits in the laptop's memory for hours and crosses the network every time it is used. If presenting the ticket were enough, anyone who copied it off the wire could replay it. So the AP-REQ also carries an authenticator: Riley's name and the current time, encrypted with the service session key. Only someone holding that session key can produce a valid one, and the session key itself never crosses the network unencrypted.

When the file server receives the AP-REQ, it runs a series of checks, and any one of them can refuse the request:

  • The ticket must decrypt with the server's own key. A ticket issued for another service was encrypted with that service's key, so the file server cannot read it.
  • The ticket must not have expired.
  • The authenticator must decrypt with the session key inside the ticket and name the same client.
  • Its timestamp must be close to the server's clock. Active Directory allows five minutes of clock skew by default.
  • It must not have been seen before. The server keeps a short replay cache of recent authenticators.

Only after all of that does the file server look at folder permissions. The table shows what happened to five requests for the finance folder on Monday.

Requests reaching cifs/files.cedar.example (illustrative)
RequestWhat was wrongResult
Riley at 09:12NothingAuthenticated, then allowed by the folder permission
A ticket for http/reports.cedar.exampleIssued for another serviceRefused: the server cannot decrypt it
Riley's 09:12 messages, sent again at 09:13Authenticator already usedRefused as a replay
A laptop whose clock is nine minutes fastTimestamp outside the five-minute windowRefused for clock skew, even though the person is genuine
A colleague in sales with a valid ticketNot in the finance groupAuthenticated, then refused by the folder permission

In the last row the colleague proved who they are and still could not read the folder: authentication and permission are separate decisions. Riley can also be refused for a reason that has nothing to do with Riley. Suppose someone registers cifs/files.cedar.example on the wrong account in the directory. The KDC then encrypts every ticket for the file server with that other account's key, and the file server cannot read even Riley's perfectly healthy request. The repair is to put the SPN back on the right account. Making the server accept tickets it cannot verify, or switching off the freshness and replay checks to get Riley working again, would remove the protections that make a ticket worth trusting.

When diagnosing failures like these, record which stage refused and why: wrong service, expired ticket, clock skew, replay or permission. Tickets, session keys and passwords never belong in routine logs.

Keep authentication and later protection distinct

When the file server accepts the AP-REQ, it knows it is talking to Riley. Riley's laptop can learn the reverse. The server can return an AP-REP encrypted with the session key, which only the real file server could produce, because only it could decrypt the ticket to find that key. This is mutual authentication, and it protects Riley from a machine pretending to be the file server.

None of this encrypts the files. Kerberos ends with both sides holding a shared session key. Whether the spreadsheets that follow travel with integrity protection, encryption or neither depends on the application protocol and its settings. The file-sharing protocol can use the session key to sign or encrypt its traffic, but only when it is configured to. An authenticated connection is not automatically a protected one, and the file server still checks permissions on every file Riley opens.

The tickets themselves deserve care. A TGT and its session key, copied from Riley's laptop, let someone else request service tickets as Riley until the TGT expires, much as a stolen session cookie does on the web, as How sessions and tokens are stolen describes. Ending access has a similar gap. If Cedar disables Riley's account at 11:00, the KDC refuses new tickets, but the service ticket issued at 09:12 is checked only by the file server, which does not ask the KDC, so it keeps working until it expires. The actual ticket lifetimes tell Cedar how long that gap is.

Check your understanding

Try these questions before moving on. If an answer isn't right, use the feedback and try again.

Riley's healthy request to cifs/files.cedar.example is refused because that SPN was registered on the wrong account. What is the right repair? 1 of 3

Choose one answer.

A colleague in sales presents a valid service ticket and a fresh authenticator to the finance file server. What happens? 2 of 3

Choose one answer.

Someone copies Riley's 09:12 AP-REQ off the network and sends the same bytes to the file server at 09:13. What stops it? 3 of 3

Choose one answer.

Try it in the Lab

We value your privacy

We use cookies and similar technologies to enhance your browsing experience, and analytics to understand our traffic. By clicking "Allow all", you consent to optional analytics. Cookie Policy

Learn identity