Skip to main content

Boteraser | Website and Server Security Solutions

🛡️ CVE-2024-21530 — cocoon

🟡 CVSS 4.5 — Medium ✅ No Known Exploit CWE-323 NVD
4.5
CVSS Score
0 Low4 Medium7 High9 Critical10

Description

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: Create a new cocoon object with a new seed per each encryption.

How to Reproduce

```rust

let cocoon = MiniCocoon::from_password(b"password", &[1; 32]);

let mut data1 = "my secret data".to_owned().into_bytes();

let _ = cocoon.encrypt(&mut data1)?;

let mut data2 = "my secret data".to_owned().into_bytes();

let _ = cocoon.encrypt(&mut data2)?;

// data1: [23, 217, 251, 151, 179, 62, 85, 15, 253, 92, 192, 112, 200, 52]

// data2: [23, 217, 251, 151, 179, 62, 85, 15, 253, 92, 192, 112, 200, 52]

```

Workaround

For cocoon <= 0.3.3, create a new cocoon with a different seed per each encrypt/wrap/dump call.

```rust

let cocoon = MiniCocoon::from_password(b"password", &[1; 32]);

let mut data1 = "my secret data".to_owned().into_bytes();

let _ = cocoon.encrypt(&mut data1)?;

// Another seed: &[2; 32].

let cocoon = MiniCocoon::from_password(b"password", &[2; 32]);

let mut data2 = "my secret data".to_owned().into_bytes();

let _ = cocoon.encrypt(&mut data2)?;

// data1: [23, 217, 251, 151, 179, 62, 85, 15, 253, 92, 192, 112, 200, 52]

// data2: [53, 223, 209, 96, 130, 99, 209, 108, 83, 189, 123, 81, 19, 1]

```

How this vulnerability can be exploited

This issue can be reached with local access to the system, attack complexity is high, an attacker needs no privileges on the target. No user interaction is required. The scope is changed, meaning a successful attack can affect components beyond the vulnerable one. Rated impact: confidentiality low, integrity low, availability none.

CVSS metrics in full

The score comes from this vector: CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:C/C:L/I:L/A:N

  • Attack vector: Local — a local account, shell or session on the host is needed.
  • Attack complexity: High — the attacker first has to win a race, learn a secret or otherwise prepare the target.
  • Privileges required: None — an unauthenticated stranger can try it.
  • User interaction: None — nobody has to be tricked into anything.
  • Scope: Changed — a successful attack reaches components beyond the vulnerable one.
  • Confidentiality impact: Low — limited, and the attacker does not choose what is affected.
  • Integrity impact: Low — limited, and the attacker does not choose what is affected.
  • Availability impact: None.

Weakness class

CVE-2024-21530 is classified as CWE-323: Reusing a Nonce, Key Pair in Encryption. Nonces should be used for the present occasion and only once.

Affected software

CVE-2024-21530 is recorded against 2 packages.

  • cocoon
  • unknown

Timeline and source

Published on 2 October 2024 and last revised on 29 December 2025. No public exploit is currently recorded for this entry. Record sourced from NVD.

References

nvd.nist.gov (Advisory)
github.com (Web)
github.com (Web)
github.com (Advisory)
github.com (Package)
rustsec.org (Web)
security.snyk.io (Web)

Other advisories for this package

cocoon has other advisories on record. If you are patching this one, these are worth checking on the same host:

Same weakness in other software

These advisories are the same class of weakness (CWE-323: Reusing a Nonce, Key Pair in Encryption) in other software:

Details

Severity Medium
CVSS Score 4.5
CVSS Vector CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:C/C:L/I:L/A:N
CWE CWE-323
Public Exploit ✅ No
Source NVD
Published 2024-10-02
Updated 2026-08-20
Modified 2025-12-29
Fix URL N/A

Affected Packages

Software From version Fixed in
cocoon — —
unknown — —

Similar Threats

Vulnerability Monitoring

Track new vulnerabilities in cocoon

CVE-2024-21530 is rated CVSS 4.5 Medium. BotEraser monitors your WordPress installation and notifies you when software you use appears in our vulnerability database.

Set Up Free Alerts →

No credit card required  ·  Results in minutes

ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.

Browse related advisories

All advisoriesCVECVE 2024
✓