GHSA-wfg4-322g-9vqv memoffset allows reading uninitialized memory

Not scored Published

The memoffset library allows reading uninitialized memory, potentially causing undefined behavior, crashes, or code execution in Rust applications.

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

What is GHSA-wfg4-322g-9vqv?

GHSA-wfg4-322g-9vqv is a memory corruption vulnerability in memoffset, published on 21 Jun 2023.

Official description

memoffset allows attempt of reading data from address 0 with arbitrary type. This behavior is an undefined behavior because address 0 to std::mem::size_of<T> may not have valid bit-pattern with T. Old implementation dereferences uninitialized memory obtained from std::mem::align_of. Older implementation prior to it allows using uninitialized data obtained from std::mem::uninitialized with arbitrary type then compute offset by taking the address of field-projection. This may also result in an undefined behavior for "father" that includes (directly or transitively) type that does not allow to be uninitialized.

This flaw was corrected by using std::ptr::addr_of in <https://github.com/Gilnaa/memoffset/pull/50>.

Which versions are affected by GHSA-wfg4-322g-9vqv?

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

PackageAffectedFixed in
memoffset crates.ioAll versions0.6.2
memoffset crates.ioAll versions0.6.2
memoffset crates.ioFrom 0.0.0-00.6.2

How do I fix GHSA-wfg4-322g-9vqv?

Upgrade memoffset to 0.6.2 or later.

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

Is GHSA-wfg4-322g-9vqv being exploited?

There is no known exploitation of GHSA-wfg4-322g-9vqv in the wild and no public exploit code.

Sources

Also known as RUSTSEC-2023-0045.

Is GHSA-wfg4-322g-9vqv in your software?

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

Check your SBOMs for free