最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Is bcrypt.compare vulnerable to timing attack - Stack Overflow

programmeradmin5浏览0评论

In Node.js web development I saw it as a mon practice to use bcrypt for hashing and parison of password. Is bcryptpare vulnerable to timing attack?

In Node.js web development I saw it as a mon practice to use bcrypt for hashing and parison of password. Is bcrypt.pare vulnerable to timing attack?

Share Improve this question asked Feb 25, 2016 at 7:31 adnan kamiliadnan kamili 9,4959 gold badges75 silver badges134 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8

Original post:

It depends on the implementation of the bcrypt module you're using. bcrypt itself is just a key derivation function and does not indicate how parison should be done. In theory, a bcrypt.pare function that pared hashes with a naive string === parison could leak information about the hash.

However, assuming you're referring to the most widely used bcrypt module for Node.js, the bcrypt.pare function is implemented using a timing safe CompareStrings function. This function always pares all characters in the hash before breaking, which prevents it from revealing where/when the parison failed.

Important update:

The bcrypt.pare function liked above is no longer timing safe, however this has been discussed in various places (for example here and here) and the consensus seems to be that this doesn't matter because bcrypt itself is not vulnerable to timing attacks:

One of the desired properties of a cryptographic hash function is preimage attack resistance, which means there is no shortcut for generating a message which, when hashed, produces a specific digest.

发布评论

评论列表(0)

  1. 暂无评论