GHSA-5x36-7567-3cw6 partial_sort contains Out-of-bounds Read in release mode

Not scored Published

Attackers can trigger out-of-bounds reads in release builds, potentially exposing sensitive memory contents.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Not stated
Victim action needed
Not needed
Fix
Available

What is GHSA-5x36-7567-3cw6?

GHSA-5x36-7567-3cw6 is a memory corruption vulnerability in partial_sort, published on 20 Feb 2023.

Official description

Affected versions of this crate were using a debug assertion to validate the last parameter of partial_sort(). This would allow invalid inputs to cause an out-of-bounds read instead of immediately panicking, when compiled without debug assertions.

All writes are bounds-checked, so the out-of-bounds memory access is read-only. This also means that the first attempted out-of-bounds write will panic, limiting the possible reads.

The accessible region is further limited by an initial bounds-checked read at (last / 2) - 1, i.e., it is proportional to the size of the vector.

This bug has been fixed in v0.2.0.

Which versions are affected by GHSA-5x36-7567-3cw6?

3 open source packages ship an affected version, including partial_sort.

PackageAffectedFixed in
partial_sort crates.ioAll versions0.2.0
partial_sort crates.ioAll versions0.2.0
partial_sort crates.ioFrom 0.0.0-00.2.0

How do I fix GHSA-5x36-7567-3cw6?

Upgrade partial_sort to 0.2.0 or later.

Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.

Is GHSA-5x36-7567-3cw6 being exploited?

There is no known exploitation of GHSA-5x36-7567-3cw6 in the wild and no public exploit code.

Sources

Also known as RUSTSEC-2023-0016.

Is GHSA-5x36-7567-3cw6 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free