VYPR
High severityNVD Advisory· Published Jan 29, 2021· Updated Aug 3, 2024

CVE-2021-26306

CVE-2021-26306

Description

An issue was discovered in the raw-cpuid crate before 9.0.0 for Rust. It has unsound transmute calls within as_string() methods.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

The raw-cpuid crate before 9.0.0 for Rust contains unsound transmute calls in as_string() methods, leading to undefined behavior and potential memory corruption.

Vulnerability

Details

The raw-cpuid crate, which parses the x86 CPUID instruction, contains unsound transmute calls in several as_string() methods, including VendorInfo::as_string(), SoCVendorBrand::as_string(), and ExtendedFunctionInfo::processor_brand_string(). These methods construct byte slices using std::slice::from_raw_parts() on data stored in #[repr(Rust)] structs. Because Rust's default struct layout is unspecified, this is always undefined behavior [1][2].

Exploitation

The vulnerability is triggered whenever the affected as_string() methods are called on CPUID data. While CPUID data is typically read from hardware, an attacker with control over the CPUID output—such as through a malicious hypervisor or compromised firmware—could potentially exploit the undefined behavior to cause memory corruption. More broadly, any application using the vulnerable crate may encounter undefined behavior during normal operation, leading to crashes or unpredictable program behavior [2].

Impact

Undefined behavior in Rust can result in memory corruption, denial of service, or, under certain compiler optimizations, arbitrary code execution. The RustSec advisory categorizes this issue as both memory-corruption and denial-of-service [2].

Mitigation

The issue has been fixed in version 9.0.0 of the raw-cpuid crate by making the relevant structs #[repr(C)], which guarantees a stable memory layout and eliminates the undefined behavior [1][2]. Users should update to version 9.0.0 or later. No workaround is available for earlier versions.

AI Insight generated on May 21, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
raw-cpuidcrates.io
< 9.0.09.0.0

Affected products

2

Patches

0

No patches discovered yet.

Vulnerability mechanics

AI mechanics synthesis has not run for this CVE yet.

References

5

News mentions

0

No linked articles in our index yet.