Skip to content
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

SPAKE2: Password not passed to memory-hard hash function #39

Open
ayyghost opened this issue Dec 21, 2020 · 2 comments
Open

SPAKE2: Password not passed to memory-hard hash function #39

ayyghost opened this issue Dec 21, 2020 · 2 comments

Comments

@ayyghost
Copy link

Hi,

I noticed that the spake2 crate uses HKDF instead of a memory-hard hash function when converting the password to a scalar:

Hkdf::<Sha256>::new(Some(b""), s)

According to the draft specification, as well as this analysis, implementers should use a function like scrypt to slow down brute-force attacks. My guess is that HKDF was used for interoperability with Magic Wormhole's Python implementation, where the one-time nature of passwords means brute force isn't a viable attack. However, this may be a problem for other use cases where a password can be attempted more than once without manual intervention from the other side.

Workarounds include request rate limiting or for callers to send the password through something like scrypt first, using the derived key as input to SPAKE2. However, many users of the library won't know to do this, since the lack of a memory-hard function is not necessarily clear from the documentation.

@tarcieri
Copy link
Member

tarcieri commented Jan 4, 2021

Semi-related: there's a WIP PR for a password-hash crate here:

RustCrypto/traits#437

That said, for this use case, it may make more sense to define a kdf crate (which I went ahead and snagged) with traits for KDFs, including a marker trait for memory-hard KDFs.

@ayyghost
Copy link
Author

It looks like you have scrypt and Argon2 available here now:

https://github.com/RustCrypto/password-hashes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants