How Kerberos Works: Ticket-Based Authentication Without Sending Passwords

Kerberos is a ticket-based network authentication protocol that allows users and services to prove their identity to each other without transmitting passwords over the network. Named after the three-headed dog guarding the gates of Hades in Greek mythology, Kerberos was developed at MIT in the 1980s and is now the default authentication protocol in every Active Directory environment. When you log into a Windows domain-joined computer and seamlessly access file shares, printers, and intranet applications without entering your password again, Kerberos is issuing tickets behind the scenes. Kerberos v5 is defined in RFC 4120 (2005) and is implemented across all major operating systems.

The Problem: Authenticating on an Untrusted Network

In a networked environment, authenticating users and services presents fundamental challenges:

Kerberos solves these by introducing a trusted third party — the Key Distribution Center (KDC) — that both users and services trust. Users authenticate once to the KDC and receive tickets that prove their identity to individual services. Passwords never traverse the network after the initial authentication.

Kerberos Architecture

The Kerberos system has three main components:

Every participant in the Kerberos realm shares a long-term key with the KDC. For users, this key is derived from their password. For services, it is a randomly generated key stored in a keytab file. The KDC has a database containing the keys for every principal (user or service) in the realm.

Kerberos Authentication Flow Client KDC AS TGS Application Server Phase 1: AS Exchange 1. AS-REQ (username, timestamp) 2. AS-REP (TGT + session key) Client decrypts with password Phase 2: TGS Exchange 3. TGS-REQ (TGT + target service name) 4. TGS-REP (service ticket + session key) Phase 3: AP Exchange 5. AP-REQ (service ticket + authenticator) 6. AP-REP (mutual auth proof) 7. Authenticated session established

The Three Exchanges

Phase 1: Authentication Service (AS) Exchange

The client authenticates to the KDC and obtains a Ticket-Granting Ticket (TGT):

  1. AS-REQ — The client sends an Authentication Service Request containing: the user's principal name ([email protected]), a timestamp encrypted with the user's long-term key (derived from their password), and the requested TGT lifetime.
  2. Pre-authentication — The KDC looks up the user's key in its database and attempts to decrypt the timestamp. If it decrypts to a valid time (within the allowed clock skew), the user's identity is confirmed without the password ever being sent.
  3. AS-REP — The KDC responds with two items:
    • A TGT — encrypted with the KDC's own key (krbtgt). The client cannot read or modify the TGT; it is opaque to the client.
    • A session key — encrypted with the user's key (so only the user can decrypt it). This session key will be used in subsequent TGS requests.

After this exchange, the client has a TGT and a session key, both stored in a credential cache (on Linux, typically /tmp/krb5cc_<uid> or a kernel keyring; on Windows, in LSASS memory). The password-derived key is discarded — it is no longer needed until the TGT expires (typically 10 hours in AD).

Phase 2: Ticket-Granting Service (TGS) Exchange

