Use of Alternate Authentication Material

The title refers to any piece of data that can be used to access a Windows account without actually knowing a user's password itself.


NTLM Authentication

The process here is simply a client wanting to access a server. The key here is the NTLM response where the client's NTLM password hash with the challenge is sent to the server for verification.


Pass-the-Hash

Pass-the-hash simply means passing the hash as it is. It also means we can authenticate without requiring the plaintext password to be known. Instead of having to crack NTLM hashes, if the Windows domain is configured to use NTLM authentication, we can Pass-the-Hash (PtH) and authenticate successfully.

To extract NTLM hashes, we can either use Mimikatz to read the local SAM or extract hashes directly from Local Security Authority Subsystem Service(LSASS) memory.

Extracting NTLM hashes from local SAM:

Extracting NTLM hashes from LSASS memory:

After extracting the NTLM hashes we can pass it using some of the methods below:

RDP:

Psexec:

WinRM


Kerberos Authentication

1

AS-REQ (Authentication Service Request)

The client requests a Ticket Granting Ticket (TGT) from the Key Distribution Center (KDC)

2

AS-REP (Authentication Service Reply)

The KDC verifies the client and sends back an encrypted TGT & session key

3

TGS-REQ (Ticket Granting Service Request)

The client sends the encrypted TGT to the TGS with Service Principal Name (SPN) of the service that client wants to access

4

TGS-REP (Ticket Granting Service Reply)

The KDC verifies the TGT and sends a Service Ticket with a session key

5

AP-REQ (Application Service Request)

The client requests the services and sends the session key to prove access

6

AP-REP (Application Service Reply)

The service grants access


Golden Ticket vs Silver Ticket

  • Can access any Kerberos service and impersonate any user (Full domain compromise)

  • Dump the KRBTGT account NTLM hash

  • Forge the TGT

Dumping the krbtgt hash:

lsadump::lsa /inject /name:krbtgt

Creating Golden Ticket:

Kerberos::golden /user:administrator /domain:<DOMAIN.local> /sid: <DOMAIN_SID>: /krbtgt:<KRBTGT_HASH> /id:500

***Note: The KRBTGT account is used by the KDC to encrypt and sign TGTs


Pass-the-Ticket

It is a type of Kerberos attack where the attacker reuses a valid TGT or TGS to access the system without knowing the user’s password. It can be extracted from the LSASS memory using Mimikatz:

Once we have extracted the desired ticket, we can inject the tickets into the current session with the following command:

Check if the tickets were correctly injected using klist:


Overpass-the-hash / Pass-the-Key

This kind of attack is similar to PtH but applied to Kerberos networks.

When a user requests a TGT, they send a timestamp encrypted with an encryption key derived from their password. The algorithm used to derive this key can be either DES (disabled by default on current Windows versions), RC4, AES128 or AES256, depending on the installed Windows version and Kerberos configuration. If we have any of those keys, we can ask the KDC for a TGT without requiring the actual password, hence the name Pass-the-key (PtK).

We can obtain the Kerberos encryption keys from LSASS using Mimikatz:

We can run these commands to get a reverse shell via Pass-the-Key using nc64.exe

RC4 hash:

AES128 hash:

AES256 hash:

*** Bonus: RC4 keys are equal to the NTLM hash of a user, meaning we can use it to request a TGT as long as RC4 is one of the enabled protocols. This particular variant is usually known as Overpass-the-Hash (OPtH)



Task 3

Similar to the previous task, we need to move laterally from THMJMP2 to THMII but this time using the techniques above . Initial credentials are given (assume we captured with admin access). These credentials grant admin access allowing to use Mimikatz.

User: ZA.TRYHACKME.COM\t2_felicia.dean

Password: iLov3THM!


SSH to the credentials above

I am chossing to use the Pass-the-Hash (PtH) technique, I dumped the hash keys using Mimikatz

Find the target user which is t1_toby.beck

There are two available keys to use which is AES256 and RC4. I choose to pass the RC4 hash key. Before that start a listener first.

Pass the RC4 Hash

Callback received and the target's credentials are injected and loaded

Use Windows Remote Shell (winrs) to connect to the cmd of THMIIS

Successful pivot from THMJMP2 to THMIIS

Get flag

Last updated