Windows PtT

About Kerberos

Simply put, Kerberos is an authentication system that works with the concept of Tickets. Instead of asking the domain-joined user each time for a password to access specific services, It presents a ticket for each server they asked for, without the need to provide their password every time. This works with two types of tickets:

  • TGT: Ticket Granting Ticket which is the first ticket we obtain on a Kerberos system. It permits the client to obtain additional Kerberos tickets or TGS.

  • TGS: Ticket Granting Service, which is requested by users who want to access specific service. It allows services to verify the user's identity. The process is as follows:

  1. The user requests a TGT.

  2. They must authenticate to the DC by combining a timestamp encryption and his password hash.

  3. The DC then decrypts the timestamp and verifies the identity.

  4. Upon success the DC sends back a TGT to the user for future requests.

  5. User no longer have to verify their identity with their password.

  6. If the user wants to access MSSQL database, they request a TGS to the Key Distribution Center (KDC) while presenting their TGT.

  7. The KDC will give the TGs to the MSSQL database server for authentication.


Harvesting Kerberos Tickets

Method 1: Mimikatz sekurlsa::tickets module

This will print out the result and saves it to files with a .kirbi extension. User tickets will be saved with the following pattern : [randomvalue]-username@service-domain.local.kirbi.

While the tickets that end with $ correspond to the computer account.

Method 2: Rubeus dump module

This method outputs the tickets with base64 encoding, we'll use /nowrap` for easier copy/paste.

Note: To collect all tickets we need to execute Mimikatz or Rubeus as an administrator.


Forging our own tickets(Overpass the Hash/PtKey)

While the traditional Pass the Hash technique doesn't involve Kerberos, but instead relies on an NTLM hash, Overpass the Hash/ Pass the Key converts a hash/key for a domain-joined user into a full TGT. So, we'll be dumping the user's Kerberos encryption keys to get the hashes we want.

Step1: Dump all user's Kerberos encryption keys with Mimikatz sekurlsa::ekeys module

Step2: Overpass the Hash

Note: Modern Windows domains (functional level 2008 and above) use AES encryption by default in normal Kerberos exchanges. If we use a rc4_hmac (NTLM) hash in a Kerberos exchange instead of an aes256_cts_hmac_sha1 (or aes128) key, it may be detected as an "encryption downgrade."

Method 1: Mimikatz + local admin privileges

This will spawn another cmd.exe window in which we can request anything in the context of the target user.

Method2: Rubeus with non-admin user


Performing PtT Attack

At this point we need ===Valid Kerberos Tickets=== either we dumped them like we did in [[#Harvesting Kerberos Tickets]] or through [[#Forging our own tickets(Overpass the Hash/PtKey)]].

Method 1: Rubeus asktgt module + hash + /ptt flag

The idea is the import the ticket in current session. Upon success, it'll print ==Ticket successfully imported==.

Method 2: Rubeus + .kirbi file obtained from Mimikatz

Method 3: Rubeus + base64-encoded Ticket

We can also use the base64-encoded ticket obtained from Rubeus or base664 encode the Mimikatz tickets using :

And then use Rubeus:

Which grants us access as the target user:

Method 4: Mimikatz

Which grants us access to whatever the target user has access to:

Note: Instead of opening mimikatz.exe with cmd.exe and exiting to get the ticket into the current command prompt, we can use the Mimikatz module misc to launch a new command prompt window with the imported ticket using the misc::cmd command.

Method 5: PS Remoting(5985/5986)

To create a PowerShell Remoting session on a remote computer, you must have administrative permissions, be a member of the Remote Management Users group, or have explicit PowerShell Remoting permissions in your session configuration.

5.1 Using Mimikatz (Local Admin required)

Now we can spawn a PS session in the target host:

This is used for ===Lateral Movement===.

5.2 Using Rubeus (No Admin privileges required)

Rubeus has the option createnetonly, which creates a sacrificial process/logon session (Logon type 9arrow-up-right). The process is hidden by default, but we can specify the flag /show to display the process, and the result is the equivalent of runas /netonly. This prevents the erasure of existing TGTs for the current logon session.

Step 1: Create a Sacrificial Process

That will spawn a new cmd window through which we can request a new TGT with /ptt using Rubeus, import it to our new session and then connect to that target DC using PSRemoting.

With the ticket successfully imported:

Doing it all with one tool:

Rubeus only

Step 1: Harvest Kerberos tickets from current session:

Step 2:

Which grants us access as the target user:

Mimikatz Only

Check [This](Pass the Ticket - Windows#Method 4 Mimikatz) and [this](#Step1 Dump all user's Kerberos encryption keys with Mimikatz sekurlsa ekeys module).

Last updated