Skip to main content

Kerberos Protocol

Impacket provides comprehensive Kerberos 5 support for authentication against Windows Active Directory environments, including ticket management, encryption, and advanced features like S4U2Self/S4U2Proxy.

Overview

The Kerberos implementation is located in impacket/krb5/ and includes:
  • Ticket operations - TGT/TGS request and parsing
  • Credential cache - CCache file format support
  • Encryption - RC4-HMAC, AES128/256-CTS-HMAC-SHA1
  • PAC parsing - Privilege Attribute Certificate
  • GSSAPI - Generic Security Services API

Kerberos Flow

Kerberos uses tickets for authentication: clients request a TGT (Ticket Granting Ticket) from the KDC, then use it to request service tickets (TGS) for specific services.

Basic Authentication

Request TGT

From kerberosv5.py:97-330, requesting a TGT:

Request Service Ticket (TGS)

Credential Cache (CCache)

Impacket supports reading and writing Kerberos credential caches.

Load from CCache

Extract TGT/TGS from CCache

Save to CCache

Encryption Types

Kerberos supports multiple encryption types.

Supported Ciphers

Using AES Keys

Pass-the-Hash (RC4)

GSSAPI Integration

Impacket uses GSSAPI for Kerberos authentication in protocols.

SMB with Kerberos

LDAP with Kerberos

RPC with Kerberos

PAC (Privilege Attribute Certificate)

The PAC contains authorization data in Kerberos tickets.

Parse PAC

Advanced Techniques

Pass-the-Ticket

Kerberoasting

AS-REP Roasting

Error Handling

Kerberos errors are returned as KRB-ERROR messages. Common errors include clock skew, pre-auth required, and invalid credentials.

Complete Example: Ticket Dumper

Keytab Files

References

  • Source: impacket/krb5/
  • RFC 4120: Kerberos V5 Protocol
  • [MS-KILE]: Kerberos Protocol Extensions
  • [MS-PAC]: Privilege Attribute Certificate