hashcat
hashcat copied to clipboard
Huawei/H3C/HP/Comware devices hash algorithms
Based on virtual appliance firmware analysis we have found the algorithm which is used to generate $h$6$
hash used by Huawei/H3C/HP devices. We'r not sure if it's worthy to implement in hashcat, but someone might find it handy even here.
Sample hash
can be found in HP documentation
plaintext: abc
hash: $h$6$4tWqOiqovcWddOKv$XyFMVgaE46fGiqsZEHbcr+BM/m9tDkvahDbqU7HoNrvmALk2u31z9c/tuUmX7IiQhWRwN5qoZquW82A8XYaDWA==
PoC
algorithm uses sha512(password + salt + password) scheme where password includes terminating null-byte
import hashlib
import base64
password = b"abc\0"
orighash = "$h$6$4tWqOiqovcWddOKv$XyFMVgaE46fGiqsZEHbcr+BM/m9tDkvahDbqU7HoNrvmALk2u31z9c/tuUmX7IiQhWRwN5qoZquW82A8XYaDWA=="
salt = orighash.split('$')[3].encode()
h = hashlib.new('sha512')
h.update(password)
h.update(salt)
h.update(password)
digest = h.digest()
computed = '$h$6$' + salt.decode() + '$' + base64.b64encode(digest).decode()
print(f"orighash {orighash}")
print(f"computed {computed}")
cracking can be emulated by supplying crafted hex wordlist from stdin with hash type 1700
@bodik you know some of PBKDF2(password, 256 key size, 5000 iterations, Sha256, salt) hash ? from some Huawei ONT/ONU? check this: https://hashcat.net/forum/thread-11881.html
Thanks to the work of 84634E1A607A, I would like to know, by the way, if a cipher starting with $c$3$ can be decrypted? For example ppp chap password or preshared-key pass-phrase.