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

ChaCha20Poly1305: Nonce is not incremented above 2^70, allowing for inadvertent reuse #56

Open
who-biz opened this issue May 16, 2019 · 1 comment
Assignees

Comments

@who-biz
Copy link
Contributor

who-biz commented May 16, 2019

This is security-breaking behavior, potentially. Simply generating a random nonce each time is not sufficient in this scenario. We need to use a counter as well, to ensure that we don't use a given nonce + MAC key more than once for the same encrypted information.

This takes place here: https://github.com/blur-network/blur/blob/master/src/crypto/chacha.c#L142
And has relevance here:

cache_file_data.iv = crypto::rand<crypto::chacha_iv>();

... among other places, too.

For the implications of what this inadvertent reuse could result in, see:
https://github.com/miscreant/miscreant/wiki/Nonce-Reuse-Misuse-Resistance

This was mentioned as a prospective change in #53

@who-biz who-biz self-assigned this May 16, 2019
@who-biz who-biz added fast-track Enhancements that need treated as important, just behind bugs in priority. under investigation urgent-noncritical things that require haste and removed fast-track Enhancements that need treated as important, just behind bugs in priority. urgent-noncritical things that require haste labels May 16, 2019
@who-biz
Copy link
Contributor Author

who-biz commented May 21, 2019

Why don't we place a hard stop at 2^70 at this point? If we can't securely encrypt data larger than that (limitation of chacha20), or if it never happens ... why not place a stop there instead of making it a user's responsibility?

Edit: Need to look into difficulty calculations, as this has probably the most relevance there, where we frequently deal with larger than 70-bit numbers.

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

No branches or pull requests

1 participant