Skip to main content

CVE-2026-25541 — bytes has integer overflow in bytes — CVE Details

MEDIUM

bytes has integer overflow in BytesMut::reserve

Published February 3, 2026Updated September 10, 2026Source: OSV

What Should I Do?

Address in Next Maintenance Window

Low exploitation probability (0.65%). Schedule for your next planned update.

Does your project use an affected bytes version?

Paste your Cargo.lock to check it for CVE-2026-25541 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.

Check my Cargo.lock

Summary

Details

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.

This vulnerability is also known as RUSTSEC-2026-0007.

Advisory Timeline

  • First published February 3, 2026 (296 days ago).
  • Last revised September 10, 2026 — 218 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

Cargo
Update bytes to 1.11.1 or later
cargo update -p bytes --precise 1.11.1

After upgrading, scan your dependencies again to confirm the vulnerability is resolved.

Affected Packages (1)

Affects 1 ecosystem: crates.io (1).

PackageFixed In
bytes crates.io · Affected: All versions1.11.1

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 6.2 score means for each attack dimension.

Attack Vector
Local
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
—
Confidentiality
—
Integrity
—
Availability
—

CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:P

Frequently Asked Questions

What is CVE-2026-25541?
bytes has integer overflow in BytesMut::reserve. This vulnerability has been assigned a severity rating of MEDIUM (CVSS score: 6.2/10).
How do I check if my project is affected by CVE-2026-25541?
CVE-2026-25541 affects bytes. It has a 0.6% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-25541 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
6.2

Exploitation requires specific conditions, or the impact is limited.

EPSS Score (30-day exploit probability)
0.65%
EPSS percentile: 45.5

This is a below-median EPSS score — only 45.5% of tracked vulnerabilities score at or below it, so most tracked vulnerabilities are considered more likely to be exploited than this one.

Also Known As

GHSA-434x-w66g-qw3r
RUSTSEC-2026-0007

Related CVEs

Check your own dependencies

Free, with no signup for up to 10 packages.

Check my Cargo.lock