repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
hash-capture.mdMarkdown176 lines11.5 KiBsource raw download

title: "Hash - Capture and Cracking" section: "Active Directory" sectionSlug: "active-directory" sourcePath: "docs/active-directory/hash-capture.md" sourceUrl: "https://github.com/swisskyrepo/InternalAllTheThings/blob/203bb0c0b290/docs/active-directory/hash-capture.md" sha: "203bb0c0b290" isIndex: false#

Hash - Capture and Cracking#

Hash Cracking Table#

Mode Hash type Generic hash format
3000 LM <LM_HASH>
1000 NT <NT_HASH>
5500 NetNTLMv1 / NetNTLMv1+ESS <USERNAME>::<DOMAIN>:<LM_RESPONSE>:<NTLM_RESPONSE>:<SERVER_CHALLENGE>
5600 NetNTLMv2 <USERNAME>::<DOMAIN>:<SERVER_CHALLENGE>:<NT_PROOF_STRING>:<NTLMV2_RESPONSE_BLOB>
2100 Domain Cached Credentials 2 $DCC2$<PBKDF2_ITERATIONS>#<USERNAME>#<DCC2_HASH>

LM Hash#

All hashes are not born equals, LM hash (LAN Manager hash) is an obsolete Windows password-hashing format. Here are the steps to reproduce the LM hashing method.

  1. Convert the password to uppercase.
  2. Pad or truncate it to exactly 14 characters.
  3. Split it into two independent 7-character halves.
  4. Convert each half into a DES key.
  5. Use each key to encrypt the fixed string.
  6. Concatenate the two 8-byte results.

LM hash can be cracked easily.

NT Hash#

NT hash might be cracked depending on the size of the password. However it is also possible to use it without breaking it, see the Hash - Pass the Hash page.

DCC2 Hash#

DCC2 is also called MSCache v2 or Domain Cached Credentials v2. Unlike NetNTLM challenge-response formats, it does not contain a domain, server challenge, or client response. It represents a locally cached domain credential verifier.

LmCompatibilityLevel#

LmCompatibilityLevel is a Windows security setting that determines the level of authentication protocol used between computers. It specifies how Windows handles NTLM and LAN Manager (LM) authentication protocols, impacting how passwords are stored and how authentication requests are processed. The level can range from 0 to 5, with higher levels generally providing more secure authentication methods.

reg query HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v lmcompatibilitylevel

Capturing Net-NTLMv1/NTLMv1 hashes#

Net-NTLMv1 (NTLMv1) authentication tokens are used for network authentication. They are derived from a challenge/response DES-based algorithm with the user's NT-hash as symetric keys.

:information_source: Coerce a callback using PetitPotam or SpoolSample on an affected machine and downgrade the authentication to NetNTLMv1 Challenge/Response authentication. This uses the outdated encryption method DES to protect the NT/LM Hashes.

Requirements:

Exploitation:

Cracking Net-NTLMv1/NTLMv1 hashes#

:warning: NetNTLMv1 with ESS / SSP (Extended Session Security / Security Support Provider) changes the final challenge by adding a new alea (!= 1122334455667788, so chargeable on crack.sh).

:warning: NetNTLMv1 format is login::domain:lmresp:ntresp:clientChall. If the lmresp contains a 0's-padding this means that the token is protected by ESS/SSP.

:warning: NetNTLMv1 final challenge is the Responder's challenge itself (1122334455667788) when there is no ESS/SSP. If ESS/SSP is enabled, the final challenge is the first 8 bytes of the MD5 hash from the concatenation of the client challenge and server challenge. The details of the algorithmic generation of a NetNTLMv1 are illustrated on the shuck.sh/generator.php and detailed in MISCMag#128.

:warning: If you get some tokens from other tools (OpenSecurityResearch/hostapd-wpe or moxie0/chapcrack) in other formats, like tokens starting with the prefix $MSCHAPv2$, $NETNTLM$ or $99$, they correspond to a classic NetNTLMv1 and can be converted from one format to another shuck.sh/converter.php.

Mitigations:

Capturing and cracking Net-NTLMv2/NTLMv2 hashes#

If any user in the network tries to access a machine and mistype the IP or the name, Responder will answer for it and ask for the NTLMv2 hash to access the resource. Responder will poison LLMNR, MDNS and NETBIOS requests on the network.

Crack the hashes with Hashcat / John The Ripper

john --format=netntlmv2 hash.txt
hashcat -m 5600 -a 3 hash.txt

References#