-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
Params limits too low - Invalid memoryCost, must be between 2048 and 4294967295. #303
Comments
We have strengthened the minimum parameters due to a potential attack on the Argon2 algorithm, described here: https://github.com/ALRBP/Attack-Argon2i The author of the attack suggests that the minimum parameters to avoid generating weak hashes are 2 passes for time cost, and 2048 KB of memory per call. My solution would be 4) use If you do need to hash using unsafe parameters, I would pick 3 and name the option much more explicitly, like React's |
Is this a problem only for argon2i, or also for argon2id? |
Both have the same minimum requirements. What is the use case for weak parameters? |
The use case is for incredibly high throughput systems that need to keep response time down. Im curious why the memory is limited in particular. I haven't seen similar memory restrictions in other argon2 projects (such as https://github.com/phxql/argon2-jvm). |
The wording in the paper is not crystal clear, and >1MiB to me means exactly 1MiB is still not enough. Since the memory is in powers of two, 2 MiB is the next step, thus it was selected as the minimum. I would accept a merge request reducing the minimum to 1MiB (you have to change this line), and if you would like to use even lower memory cost, I would prefer to have an option as described in my first reply. |
Opened #304 |
#304 solves this issue |
Steps to reproduce
Expected behaviour
Argon computation is done succesfully.
It worked on version 0.27.2 and lower.
Actual behaviour
On version 0.27.3 and higher, the following errors happens :
ERR_ASSERTION - Invalid memoryCost, must be between 2048 and 4294967295.
ERR_ASSERTION - Invalid timeCost, must be between 2 and xxxx.
Environment
Operating system:
Unix (ubi8)
Node version:
14.17.0
Compiler version:
?
node-argon2 version:
0.27.3 and superior
Comments
According to this commit minimum parameters have been increased for security reason.
This is understandable, as increasing security is a good practice for all systems.
But this behavior is out of the specs of the Argon2 algorithm (top of page 5).
According to the specs, timeCost minimum value can be 1,
and memoryCost minimum is 8 x timeCost (thus 8 is the lowest value).
I see several solution to this issue.
All these solutions have pros and cons, being more or less standard, adding security etc.
If you see other solution, please add a comment.
@ranisalt please give me your opinion on this issue.
If necessary, after chosing what's the best way, I can provide a PR (I can't dev in C++).
Thanks
The text was updated successfully, but these errors were encountered: