Skip to main content
Vulnerability Database/CVE-2025-55159

CVE-2025-55159: Slab Buffer Overflow Vulnerability

CVE-2025-55159 is a buffer overflow in Slab library allowing access to uninitialized memory through incorrect bounds checking. This post explains its technical details, affected versions, impact, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2025-55159 Overview

CVE-2025-55159 affects the slab crate, a Rust library providing pre-allocated storage for a uniform data type. The vulnerability exists in version 0.4.10 of the crate, where the get_disjoint_mut method incorrectly validates index bounds against the slab's capacity instead of its length. This logic error permits callers to obtain mutable references to uninitialized memory slots, resulting in undefined behavior. Downstream Rust applications that depend on slab 0.4.10 and expose get_disjoint_mut to attacker-influenced indices may crash or exhibit memory corruption. The issue is tracked as CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer and was fixed in slab 0.4.11.

Critical Impact

Access to uninitialized memory in safe Rust code can trigger undefined behavior, process crashes, and potential information disclosure in applications relying on the slab crate.

Affected Products

  • slab crate version 0.4.10 (Rust, maintained by tokio-rs)
  • Rust applications and libraries transitively depending on slab 0.4.10
  • Downstream consumers invoking Slab::get_disjoint_mut with untrusted indices

Discovery Timeline

  • 2025-08-11 - CVE-2025-55159 published to the National Vulnerability Database
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2025-55159

Vulnerability Analysis

The slab crate manages a vector of entries that can be either occupied or vacant. Capacity reflects the allocated backing storage, while length reflects the number of entries actually initialized. The get_disjoint_mut method is intended to return multiple non-overlapping mutable references to occupied entries. In version 0.4.10 the bounds check compared each supplied key against self.entries.capacity() rather than self.entries.len(). Any index that fell within the allocated but uninitialized tail of the backing vector therefore passed validation.

Because the subsequent pointer arithmetic uses an unsafe block, the method then produces a mutable reference to memory that was never initialized as a valid T. Reading or writing through that reference is undefined behavior in Rust. Depending on T and allocator state, the consequence ranges from immediate crash to silent memory corruption of adjacent data.

Root Cause

The root cause is a single-identifier mistake in the bounds check: the method validated indices against capacity instead of length. The patch replaces entries_cap with entries_len so that only indices referring to initialized entries pass the check.

Attack Vector

The attack vector is local and requires the vulnerable application to pass attacker-controlled indices into get_disjoint_mut. Exploitation does not require elevated privileges or user interaction, but it does require a code path that exposes slab indices to untrusted input. Impact is limited to confidentiality of in-process memory and availability of the host process.

rust
        }

        let entries_ptr = self.entries.as_mut_ptr();
-       let entries_cap = self.entries.capacity();
+       let entries_len = self.entries.len();

        let mut res = MaybeUninit::<[&mut T; N]>::uninit();
        let res_ptr = res.as_mut_ptr() as *mut &mut T;

        for (i, &key) in keys.iter().enumerate() {
-           if key >= entries_cap {
+           // `key` won't be greater than `entries_len`.
+           if key >= entries_len {
                return Err(GetDisjointMutError::IndexOutOfBounds);
            }
            // SAFETY: we made sure above that this key is in bounds.

Source: tokio-rs/slab commit 2d65c514. The patch narrows the valid index range from the allocation capacity down to the initialized length, restoring the memory-safety invariant that get_disjoint_mut depends on.

Detection Methods for CVE-2025-55159

Indicators of Compromise

  • Unexpected process crashes or SIGSEGV signals in Rust services that call Slab::get_disjoint_mut.
  • Rust panics or sanitizer reports flagging reads from uninitialized memory in call stacks containing slab::Slab.
  • Dependency manifests (Cargo.lock) pinning slab = "0.4.10".

Detection Strategies

  • Run cargo audit against project lockfiles to flag slab 0.4.10 using the advisory database entry GHSA-qx2v-8332-m4fv.
  • Grep source repositories for direct and transitive usage of get_disjoint_mut to prioritize review.
  • Execute test suites under cargo miri or AddressSanitizer to surface undefined behavior triggered by invalid indices.

Monitoring Recommendations

  • Alert on crash telemetry and core dumps from Rust services after dependency updates.
  • Track supply chain inventory for the slab crate version across build pipelines and container images.
  • Monitor the GitHub Security Advisory GHSA-qx2v-8332-m4fv for any revisions or additional guidance.

How to Mitigate CVE-2025-55159

Immediate Actions Required

  • Upgrade the slab dependency to version 0.4.11 or later in all Rust projects.
  • Rebuild and redeploy affected binaries and container images after the dependency update.
  • Audit application code paths that forward external input into Slab::get_disjoint_mut and validate indices against Slab::len prior to the call.

Patch Information

The fix is delivered in slab 0.4.11 via Pull Request #152 and committed as 2d65c514bc964b192bab212ddf3c1fcea4ae96b8. The patch replaces the capacity-based bounds check in get_disjoint_mut with a length-based check so that only indices referring to initialized entries are accepted. Full advisory details are in GHSA-qx2v-8332-m4fv.

Workarounds

  • Avoid calling get_disjoint_mut with indices that may exceed the slab's current length.
  • Wrap calls in an explicit length check such as if keys.iter().all(|&k| k < slab.len()) before invocation.
  • Prefer get_mut in a loop for the affected code paths until the dependency can be upgraded.
bash
# Update the slab crate to the patched release
cargo update -p slab --precise 0.4.11

# Verify no vulnerable versions remain in the dependency graph
cargo tree -i slab
cargo audit

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.