Integer Overflow Vulnerability in Bytes Package: A Risk to Memory Safety

bytes Updated 03 Feb 2026

Summary

03/02/2026
N/A
Yes i
Unrated
Not published

RUSTSEC-2026-0007: Integer overflow in BytesMut::reserve. Affects bytes versions >= 1.2.1, < 1.11.1. Fixed in 1.11.1. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The 'bytes' package is a widely used Rust library that provides utilities for working with byte arrays, including the 'BytesMut' type, which allows for dynamic byte buffer manipulation. This package is essential for applications that require efficient handling of binary data. However, a recent vulnerability has been identified in the 'reserve' function of 'BytesMut', which can lead to memory corruption and undefined behavior if not addressed promptly.

Vulnerability Detail

The vulnerability arises from an integer overflow in the 'BytesMut::reserve' function. Specifically, the condition that checks if the current capacity is sufficient uses an unchecked addition, which can lead to an overflow when the sum of 'new_cap' and 'offset' exceeds the maximum value of 'usize'. In release builds, this unchecked overflow wraps around, allowing the condition to incorrectly pass and set 'self.cap' to a value greater than the actual allocated capacity. This can result in out-of-bounds memory access when subsequent functions, such as 'spare_capacity_mut()', rely on this corrupted capacity value, leading to potential memory corruption and undefined behavior.

How To Fix

Latest published version: 1.12.1 as of 23 Oct 2026

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.11.1

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If you cannot immediately update the package, ensure that integer overflow checks are configured to panic instead of wrapping. This can be done by running your application in debug mode, which will trigger a panic on overflow. Here is a code snippet demonstrating the issue and how it can be triggered:

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

Conclusion

The integer overflow vulnerability in the 'bytes' package poses a significant risk to memory safety in applications that utilize the 'BytesMut' type. It is crucial to update to the patched version 1.11.1 or later to mitigate this risk. Users should also consider using tools like Vulert to monitor for vulnerabilities in their software.

See every vulnerability recorded for bytes →

Share this vulnerability

FAQ

The vulnerability is an integer overflow in the 'BytesMut::reserve' function, which can lead to memory corruption.

You can use Vulert, which monitors and alerts for open-source vulnerabilities in your software. Visit Vulert Scanner to check your application without any signup.

If exploited, this vulnerability can lead to undefined behavior, memory corruption, and potential security risks in your application.

Yes, the vulnerability has been patched in version 1.11.1 of the 'bytes' package. Updating to this version will resolve the issue.

As a temporary workaround, ensure that integer overflow checks are configured to panic by running your application in debug mode.

Related vulnerabilities

Recent vulnerabilities recorded for bytes.

How To Fix

Latest published version: 1.12.1 as of 23 Oct 2026

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.11.1

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback