Kerberos

Kerberos is a network authentication protocol designed to provide secure authentication for users and services in a distributed computing environment. It is widely used as the primary authentication mechanism in Windows Active Directory domains and many other network environments.

chevron-rightKerberos Terminologyhashtag

Key Distribution Center (KDC) The KDC, typically hosted on a Domain Controller, is responsible for managing cryptographic keys and granting access to network services. Two main components of the KDC are the Authentication Server and Ticket Granting Server.

Authentication Server (AS) The AS verifies the authenticating user's identity by checking their credentials. Once the user is authenticated, the AS generates a TGT encrypted with a secret key derived from the user's password.

Ticket Granting Server (TGS) A user presents their TGT to the TGS when they want to access a network service. The TGS decrypts the TGT using the TGS's master key, validates the user's identity, and gives the user an ST encrypted using the service's password.

Ticket Granting Ticket (TGT) A user's TGT is used to authenticate to the Ticket Granting Server in order to obtain a Service Ticket.

Service Ticket (ST) A user presents their ST to a service to authenticate and access its resources (sometimes confusingly referred to as TGS since the ST is stored inside the TGS-REP).

Privilege Attribute Certificate (PAC) The PAC contains information about the authenticated user and their privileges on the network. It is encrypted by either the KDC key (TGT) or the requested service account's key (ST), so the authenticated user cannot modify their own rights.

Service Principal Name (SPN) An SPN is a unique identifier for a service used in Kerberos Authentication.

Kerberos Authentication [Image From Attacking ADarrow-up-right]

Here is a quick high-level overview of how Kerberos authentication works:

  1. The client requests a TGT from the KDC by sending an AS_REQ.

    • If pre-authentication is required (default), the AQ_REQ includes a timestamp encrypted with the client's Kerberos key, which is derived from the user's password

  2. The KDC responds with an AS_REP.

    • Contains a TGT encrypted with the krbtgt account key and a session key encrypted with the client’s Kerberos key

    • The session key encrypted with the client's Kerberos key will be used by the client to securely communicate with the KDC when requesting additional tickets

  3. The client connects with a service and negotiates the authentication.

    • The application protocol (such as SMB, HTTP, LDAP, etc.) may use SPNEGO to negotiate authentication

  4. The client requests an ST from the KDC by sending a TGS_REQ.

    • The TGS_REQ includes the TGT, an authenticator encrypted with the TGT session key, and the SPN of the target service

  5. The KDC decrypts the TGT using the krbtgt key and responds with a TGS_REP.

    • The TGS_REP contains a service ticket encrypted with the service account's key and a client-service session key encrypted with the TGT session key.

  6. The client sends the ST to the service with an AP_REQ message.

    • The service decrypts the ST using its own key and obtains the client identity, session key, and PAC

  7. The service reads the PAc to determine the user's permissions.

  8. The target service sends an AP_REP to the client to confirm that it is the legitimate service.

circle-info

All Tickets contain a timestamp and a PAC for authentication and authorization purposes.

Kerberos Extensions

Kerberos extensions are additional features added to the standard Kerberos protocol that provide additional functionality, security, and flexibility. I'll talk about a few important ones here.

The PAC (Privilege Attribute Certificate) is a structure within Kerberos TGTs and STs that contains authorization data for a user, such as group memberships, user privileges, etc.

circle-info

The PAC can also contain the NTLM hashes of the authenticating user, allowing users to switch to NTLM authentication when the target server doesn't support Kerberos.

Last updated