Skip to content

Back to the category index / Back to the command index

Creates Golden or Silver Tickets from SIDs, groups, and keys, or modifies an existing ticket and PAC and saves the result as a ccache file.

ItemDetails
Implementationexamples/ticketer.py
CategoryKerberos / ticket handling
Size1,189 lines
DistributionInstalled as a script through scripts=examples/*.py in setup.py

Run python examples/ticketer.py -h for the current option definitions.

ArgumentDescription
targetUsername for the new ticket
-spnSPN of the target service for a Silver Ticket; if omitted, create a Golden Ticket
-requestRequest a ticket from the domain and clone it, changing only the supplied information; requires -user
-domainFully qualified domain name (for example, contoso.com); required
-domain-sidSID of the target domain for which the ticket is generated; required
-aesKeyAES key for signing the ticket (128 or 256 bits)
-nthashNT hash for signing the ticket
-keytabRead SPN keys from a keytab file (Silver Ticket only)
-groupsComma-separated list of groups for the user (default: 513, 512, 520, 518, 519)
-user-idUser ID for the ticket (default: 500)
-extra-sidComma-separated list of ExtraSids to include in the ticket PAC
-extra-pacAdd extra PAC information (UPN_DNS) to the ticket
-old-pacUse the old PAC structure, excluding PAC_ATTRIBUTES_INFO and PAC_REQUESTOR
-durationHours until the ticket expires (default: 2436510); ignored with -request, which retains the KDC-issued lifetime
-tsAdd a timestamp to each log message
-debugEnable debug output
-userDomain and username to use with -request; they may differ from the target domain and username
-passwordPassword for the domain and username
-hashesNTLM hashes in LMHASH:NTHASH format
-dc-ipDomain controller IP address; if omitted, use the domain name (FQDN) specified in the target parameter
-impersonateFor a Sapphire Ticket, impersonate this username through S4U2Self+U2U to request a service ticket and extract its PAC for the new ticket

The tool validates keytab, password, hash, AES key, and domain information, then builds a basic ticket and PAC buffers. With -request, it obtains a KDC response as a template. After applying validation information, UPN/DNS, attributes, requestor information, and additional SIDs, it signs the PAC checksums and signs and encrypts the ticket’s encrypted part according to the enctype, then passes it to saveTicket().

This command does more than request a normally issued ticket from the KDC: it builds and signs the ticket and PAC on the client side. createBasicTicket() creates the AS-REP/TGS-REP structure and EncTicketPart, while createBasicPac() places PAC buffers for validation information, client information, checksum placeholders, and other data. It converts the domain SID, user RID, and group RIDs into authorization data here.

customizeTicket() applies groups, extra SIDs, UPN/DNS, requestor information, PAC attributes, and lifetime settings. With -request, it uses an existing KDC response as a template and retains KDC-issued PAC_REQUESTOR and PAC_ATTRIBUTES when conditions allow. If those values cannot be extracted, it falls back to generated values. This can cause validation to fail on a patched KDC. Adding a PAC buffer changes offsets and alignment, so the directory’s sizes and offsets must be recalculated as well as its contents.

signEncryptTicket() first calculates the PAC checksum fields using the prescribed values. It signs them in the required order of server and KDC checksum dependencies, then encrypts the ticket’s encrypted part with the service or krbtgt key and the key usage. RC4 and AES differ in key size, checksum algorithm, and cipher profile. Finally, it saves a ccache containing the session key so a later client can use the generated ticket.

SymbolLocationWhere to trace its responsibility
TICKETER90__init__(), getFileTime(), getPadLength(), getBlockLength(), loadKeysFromKeytab(), createBasicValidationInfo(), createBasicPac(), createUpnDnsPac(), createAttributesInfoPac(), createRequestorInfoPac(), createBasicTicket(), getKerberosS4U2SelfU2U(), and others
ModuleMain names used
impacketversion
impacket.dcerpc.v5.dtypesRPC_SID, SID
impacket.dcerpc.v5.ndrNDRULONG
impacket.dcerpc.v5.samrGROUP_MEMBERSHIP, NULL, SE_GROUP_ENABLED, SE_GROUP_ENABLED_BY_DEFAULT, SE_GROUP_MANDATORY, USER_DONT_EXPIRE_PASSWORD, USER_NORMAL_ACCOUNT
impacket.exampleslogger
impacket.krb5.asn1AD_IF_RELEVANT, AP_REQ, AS_REP, Authenticator, AuthorizationData, ETYPE_INFO2, EncASRepPart, EncTGSRepPart, EncTicketPart, PA_FOR_USER_ENC, TGS_REP, TGS_REQ, Ticket, seq_set, seq_set_iter
impacket.krb5.constantsApplicationTagNumbers, AuthorizationDataType, ChecksumTypes, EncryptionTypes, KERB_NON_KERB_CKSUM_SALT, PreAuthenticationDataTypes, PrincipalNameType, ProtocolVersionNumber, TicketFlags, encodeFlags
impacket.krb5.keytabKeytab
impacket.krb5.cryptoEnctype, Key, _AES256CTS, _HMACMD5, _enctype_table, get_kerberos_key_for_enctype, string_to_key
impacket.krb5.pacKERB_SID_AND_ATTRIBUTES, KERB_VALIDATION_INFO, PAC_ATTRIBUTES_INFO, PAC_ATTRIBUTE_INFO, PAC_CLIENT_INFO, PAC_CLIENT_INFO_TYPE, PAC_LOGON_INFO, PAC_PRIVSVR_CHECKSUM, PAC_REQUESTOR, PAC_REQUESTOR_INFO, PAC_SERVER_CHECKSUM, PAC_SIGNATURE_DATA, PAC_UPN_DNS_INFO, PKERB_SID_AND_ATTRIBUTES_ARRAY, UPN_DNS_INFO_FULL, VALIDATION_INFO
impacket.krb5.typesKerberosTime, Principal, Ticket
impacket.krb5.kerberosv5getKerberosTGS, getKerberosTGT, sendReceive
impacket.krb5constants, pac
impacket.winregistryhexdump
impacket.krb5.ccacheCCache
Import nameDistribution packageImport path and declaration status
pyasn1pyasn1Imported directly; declared
sixsixImported directly; declared

Output, side effects, and required privileges

Section titled “Output, side effects, and required privileges”
  • The tool primarily makes queries and authentication attempts. Frequent runs can affect audit logs, account lockouts, and target load.
  • Options may create or update local files. Check how existing files are handled and the permissions on output containing secrets.
  • On failure, use protocol status codes to determine whether name resolution, connection, authentication, service state, or permissions caused the stop.

The code depends on krb5.asn1, constants, crypto, pac, keytab, NDR/SID, and pyasn1. The create, customize, sign, and save stages in TICKETER are the main extension points. PAC buffer offsets and the signing order are part of the wire contract.