CVE-2026-25541: Bytes :reserve Vulnerability
MODERATECVE-2026-25541 is a MODERATE :reserve vulnerability (CWE-680: Integer Overflow to Buffer Overflow) affecting Bytes libraries in the crates.io ecosystem. The issue involves :reserve. Remediation is available by upgrading affected packages to version 1.11.1.
CVE-2026-25541 at a Glance
How to Fix CVE-2026-25541
To remediate this vulnerability, upgrade all affected Bytes dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade bytes to 1.11.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for bytes
How to Check if You Are Affected
To determine whether your application is affected by CVE-2026-25541, inspect your project dependencies for Bytes:
inspect dependencies for bytes
Analyze the terminal output to locate any version of Bytes in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.11.1), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-680: Integer Overflow to Buffer Overflow, where the product performs a calculation to determine how much memory to allocate, but an integer overflow can occur that causes less memory to be allocated than expected, leading to a buffer overflow. In Bytes, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-25541 Affected Bytes Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
bytes
|
crates.io |
≥ 1.2.1
< 1.11.1
|
1.11.1
|
References
Frequently Asked Questions
What is CVE-2026-25541?
Which Bytes versions are affected?
What version fixes CVE-2026-25541?
Is bytes affected?
What CWE is associated with CVE-2026-25541?
How can I check crates.io dependencies for CVE-2026-25541?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-434x-w66g-qw3r",
"modified" : "2026-02-05T00:37:18Z",
"published" : "2026-02-03T19:17:46Z",
"aliases" : [ "CVE-2026-25541" ],
"summary" : "bytes has integer overflow in BytesMut::reserve",
"details" : "# Details\n\nIn the unique reclaim path of `BytesMut::reserve`, the condition\n```rs\nif v_capacity >= new_cap + offset\n```\nuses 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.\n\nThis behavior is observable in release builds (integer overflow wraps), whereas debug builds panic due to overflow checks.\n\n## PoC\n\n```rs\nuse bytes::*;\n\nfn main() {\n let mut a = BytesMut::from(&b\"hello world\"[..]);\n let mut b = a.split_off(5);\n\n // Ensure b becomes the unique owner of the backing storage\n drop(a);\n\n // Trigger overflow in new_cap + offset inside reserve\n b.reserve(usize::MAX - 6);\n\n // This call relies on the corrupted cap and may cause UB & HBO\n b.put_u8(b'h');\n}\n```\n\n# Workarounds\n\nUsers 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.\n\nThis vulnerability is also known as [RUSTSEC-2026-0007](https://rustsec.org/advisories/RUSTSEC-2026-0007.html).",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "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"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "crates.io",
"name" : "bytes"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.2.1"
}, {
"fixed" : "1.11.1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/tokio-rs/bytes/security/advisories/GHSA-434x-w66g-qw3r"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-25541"
}, {
"type" : "WEB",
"url" : "https://github.com/tokio-rs/bytes/commit/d0293b0e35838123c51ca5dfdf468ecafee4398f"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/tokio-rs/bytes"
}, {
"type" : "WEB",
"url" : "https://github.com/tokio-rs/bytes/releases/tag/v1.11.1"
}, {
"type" : "WEB",
"url" : "https://rustsec.org/advisories/RUSTSEC-2026-0007.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-680" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-02-03T19:17:46Z",
"nvd_published_at" : "2026-02-04T22:16:00Z"
}
}