Skip to content

Back to the Category Index / Back to the Command Index

Uses S4U2self and U2U exchanges to obtain a target user’s PAC and display the contents of each buffer.

ItemDetails
Implementationexamples/getPac.py
CategoryKerberos / Ticket Handling
Size321 lines
DistributionInstalled as a script through scripts=examples/*.py in setup.py

Check python examples/getPac.py -h for the current option definitions.

ArgumentDescription
credentialsdomain/username[:password]; valid domain credentials for retrieving the target user’s PAC.
-targetUserUser whose PAC will be retrieved (required).
-debugEnable debug logging.
-tsAdd timestamps to log output.
-hashesNTLM hashes in LMHASH:NTHASH format.

The command obtains a TGT with the supplied credentials and builds a TGS request containing PA-FOR-USER for the target user. It decrypts the returned ticket’s encrypted part, extracts PACTYPE from authorization data, and parses logon information, client information, signatures, and UPN/DNS information by buffer type.

The PAC is stored in a ticket’s authorization data, usually inside the EncTicketPart encrypted with the service key. This command combines S4U2self and user-to-user so the KDC issues a ticket that the caller can decrypt to inspect its PAC.

It first obtains the service account’s TGT, then builds an S4U2self TGS-REQ containing a PA-FOR-USER checksum. In U2U, it includes an additional ticket in the request so the KDC can return a service ticket protected with the session key. It decrypts the response with the correct key usage and extracts AD-IF-RELEVANT, then PACTYPE, from EncTicketPart.authorization-data.

The PAC consists of a buffer directory and variable-length payloads. printPac() dispatches logon information, client information, server/KDC checksums, and UPN/DNS information to NDR structures by type. The parser must skip unknown buffers, keep offsets and sizes within the ticket, and avoid treating signature values as ordinary data.

SymbolLocationEntry Point for Tracing Behavior
S4U2SELF53__init__(), printPac(), dump()
ModuleMain Names Used
impacketversion
impacket.dcerpc.v5.rpcrtTypeSerialization1
impacket.exampleslogger
impacket.examples.utilsparse_identity
impacket.krb5constants
impacket.krb5.asn1AD_IF_RELEVANT, AP_REQ, AS_REP, Authenticator, EncTicketPart, PA_FOR_USER_ENC, TGS_REP, TGS_REQ, Ticket, seq_set, seq_set_iter
impacket.krb5.cryptoEnctype, Key, _HMACMD5, _enctype_table
impacket.krb5.kerberosv5getKerberosTGT, sendReceive
impacket.krb5.pacKERB_VALIDATION_INFO, PACTYPE, PAC_CLIENT_INFO, PAC_CLIENT_INFO_TYPE, PAC_INFO_BUFFER, PAC_PRIVSVR_CHECKSUM, PAC_SERVER_CHECKSUM, PAC_SIGNATURE_DATA, PAC_UPN_DNS_INFO, UPN_DNS_INFO
impacket.krb5.typesKerberosTime, Principal, Ticket
impacket.winregistryhexdump
Import NameDistribution PackageUsage / Declaration Status
pyasn1pyasn1Imported directly; declared dependency
sixsixImported directly; declared dependency

Output, Side Effects, and Required Privileges

Section titled “Output, Side Effects, and Required Privileges”
  • Primarily queries and authentication attempts. Repeated runs can affect audit logs, account lockouts, and target load.
  • On failure, use protocol status to determine whether name resolution, connection, authentication, service state, or permissions stopped the operation.

This command depends on krb5.asn1 / crypto / pac / types, pyasn1, and NDR serialization. S4U2SELF.dump() handles the exchange, while printPac() dispatches buffers.