-
Notifications
You must be signed in to change notification settings - Fork 60
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
DoS with long password #82
Comments
ok so the fist big issue is that you can't actually clone node crypto objects like this, but there is a reason we aren't actually using createHmac here and it's becasue it has a bunch of overhead related to streaming object creation that we didn't want which means that we probably can fix this in the library. that being said looking at how we use the hmac and how the hmac works are you sure that applies here ? |
Sorry I removed the reference to the lines of code https://github.com/crypto-browserify/pbkdf2/blob/master/lib/sync.js#L36-L40 |
ah so funny enough that will never actually use the create-hmac library
because that only runs in node so it probably wont help
…On Fri, Oct 12, 2018 at 7:39 PM Steve Thomas ***@***.***> wrote:
Sorry I removed the reference to the lines of code
https://github.com/crypto-browserify/pbkdf2/blob/master/lib/sync.js#L36-L40
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#82 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABE4n8FhzQU8Fbz9ZvkW3AzZacOKF6mNks5ukSgsgaJpZM4XZdfa>
.
|
This library is pretty complex as it handles several different scenarios:
so it's not necessarily obvious at first glance what code path will be taken it what environment but I believe I actually tested this back in the day and it was faster to create a node.js hmac object then to use a non streaming one because the node.js one would use a native hmac function while in the browser it wouldn't. |
Unfortunately, the Hmac class does not have the copy method as the Hash class: But what could be pulled out of the loop is this key normalization https://github.com/crypto-browserify/pbkdf2/blob/v3.1.0/lib/sync-browser.js#L26-L30, such that the native hmac always gets the correct key length. |
If you enter a long password it will take significantly longer. This runs in
O(pwLen * rounds)
time instead of inO(pwLen + rounds)
time.Ideally you'd want to do a cached HMAC for a 2x speed increase (on normal sized passwords):
Their are some problems with the "create-hmac" package and once those are fixed cached HMAC will be the best way to go. See browserify/createHmac#27. Also I do not know the proper way to clone an object in Node.js. Thus the quotes around
cachedCtx.clone()
.The text was updated successfully, but these errors were encountered: