-
Notifications
You must be signed in to change notification settings - Fork 13
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
Sequential call of encrypt
/dump
/wrap
with the same cocoon object produces the same cipher text
#22
Comments
Created a pull request fixing the issue, and adding some new test criteria to all 4 of the encrypt functions #23 |
Also opened an issue here: rust-random/rand#1345 |
Wow, nice finding. I left comments in the PR. |
@ProjectInitiative What a nasty issue :) Here's the thing: originally, I designed API to be a one-shot, e.g. you initialize Cocoon, dump something, and leave. On the other side, sequential dumping/encrypting is a nice feature. However, changing the API to be mutable would break backward compatibility. Options:
|
Both are good, I would suggest a contingency on option 1: might be a good idea to add an crate.io advisory for < 3.x.x as I found this out by NOT using the crate in the intended way, and others might have as well while thinking their implementation was correct. As for which to select? I am not sure, I will defer the direction of the project to project owner. I will note from a security perspective, option 2 with a crate.io advisory would force/push dependent projects to re-evaluate and confirm the security they expect in their respective projects. |
@ProjectInitiative I am keen towards moving hardly: mut + version bump to 0.4.0 + rustsec advisory for <0.3.x. Why:
|
encrypt
/dump
/wrap
with the same cocoon object produces the same cipher text
@ProjectInitiative |
Closing issue! |
Security Advisory PR: rustsec/advisory-db#1805 |
@ProjectInitiative I just found that it was reproduced with |
Cloning the StdRng object for every
encrypt
call brings the rng back to the initial seeded starting point. This is a security issue as when you try to create new encrypted messages with the same cocoon object, the IV does not change, and the same ciperblock is returned. See tests below.Output:
Commenting out
let mut rng = rng.clone();
Output:
The text was updated successfully, but these errors were encountered: