Skip to content

Pass the key

Theory

The Kerberos authentication protocol works with tickets in order to grant access. A Service Ticket (ST) can be obtained by presenting a TGT (Ticket Granting Ticket). That prior TGT can be obtained by validating a first step named "pre-authentication" (except if that requirement is explicitly removed for some accounts, making them vulnerable to ASREProast).

The pre-authentication requires the requesting user to supply its secret key (DES, RC4, AES128 or AES256) derived from the user password. An attacker knowing that secret key doesn't need knowledge of the actual password to obtain tickets. This is called pass-the-key.

Kerberos offers 4 different key types: DES, RC4, AES-128 and AES-256.

  • When the RC4 etype is enabled, the RC4 key can be used. The problem is that the RC4 key is in fact the user's NT hash. Using a an NT hash to obtain Kerberos tickets is called overpass the hash.
  • When RC4 is disabled, other Kerberos keys (DES, AES-128, AES-256) can be passed as well. This technique is called pass the key. In fact, only the name and key used differ between overpass the hash and pass the key, the technique is the same.

Practice

The Impacket script getTGT (Python) can request a TGT (Ticket Granting Ticket) given a password, hash (LMhash can be empty), or aesKey. The TGT will be saved as a .ccache file that can then be used by other Impacket scripts.

bash
# with an NT hash (overpass-the-hash)
getTGT.py -hashes 'LMhash:NThash' $DOMAIN/$USER@$TARGET

# with an AES (128 or 256 bits) key (pass-the-key)
getTGT.py -aesKey 'KerberosKey' $DOMAIN/$USER@$TARGET

Once a TGT is obtained, the tester can use it with the environment variable KRB5CCNAME with tools implementing pass-the-ticket.

An alternative to requesting the TGT and then passing the ticket is using the -k option in Impacket scripts. Using that option allows for passing either TGTs or STs. Example below with secretsdump.

bash
secretsdump.py -k -hashes 'LMhash:NThash' $DOMAIN/$USER@$TARGET

Resources

https://blog.notso.pro/2020-05-09-offops-in-ad-1/

http://blog.gentilkiwi.com/securite/mimikatz/overpass-the-hash

https://blog.stealthbits.com/how-to-detect-overpass-the-hash-attacks/