CVE-2023-41051 Default functions in VolatileMemory trait lack bounds checks in vm-memory

Low 2.5 Published Updated

Out-of-bounds memory access in vm-memory allows attackers to cause crashes or execute code via custom implementations.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Local or same network only
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2023-41051?

CVE-2023-41051 is a low-severity memory corruption vulnerability in rust-vmm vm-memory, published on 1 Sep 2023. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

Official description

In a typical Virtual Machine Monitor (VMM) there are several components, such as boot loader, virtual device drivers, virtio backend drivers and vhost drivers, that need to access the VM physical memory. The vm-memory rust crate provides a set of traits to decouple VM memory consumers from VM memory providers. An issue was discovered in the default implementations of the `VolatileMemory::{get_atomic_ref, aligned_as_ref, aligned_as_mut, get_ref, get_array_ref}` trait functions, which allows out-of-bounds memory access if the `VolatileMemory::get_slice` function returns a `VolatileSlice` whose length is less than the function’s `count` argument. No implementations of `get_slice` provided in `vm_memory` are affected. Users of custom `VolatileMemory` implementations may be impacted if the custom implementation does not adhere to `get_slice`'s documentation. The issue started in version 0.1.0 but was fixed in version 0.12.2 by inserting a check that verifies that the `VolatileSlice` returned by `get_slice` is of the correct length. Users are advised to upgrade. There are no known workarounds for this issue.

Weakness: CWE-125

Which versions are affected by CVE-2023-41051?

3 open source packages ship an affected version, including vm-memory. It affects 1 product.

PackageAffectedFixed in
vm-memory crates.ioAll versions0.12.2
vm-memory crates.ioAll versions0.12.2
vm-memory crates.ioFrom 0.0.0-00.12.2

Products include Vm-Memory Project Vm-Memory.

How do I fix CVE-2023-41051?

Upgrade vm-memory to 0.12.2 or later.

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

Is CVE-2023-41051 being exploited?

There is no known exploitation of CVE-2023-41051 in the wild and no public exploit code.

Sources

Also known as DEBIAN-CVE-2023-41051, GHSA-49hh-fprx-m68g, RUSTSEC-2023-0056.

Is CVE-2023-41051 in your software?

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

Check your SBOMs for free