Skip to content

Back to the Category Index / Back to the Command Index

Handles TGS requests, S4U2self/S4U2proxy, U2U, and ticket renewal, saving the resulting service ticket to a ccache.

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

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

ArgumentDescription
identity[domain/]username[:password]
-spnTarget service SPN (service/server) for the requested service ticket.
-altserviceNew service name/SPN to set in the ticket.
-dmsaUse delegated managed service accounts (DMSA).
-impersonateUsername to impersonate through S4U2self when requesting a service ticket; this works only if the supplied identity may delegate to the specified SPN.
-additional-ticketInclude a forwardable service ticket in an S4U2proxy request for RBCD plus Kerberos-only constrained delegation.
-tsAdd timestamps to log output.
-debugEnable debug logging.
-u2uRequest a user-to-user ticket.
-selfPerform only S4U2self, without S4U2proxy.
-force-forwardableForce the S4U2self service ticket to be forwardable. For best results, supply -hashes and -aesKey for the specified identity. This can impersonate protected users and bypass “Kerberos-only” constrained delegation restrictions; see CVE-2020-17049.
-renewSet the RENEW ticket option to renew the TGT used for authentication. Set -spn to krbtgt/DOMAINFQDN.
-hashesNTLM hashes in LMHASH:NTHASH format.
-no-passSkip the password prompt (useful with -k).
-kUse Kerberos authentication. Read credentials from the ccache (KRB5CCNAME) based on the target; fall back to command-line credentials if none are valid.
-aesKey128- or 256-bit AES key for Kerberos authentication.
-dc-ipDomain controller IP address. Defaults to the domain (FQDN) in identity.

Related technology: TGS, S4U2self/S4U2proxy, U2U, and PAC in Kerberos. S4U is handled in this file, rather than by getKerberosTGS.

The command obtains a TGT from a password, hash, AES key, or existing ccache, then follows the ordinary TGS, impersonation, additional-ticket, dMSA, or renewal path according to the options. It validates the KDC response, applies adjustments such as -altservice where needed, and writes a ccache through saveTicket().

This command brings several service-ticket acquisition paths into one CLI. The ordinary path prepares a TGT and its session key and sends a TGS-REQ for the target SPN. It uses a cached TGT only if the requested username and domain match; otherwise, it warns and requests a new TGT. With -impersonate, S4U2self obtains an evidence ticket representing another user’s identity, then S4U2proxy exchanges it for the final service ticket if needed.

For S4U2proxy, the evidence ticket, delegated target SPN, PAC options, and ticket flags together determine the KDC’s authorization decision. -additional-ticket uses an externally supplied evidence ticket; -u2u uses another ticket’s session key; -renew extends the lifetime of a renewable ticket. These paths use different ASN.1 request fields and key usages, so they are not forced into one generic TGS-request function.

The command checks the response’s client and service principals, flags, session key, and encryption type before creating a CCache credential. -altservice changes the service-principal representation before saving, but does not change the key of the already encrypted ticket. For flag changes such as -force-forwardable, first verify that a key is available to decrypt and re-encrypt the ticket’s encrypted part.

SymbolLocationEntry Point for Tracing Behavior
GETST81__init__(), saveTicket(), doS4U2ProxyWithAdditionalTicket(), doS4U(), run()
ModuleMain Names Used
impacketversion
impacket.exampleslogger
impacket.examples.utilsparse_identity
impacket.krb5ccache, constants, crypto, types
impacket.krb5.asn1AP_REQ, AS_REP, Authenticator, EncTGSRepPart, EncTicketPart, KERB_DMSA_KEY_PACKAGE, PA_FOR_USER_ENC, PA_PAC_OPTIONS, PA_S4U_X509_USER, S4UUserID, TGS_REP, TGS_REQ, Ticket, seq_set, seq_set_iter
impacket.krb5.ccacheCCache, Credential
impacket.krb5.cryptoCksumtype, Enctype, Key, _AES256CTS, _HMACMD5, _enctype_table, _get_checksum_profile, string_to_key
impacket.krb5.constantsApplicationTagNumbers, TicketFlags, encodeFlags
impacket.krb5.kerberosv5getKerberosTGS, getKerberosTGT, sendReceive
impacket.krb5.typesKerberosTime, Principal, Ticket
impacket.ntlmcompute_nthash
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.
  • Depending on options, creates or updates a local file. Check how existing files are handled and the permissions on output containing secrets.
  • 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 / constants / crypto / kerberosv5 / ccache, pyasn1, and NT-hash helpers. Its main entry points are GETST.run(), doS4U(), and doS4U2ProxyWithAdditionalTicket(). Preserve the relationship between ticket flags and session keys.