Validate a user's password using the hash?

荒凉一梦 提交于 2019-12-06 01:53:19

If you have a domain controller you can talk kerberos protocol and send the key derived from the password to verify user identity. Unfortunately although the malicious program cannot derive the original password from the key it still can still your hash and use it to obtain domain credentials on behalf of the user.

Look here to figure out how to derive the key from the password

http://www.opensource.apple.com/source/Heimdal/Heimdal-172.18/kuser/kinit.c

By the way, Kerberos doesn't use plain salted hashes of the password. The actual Key Generating Function is bit more involved, this is because the passphrase itself doesn't have enough entropy to create unguessable keys. Remember that kerberos should be resilient to eavesdropping attacks.

You really don't want to store the Windows password hash, because as has been pointed out that hash can be used to impersonate the user if a domain controller is present. In effect, knowing the actual key in Kerberos is as bad as knowing the password for an attacker. Instead, what you should do is salt the password with a different salt than Windows would use and store that. I'd recommend looking for an implementation of a good password hash like PBKDF2 and using that. See Wikipedia's list of implementations. For information on what Kerberos does for salting passwords see RFC 3962. Windows uses that process for AES, and uses a different process for NTLM and for RC4 Kerberos.

I'm reasonably sure that there is no public API exposed to compare Kerberos salted passwords. I am less familiar with the NTLM APIs.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!