This project might be open to known security vulnerabilities, which can be prevented by tightening the version range of affected dependencies. Find detailed information at the bottom.

Crate libp2p-noise

Dependencies

(13 total, 7 outdated, 3 possibly insecure)

CrateRequiredLatestStatus
 bytes ⚠️^11.11.1maybe insecure
 curve25519-dalek ⚠️^3.0.04.1.3out of date
 futures^0.3.10.3.32up to date
 lazy_static^1.21.5.0up to date
 libp2p-core^0.28.00.43.2out of date
 log^0.40.4.29up to date
 prost^0.70.14.3out of date
 rand^0.8.30.10.0out of date
 sha2^0.9.10.10.9out of date
 snow ⚠️^0.8.00.10.0out of date
 static_assertions^11.1.0up to date
 x25519-dalek^1.1.02.0.1out of date
 zeroize^11.8.2up to date

Dev dependencies

(4 total, 3 outdated)

CrateRequiredLatestStatus
 async-io^1.2.02.6.0out of date
 env_logger^0.8.10.11.9out of date
 quickcheck^0.9.01.1.0out of date
 sodiumoxide^0.2.50.2.7up to date

Security Vulnerabilities

snow: Unauthenticated Nonce Increment in snow

RUSTSEC-2024-0011

There was a logic bug where unauthenticated payloads could still cause a nonce increment in snow's internal state. For an attacker with privileges to inject packets into the channel over which the Noise session operates, this could allow a denial-of-service attack which could prevent message delivery by sending garbage data.

Note that this only affects those who are using the stateful TransportState, not those using StatelessTransportState.

This has been patched in version 0.9.5, and all users are recommended to update.

curve25519-dalek: Timing variability in `curve25519-dalek`'s `Scalar29::sub`/`Scalar52::sub`

RUSTSEC-2024-0344

Timing variability of any kind is problematic when working with potentially secret values such as elliptic curve scalars, and such issues can potentially leak private keys and other secrets. Such a problem was recently discovered in curve25519-dalek.

The Scalar29::sub (32-bit) and Scalar52::sub (64-bit) functions contained usage of a mask value inside a loop where LLVM saw an opportunity to insert a branch instruction (jns on x86) to conditionally bypass this code section when the mask value is set to zero as can be seen in godbolt:

A similar problem was recently discovered in the Kyber reference implementation:

https://groups.google.com/a/list.nist.gov/g/pqc-forum/c/hqbtIGFKIpU/m/cnE3pbueBgAJ

As discussed on that thread, one portable solution, which is also used in this PR, is to introduce a volatile read as an optimization barrier, which prevents the compiler from optimizing it away.

The fix can be validated in godbolt here:

The problem was discovered and the solution independently verified by Alexander Wagner [email protected] and Lea Themint [email protected] using their DATA tool:

https://github.com/Fraunhofer-AISEC/DATA

bytes: Integer overflow in `BytesMut::reserve`

RUSTSEC-2026-0007

In the unique reclaim path of BytesMut::reserve, the condition

if v_capacity >= new_cap + offset

uses an unchecked addition. When new_cap + offset overflows usize in release builds, this condition may incorrectly pass, causing self.cap to be set to a value that exceeds the actual allocated capacity. Subsequent APIs such as spare_capacity_mut() then trust this corrupted cap value and may create out-of-bounds slices, leading to UB.

This behavior is observable in release builds (integer overflow wraps), whereas debug builds panic due to overflow checks.

PoC

use bytes::*;

fn main() {
    let mut a = BytesMut::from(&b"hello world"[..]);
    let mut b = a.split_off(5);

    // Ensure b becomes the unique owner of the backing storage
    drop(a);

    // Trigger overflow in new_cap + offset inside reserve
    b.reserve(usize::MAX - 6);

    // This call relies on the corrupted cap and may cause UB & HBO
    b.put_u8(b'h');
}

Workarounds

Users of BytesMut::reserve are only affected if integer overflow checks are configured to wrap. When integer overflow is configured to panic, this issue does not apply.