GHSA-xfhw-6mc4-mgxf crayon: ObjectPool creates uninitialized memory when freeing objects

Not scored Published

The crayon Rust library triggers undefined behavior by reading uninitialized memory during object pool cleanup, potentially leading to crashes or code execution.

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

What is GHSA-xfhw-6mc4-mgxf?

GHSA-xfhw-6mc4-mgxf is a memory corruption vulnerability in crayon, published on 27 Feb 2024.

Official description

As of version 0.6.0, the ObjectPool explicitly creates an uninitialized instance of its type parameter when it attempts to free an object, and swaps it into the storage. This causes instant undefined behavior due to reading the uninitialized memory in order to write it to the pool storage.

Extremely basic usage of the crate can trigger this issue, e.g. this code from a doctest:

use crayon::prelude::*;
application::oneshot().unwrap();

let mut params = MeshParams::default();

let mesh = video::create_mesh(params, None).unwrap();

// Deletes the mesh object.
video::delete_mesh(mesh); // <-- UB

The Clippy warning for this code was silenced in commit c2fde19caf6149d91faa504263f0bc5cafc35de5.

Discovered via https://asan.saethlin.dev/ub?crate=crayon&version=0.7.1

Which versions are affected by GHSA-xfhw-6mc4-mgxf?

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

PackageAffectedFixed in
crayon crates.ioFrom 0.6.0None
crayon crates.ioFrom 0.6.0 to 0.7.1None
crayon crates.ioFrom 0.6.0 to 0.7.1None

How do I fix GHSA-xfhw-6mc4-mgxf?

No fix has been published for GHSA-xfhw-6mc4-mgxf yet. Limit exposure of the affected software until one is available.

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

Is GHSA-xfhw-6mc4-mgxf being exploited?

There is no known exploitation of GHSA-xfhw-6mc4-mgxf in the wild and no public exploit code.

Sources

Also known as RUSTSEC-2024-0018.

Is GHSA-xfhw-6mc4-mgxf in your software?

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

Check your SBOMs for free