RUSTSEC-2026-0365 json
Remote DoS through unchecked `IdList` allocation in negentropy
published 28d ago modified 26d ago
- cvss
- 7.5
- version 3.1, OSV
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- —
- no score, EPSS covers CVEs only
- public exploits
- 0
- none known
Summary
## Summary
The `negentropy` crate is vulnerable to denial-of-service through an unchecked, peer-controlled ID count in reconciliation messages.
With the `std` feature enabled, which is the default configuration, a small malformed message can trigger an enormous memory allocation and terminate the application.
## Details
When processing an `IdList` range, the reconciliation parser uses the peer-provided ID count to reserve memory before checking whether the message contains the corresponding IDs:
```rust let mut their_elems: HashSet<Id> = HashSet::with_capacity(num_ids as usize); ```
An attacker can declare an arbitrarily large count without supplying any IDs. The allocation occurs before the parser reaches the ID-reading loop, which would otherwise reject the truncated message.
With Rust's default allocation-error behavior, a failed allocation aborts the process rather than unwinding. Consequently, `catch_unwind` cannot contain the failure.
Both `reconcile` and `reconcile_with_ids` reach the vulnerable parser.
The patched versions validate the count against the remaining message length before allocating:
```rust if num_ids > (query.len() / ID_SIZE) as u64 { return Err(Error::ParseEndsPrematurely); } ```
## Impact
An unauthenticated remote attacker can terminate an application that exposes reconciliation to untrusted peers without additional validation.
For example, a Nostr relay that forwards `NEG-OPEN` or `NEG-MSG` reconciliation payloads to the vulnerable parser can be taken down by a single client message. Clients processing messages from malicious relays are also exposed.
This specific vulnerability affects builds with the default `std` feature enabled. Builds without `std` use a `BTreeSet` and do not perform the vulnerable preallocation.
A message-size limit alone does not prevent exploitation because the malicious payload can be only a few bytes long.
## Credit
Discovered and fixed by **Alex Gleason** (<https://github.com/alexgleason>).
Patch / fix
- crates.io negentropy 0.4.4, 0.5.2
Is RUSTSEC-2026-0365 in your dependencies? Fencer shows which of your repositories are affected as soon as an advisory lands, and opens the fix as a pull request.
Check with FencerCVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| OSV | 3.1 | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| crates.io | negentropy | >=0.2.0, <0.4.4 >=0.5.0, <0.5.2 |
0.4.4 0.5.2 |
References
-
github.com
/nostrdevkit/negentropy/pull/14
web
-
github.com
/nostrdevkit/negentropy/commit/40f7290cbc5755a5ba3190279fbc848a97866280
web
-
github.com
/nostrdevkit/negentropy/commit/894a32c0ab9f3efd750b3cf06caee27b3f9c3f12
web
-
crates.io
/crates/negentropy
package
-
rustsec.org
/advisories/RUSTSEC-2026-0365.html
advisory
Sources
Fencer Intel keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.