-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
6.8 Feasibility of time-based database brute-force attacks on websites #325
Comments
@lirantal and @ryzokuken |
In addition, I think we should use the standard node.js libraries. |
I think using |
@bmsdave Welcome aboard. Interesting and challenging topic, I remember when we wrote this piece of advice we checked the recommendations of most security institute and picked bcrypt not because he was the most secured one rather becuase he one top 3 in all list and the most popular one with very mature and maintained implementation. To what 'crypto' algo do you refer specifically as an alternative? @js-kyle Do you to handle this, me, together? |
I am sorry but this is not a room chat.
…On Sat, Jan 19, 2019 at 7:02 PM Yoni Goldberg ***@***.***> wrote:
@bmsdave <https://github.com/bmsdave> Welcome aboard.
Interesting and challenging topic, I remember when we wrote this piece of
advice we checked the recommendations of most security institute and picked
bcrypt not because he was the most secured one rather becuase he one top 3
in all list and the most popular one with very mature and maintained
implementation.
To what 'crypto' algo do you refer specifically as an alternative?
@js-kyle <https://github.com/js-kyle> Do you to handle this, me, together?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#325 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AYOcUyZZcLw23vdOblNPhHp0FB_VVKX1ks5vE0-xgaJpZM4aILYp>
.
|
Hi @i0natan! I'd say that using |
@i0natan |
@ryzokuken Got it, I frankly need to go through some docs to intelligently comment on this, will share my view in few days @bmsdave Welcome aboard. I suggest that we first discuss here and have a consent about the right recommendation. Then it could be great to have your PR. Do you have any specific view on this topic or basically agree with @ryzokuken ? |
@bmsdave welcome and appreciate your input on this. With that said, choosing scrypt over bcrypt for the sake of being API-complete with the built-ins in Node.js is a good discussiont o have. The crypto WG has been working quite a bit on improvements in that area and we can check into considering if that's a good advise now-days or not, but where-as bcrypt is a native module we can build into older Node.js version, choosing scrypt might mean that we are excluding users of older Node.js versions. |
@lirantal exactly my point. I keep scrypt over bcrypt just for the sake of keeping close to the core module, since AFAIK, there's no theoretical weakness in bcrypt.
Fair point, but since it was a semver-minor, IMO it must have landed on all currently supported versions for Node.js? |
Thank you all for participating in this interesting discussion. Frankly, my cryptographic understanding is not deep enough to technically vote for one or another. Both scrypt, bcrypt and argon seem to be recommended by reputable groups and the weaknesses of each seem like nitty-gritty corner cases that matter in a specific context. I also don't see a strong reason to favor one over the others because it's built-in - well-maintained packages (like bcrypt) can hold high standards like the node core and relying on 3rd party code (99%?) is the reality for most Node apps. Another reason not to recommend a single winner is compliance - US enterprises for examples are often obligated to conform to FIPS/NIST recommendation which is currently PBKDF2. Given that, I suggest recommending two or four based on the user context. Pasting from OWASP's recommendation though I would edit the text a bit to comply with the Node's eco-system:
|
FWIW, PBKDF2 is also exposed via the crypto module, further strengthening my case.
While what you say is very true, I'd like to make a special case for cryptography. I don't think it's a great practice to rely on third-party code so much for cryptography, especially in light of the recent controversy surrounding the security (or the lack thereof) of the ecosystem. |
Please please, I want to urge you to not try and dabble in adventures regarding security "bleeding edge" features, or making choices for the wrong reasons (compatible with Node.js apis). This is exactly the place where you don't want to be creative :-) I'll point out some references to put some context into this discussion:
This is not to say that one algorithm is superior over another. For example, argon2 may be the modern alternative to replace others that have been mentioned on this thread, but rather to say that I wouldn't drop everything and rush myself to use it just because it's "modern", or because it won a competition. TL;DR For the time being and until we learn of better reasons to adopt other password hashing functions I'd keep using bcrypt which has been battle-tested for 2 decades now with no known vulnerabilities, or PBKDF if needed for compliance reasons. |
❤️ that you pointed that out. I'm tackling all similar problems right now with https://github.com/ryzokuken/easy-crypto. |
That conservative, less-opinionated, approach resonates with me. Given that, why not include also scrypt in the list and let the user choose? |
@i0natan sounds fair. Better than skipping For the record, I think the two might just be equivalent security-wise, but I'd personally recommend |
I'll try my best to explain more about it. scrypt is superior to bcrypt in the way it's tied to a memory resource as well as a cpu resource (bcrypt is mainly just cpu), thus requiring more resources for the attacker. However, if you are generating or comparing a password, it's not necessarily an easy thing to let it run for 20 seconds to do that due to the nature of web concurrency and such. Due to that, you end up lowering the iteration count. When you do that however, scrypt's memory and cpu utilization are tied together and you end up stripping away the memory hardening that scrypt was superior for. This is not to take from scrypt being a good choice but why I'd not make that choice just because it is available as a core API. Side note, both Auth0 and Dropbox mentioned they use bcrypt to safeguard their user's passwords. Probably many others too. It actually occurred to me now that I don't know of anyone who uses scrypt so if you know I'd be happy to learn about it. |
@lirantal Great explanation. Based on all the feedback here, it seems that both bcrypt, scrypt and PBKDF are reputable enough to be recommended. If no obligations, I'll PR the change (or if anyone else here like to - please do) |
@i0natan if possible, I'd like to prepare a PR for this weekend. |
That would be our honor. Just glimpse through our content writing guideliness before |
Anyone create the PR yet? I'd be happy to put something together, just want to make sure no one is already working on it. |
@josh-hemphill please go for it! |
In the recomendation
Here is not mentioned the possibility of a timing attack if not handled properly bcrypt.
For example:
server.js
attacker.js
If we run the server.js and the attacker.js, we'll get:
That allows us to brute force to know the logins that are in the database.
Crypto module behaves much better in this case.
If we change server like this:
server_with_crypto.js
We'll get:
summary:
I believe it is important to mention this point and bring good practice of using bcrypt in authentication, since it is cited as the best alternative to crypto
The text was updated successfully, but these errors were encountered: