CVE-2026-25541 — bytes has integer overflow in bytes — CVE Details
bytes has integer overflow in BytesMut::reserve
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.
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 -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).
| Package | Fixed In |
|---|---|
| bytes crates.io · Affected: All versions | 1.11.1 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-680
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 6.2 score means for each attack dimension.
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
References
- https://github.com/tokio-rs/bytes/security/advisories/GHSA-434x-w66g-qw3rWEB
- https://nvd.nist.gov/vuln/detail/CVE-2026-25541ADVISORY
- https://github.com/tokio-rs/bytes/commit/d0293b0e35838123c51ca5dfdf468ecafee4398fWEB
- https://github.com/tokio-rs/bytesPACKAGE
- https://github.com/tokio-rs/bytes/releases/tag/v1.11.1WEB
- https://rustsec.org/advisories/RUSTSEC-2026-0007.htmlWEB
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
Exploitation requires specific conditions, or the impact is limited.
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
Related CVEs
- CVE-2026-115906MEDIUM
zip: AES Entry HMAC Authentication Bypass on Premature EOF
- CVE-2026-35374MEDIUM
split: TOCTOU output-open allows truncating a swapped file