Email me

Rust advisories / negentropy

Vulnerability HighRUSTSEC-2026-0365 · negentropy

RUSTSEC-2026-0365: Remote DoS through unchecked `IdList` allocation in negentropy

Short answerA security vulnerability in the negentropy crate: Remote DoS through unchecked `IdList` allocation in negentropy. High severity (CVSS 7.5). Fixed in 0.4.4, 0.5.2: update to a fixed version.

Cratenegentropy
TypeVulnerability (denial-of-service)
Affected versionsFrom 0.2.0 before 0.4.4; from 0.5.0 before 0.5.2.
Fixed in0.4.4, 0.5.2
SeverityHigh, CVSS 7.5
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Published2026-10-14
Last changed2026-10-16
Also known asnone

What to do

  1. See which version you have: cargo tree -i negentropy (it also shows which of your dependencies pulls it in).
  2. Update within your version requirement: cargo update -p negentropy. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for example negentropy = "0.5.2") or update the dependency that pulls it in.
  3. Check again with cargo audit, or paste your Cargo.lock into our Cargo.toml checker.

Details from the advisory

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:

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:

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>).

References

From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.

Up next

Are you affected?Check your whole dependency treePaste Cargo.lock: every advisory, for your exact versions.Read it next →

Did this answer your question?

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