Alternate Authentication Material
PRACTICE ! PRACTICE ! PRACTICE !
By alternate authentication material, we refer to any piece of data that can be used to access a Windows account without actually knowing a user's password itself
This is possible because of how some authentication protocols used by Windows networks work
Pass The Hash Attacks
Extracting credentials from a host where we have attained administrative privileges (by using mimikatz), we might get clear-text passwords or hashes that can be easily cracked - If we aren't lucky enough we will end up with non-cracked NTLM password hashes
Although it may seem we can't really use those hashes, the NTLM challenge sent during authentication can be responded to just by knowing the password hash
This 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 LSASS memory
Extracting NTLM hashes from local SAM
This method will ONLY allow you to get hashes from local users on the machine
No domain user's hashes will be available
Extracting NTLM hashes from LSASS memory
This method will let you extract any NTLM hashes for local users and any domain user that has recently logged onto the machine
We can then use the extracted hashes to perform a PtH attack by using mimikatz to inject an access token for the victim user on a reverse shell
Notice we used
token::revert
to re-establish our original token privileges, as trying to pass-the-hash with an elevated token won't work
This would be the equivalent of using
runas /netonly
but with a hash instead of a password and will spawn a new reverse shell from where we can launch any command as the victim user
Passing the Hash Using Linux
Connect to RDP using PtH
Connect via psexec using PtH
Note: Only the linux version of psexec support PtH.
Connect to WinRM using PtH
Pass The Ticket Attacks
Sometimes it will be possible to extract Kerberos tickets and session keys from LSASS memory using mimikatz
The process usually requires us to have SYSTEM privileges on the attacked machine
Notice that if we only had access to a ticket but not its corresponding session key, we wouldn't be able to use that ticket; therefore, both are necessary
Mimikatz can extract any TGT or TGS available from the memory of the LSASS process, most of the time, we'll be interested in TGTs as they can be used to request access to any services the user is allowed to access
At the same time, TGSs are only good for a specific service - Extracting TGTs will require us to have administrator's credentials, and extracting TGSs can be done with a low-privileged account
Once we have extracted the desired ticket, we can inject the tickets into the current session with the following command
Injecting tickets in our own session doesn't require administrator privileges - After this, the tickets will be available for any tools we use for lateral movement
To check if the tickets were correctly injected, you can use the klist command
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, RC4, AES128 or AES256
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 memory by using mimikatz
Depending on the available keys, we can run the following commands on mimikatz to get a reverse shell via Pass-the-Key
If we have the RC4 hash
Notice that when using RC4, the key will be equal to the NTLM hash of a user - This means that if we could extract the NTLM hash, 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)
If we have the AES128 hash
If we have the AES256 hash
Last updated