GHSA-xrv3-jmcp-374j zerovec incorrectly uses `#[repr(packed)]`

Not scored Published

Attackers can trigger illegal memory accesses in applications using the zerovec library due to incorrect struct packing assumptions, 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
Available

What is GHSA-xrv3-jmcp-374j?

GHSA-xrv3-jmcp-374j is a memory corruption vulnerability in zerovec, published on 1 Jul 2024.

Official description

The affected versions make unsafe memory accesses under the assumption that #[repr(packed)] has a guaranteed field order.

The Rust specification does not guarantee this, and https://github.com/rust-lang/rust/pull/125360 (1.80.0-beta) starts reordering fields of #[repr(packed)] structs, leading to illegal memory accesses.

The patched versions 0.9.7 and 0.10.4 use #[repr(C, packed)], which guarantees field order.

Which versions are affected by GHSA-xrv3-jmcp-374j?

5 open source packages ship an affected version, including zerovec.

PackageAffectedFixed in
zerovec crates.ioAll versions0.9.7
zerovec crates.ioAll versions0.9.7
zerovec crates.ioFrom 0.0.0-00.9.7, 0.10.4
zerovec crates.ioFrom 0.10.00.10.4
zerovec crates.ioFrom 0.10.00.10.4

How do I fix GHSA-xrv3-jmcp-374j?

Upgrade zerovec to a fixed version for your release line: 0.9.7 or 0.10.4.

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

Is GHSA-xrv3-jmcp-374j being exploited?

There is no known exploitation of GHSA-xrv3-jmcp-374j in the wild and no public exploit code.

Sources

Also known as RUSTSEC-2024-0347.

Is GHSA-xrv3-jmcp-374j in your software?

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

Check your SBOMs for free