When the client wants to access a service, it requests a service ticket from the TGS:

  1. TGS-REQ — The client sends: the TGT (still encrypted with the KDC's key), the name of the target service (the Service Principal Name, e.g., HTTP/[email protected]), and an authenticator (username + timestamp encrypted with the TGT session key, proving the client knows the session key).
  2. TGS-REP — The TGS decrypts the TGT using its own key, extracts the session key, uses it to verify the authenticator, then generates:
    • A service ticket — encrypted with the target service's key (which the KDC knows from its database). Contains the client's identity, the session key for client-service communication, and authorization data (in AD, this includes the user's group memberships via the PAC — Privilege Attribute Certificate).
    • A new session key — encrypted with the TGT session key, for the client-service communication.

The client can obtain multiple service tickets using the same TGT without re-entering the password. This is the "single sign-on" experience: authenticate once, access many services.

Phase 3: Application (AP) Exchange

The client presents the service ticket to the application server:

  1. AP-REQ — The client sends the service ticket (encrypted with the service's key) and an authenticator (timestamp encrypted with the service session key).
  2. The service decrypts the ticket using its keytab, extracts the session key, and verifies the authenticator. The service now knows the client's identity.
  3. AP-REP (optional) — If mutual authentication is requested, the service encrypts the client's timestamp with the session key and returns it. The client verifies this to confirm it is talking to the legitimate service, not an impostor.

The critical security property: the user's password was never sent to the application server. The service only receives a ticket that proves the KDC authenticated the user. If the service is compromised, the attacker gets the service's own keytab (which can impersonate that specific service) but not the user's password or TGT.

Service Principal Names (SPNs)

A Service Principal Name (SPN) uniquely identifies a service instance in a Kerberos realm. The format is:

service-class/hostname[:port][@REALM]

Examples:

In Active Directory, SPNs are registered as attributes on the service's AD account. The setspn command manages SPN registrations. Duplicate SPNs cause authentication failures because the KDC cannot determine which service account's key to use for encrypting the service ticket.

The PAC: Privilege Attribute Certificate

In Active Directory environments, Kerberos tickets contain a PAC (Privilege Attribute Certificate) — a Microsoft-specific extension that carries the user's authorization data: Security Identifier (SID), group memberships, and other security attributes.

The PAC is embedded in the ticket's authorization-data field and is signed by both the KDC's key and the target service's key. The service extracts the PAC to make authorization decisions (e.g., "is this user a member of the Domain Admins group?") without making additional calls to the domain controller.

The PAC has been the target of critical vulnerabilities. The most notable is MS14-068 (CVE-2014-6324), where a flaw in PAC signature validation allowed a regular domain user to forge a PAC claiming Domain Admin membership. An attacker could authenticate as a low-privilege user, modify the PAC in their TGT to include Domain Admins, and gain full domain control.

Delegation: Constrained and Unconstrained

Kerberos delegation allows a service to act on behalf of a user when accessing other services. This is essential for multi-tier applications where a web frontend needs to access a database server as the authenticated user.

Unconstrained Delegation

A service configured for unconstrained delegation receives a copy of the user's TGT along with the service ticket. The service can use this TGT to request tickets for any service as the user — essentially impersonating the user for any purpose.

This is extremely dangerous. If an attacker compromises a server with unconstrained delegation, they obtain TGTs for every user who authenticates to that server. With a domain admin's TGT, the attacker has full domain control. Unconstrained delegation should be avoided in modern environments.

Constrained Delegation

Constrained delegation limits which services a delegated service can access. The service's AD account has an msDS-AllowedToDelegateTo attribute listing the specific SPNs it can delegate to. The KDC checks this list and refuses to issue tickets for any service not in the list.

Constrained delegation comes in two forms:

Kerberoasting

Kerberoasting is an attack that exploits the fact that service tickets are encrypted with the service account's password hash. Any authenticated domain user can request a service ticket for any service with an SPN registered — the KDC does not check whether the requesting user is authorized to access the service. The TGS simply issues the ticket.

The attack works like this:

  1. The attacker enumerates user accounts with SPNs registered (these are service accounts running under user accounts, not machine accounts).
  2. The attacker requests a service ticket for each SPN.
  3. The attacker extracts the ticket's encrypted data and performs offline brute-force/dictionary attacks to recover the service account's password.

Kerberoasting is effective because:

Defenses include:

Other Kerberos Attacks

SPNEGO and Kerberos in Web Applications

SPNEGO (Simple and Protected GSSAPI Negotiation Mechanism) is the protocol that enables Kerberos authentication in web browsers. When you access an intranet site and are automatically logged in without entering credentials, SPNEGO is negotiating Kerberos authentication between your browser and the web server.

The flow:

  1. The browser sends an HTTP request to the web server.
  2. The server responds with 401 Unauthorized and WWW-Authenticate: Negotiate.
  3. The browser obtains a Kerberos service ticket for the web server's SPN (HTTP/web.example.com).
  4. The browser wraps the ticket in a SPNEGO token and sends it in the Authorization: Negotiate YII... header.
  5. The server decrypts the ticket, validates the authenticator, and the user is authenticated.

SPNEGO can also negotiate NTLM as a fallback when Kerberos is unavailable (e.g., the server is accessed by IP address instead of hostname, or the client is not domain-joined). NTLM is weaker than Kerberos and should be disabled where possible.

Cross-Realm Authentication

Kerberos supports authentication across different realms (domains) through cross-realm trust. When a user in CORP.EXAMPLE.COM needs to access a service in PARTNER.EXAMPLE.COM:

  1. The user's KDC issues a referral TGT encrypted with a shared inter-realm key.
  2. The user presents this referral TGT to the partner realm's KDC.
  3. The partner KDC issues a service ticket for the requested service.

In Active Directory, cross-realm trusts can be:

Clock Synchronization

Kerberos is extremely sensitive to clock differences between clients, services, and the KDC. By default, AD allows a maximum clock skew of 5 minutes. If clocks are out of sync beyond this threshold, authentication fails with a KRB_AP_ERR_SKEW error.

This is a security feature, not a limitation. Timestamps in authenticators prevent replay attacks — an attacker who captures an authenticator cannot replay it because it will have expired by the time they try. But it means NTP (Network Time Protocol) is critical infrastructure for Kerberos. In AD environments, the PDC Emulator is the authoritative time source, and all domain members synchronize their clocks with it.

Kerberos vs. Other Authentication Protocols

Kerberos and Network Infrastructure

Kerberos depends on several infrastructure components for correct operation:

Relevant RFCs

See It in Action

The networks that power Active Directory and Kerberos infrastructure are routed via BGP. Explore them using the god.ad BGP Looking Glass:

See BGP routing data in real time

Open Looking Glass
More Articles
How TLS/HTTPS Works: Securing the Internet's Traffic
Certificate Transparency: How CT Logs Secure the Web's PKI
How Firewalls Work: Packet Filtering, Stateful Inspection, and Beyond
What is Cross-Site Scripting (XSS)?
What is Cross-Site Request Forgery (CSRF)?
What is Server-Side Request Forgery (SSRF)?