I am currently working on a solution to at least try to implement a working/modern "change password" option to chntpw.
First of all: Windows uses this format in its hive file:
root@rescue /mnt/Windows/System32/config # samdump2 SYSTEM SAM
Administrator:500:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
*disabled* Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
*disabled* :503:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
*disabled* WDAGUtilityAccount:504:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
This consists of: USERNAME:USER-ID:LM-HASH:NTLM-HASH
At least that is what I am told it would be.
the LM hash is indeed correct: It corresponds to the hypothetical password .Testpassword123
However running online NTLM hash generatores does not yield in the hash that is stored in the SAM hive file:
31d6cfe0d16ae931b73c59d7e0c089c0
but instead the online hash generator:
236DD9FC77E26DFE29978024603800AE
The version of windows used in this case is Windows Server 2019. But I am not sure, if that does matter indeed. I guess, this is the reason, why changing the password does not work in chntpw (At least it never did for me).
What really is odd, that after deleting the password and setting it again, the hash is still 31d6cfe0d16ae931b73c59d7e0c089c0
.
So I would think, that there is no "salt" involved regarding the system time. But something else is at play here.
Does anyone know, how to get the NTLM hash, that is actually dumped from samdump2 in this example? Without getting this to work, I guess there is no chance to actually implement this password change feature into chntpw ever.
There is a lot of conflicting and especially incomplete (unofficial) documentation in this regard.
So how would one build such a hash, that actually is valid for the input of the password as in this example.