Kerberos Basics
Kerberos authentication involves three main components:- KDC (Key Distribution Center): Domain Controller that issues tickets
- TGT (Ticket Granting Ticket): Initial ticket obtained after authentication
- Service Ticket (TGS): Ticket for accessing specific services
Authentication Flow
1
Request TGT
Client sends AS-REQ (Authentication Service Request) to the KDC with user credentials
2
Receive TGT
KDC validates credentials and returns TGT in AS-REP (Authentication Service Reply)
3
Request Service Ticket
Client sends TGS-REQ (Ticket Granting Service Request) with TGT to access a service
4
Receive Service Ticket
KDC returns service ticket in TGS-REP
5
Access Service
Client presents service ticket to target service via AP-REQ
Requesting a TGT
With Password
With NT Hash (Pass-the-Hash)
With AES Key (Pass-the-Key)
Saving and Loading Tickets
Save TGT to ccache File
Load TGT from ccache File
Use Tickets with Scripts
Requesting Service Tickets
Request TGS for Specific Service
Using getTGT.py Script
Using getST.py Script
Kerberos Delegation
S4U2Self: Impersonation
Request a service ticket on behalf of another user:S4U2Proxy: Constrained Delegation
Request ticket for a different service:Full S4U Example with getST.py
Ticket Manipulation
Alter Service Name (SPN)
Change the target service in a ticket:Golden Ticket Creation
Silver Ticket Creation
Working with ccache Files
Inspect Ticket Contents
Convert Ticket Formats
Programmatic Ticket Inspection
Kerberos Authentication Modes
Authentication with Password
Authentication with ccache
Encryption Types
Kerberos supports multiple encryption algorithms:Encryption Type Notes:
- RC4-HMAC: Uses NT hash directly, compatible with older systems
- AES128/AES256: More secure, requires AES keys
- Modern Windows systems prefer AES256
- RC4 is being deprecated but still widely supported
Common Kerberos Errors
KDC_ERR_PREAUTH_FAILED
Invalid credentials:KDC_ERR_C_PRINCIPAL_UNKNOWN
User doesn’t exist:KDC_ERR_S_PRINCIPAL_UNKNOWN
Service doesn’t exist:Practical Examples
Example 1: Complete Authentication Flow
Example 2: Ticket Renewal
Security Considerations
See Also
Pass-the-Ticket
Reuse Kerberos tickets for authentication
NTLM Auth
Alternative authentication with NTLM