为什么DPAPI在blob/key解密中使用SHA1?

问题描述 投票:0回答:0

据我所知,SHA1 不被视为安全的加密哈希函数。尽管如此,它似乎仍在 DPAPI 中使用。这可以从模拟 DPAPI 功能的 pypykatz 实现中看出。

https://github.com/skelsec/pypykatz

例如,SHA1用于blob解密中的密钥推导:https://github.com/skelsec/pypykatz/blob/master/pypykatz/dpapi/structures/blob.py

def decrypt(self, key, entropy = None):
        def fixparity(deskey):
            temp = b''
            for i in range(len(deskey)):
                t = (bin(deskey[i])[2:]).rjust(8,'0')
                if t[:7].count('1') %2 == 0:
                    temp+= int(t[:7]+'1',2).to_bytes(1, 'big')
                else:
                    temp+= int(t[:7]+'0',2).to_bytes(1, 'big')
            return temp
        
        key_hash = sha1(key).digest()
        session_key_ctx = hmac.new(key_hash, self.salt, ALGORITHMS_DATA[self.hash_algorithm][1])
        if entropy is not None:
            session_key_ctx.update(entropy)
        
        session_key = session_key_ctx.digest()

a) 我想知道他们没有使用像 SHA2 或 SHA3 这样更安全的哈希函数是不是有原因? b) 另外,它是否会造成我应该关注的漏洞?

我试图找到 Windows DPAPI 文档,但是似乎没有公开可用的此类文档。

windows security cryptography dpapi cryptographic-hash-function
© www.soinside.com 2019 - 2024. All rights reserved.