Advisories for Cargo/Cocoon package

2024

cocoon Reuses a Nonce, Key Pair in Encryption

Versions of the package cocoon before 0.4.0 are vulnerable to Reusing a Nonce, Key Pair in Encryption when the encrypt, wrap, and dump functions are sequentially called. An attacker can generate the same ciphertext by creating a new encrypted message with the same cocoon object. Note: The issue does NOT affect objects created with Cocoon::new which utilizes ThreadRng.

2023

Sequential calls of encryption API (`encrypt`, `wrap`, and `dump`) result in nonce reuse

Problem: Trying to create a new encrypted message with the same cocoon object generates the same ciphertext. It mostly affects MiniCocoon and Cocoon objects with custom seeds and RNGs (where StdRng is used under the hood). Note: The issue does NOT affect objects created with Cocoon::new which utilizes ThreadRng. Cause: StdRng produces the same nonce because StdRng::clone resets its state. Measure: Make encryption API mutable (encrypt, wrap, and dump). Workaround: …