{"id":"CVE-2021-26307","aliases":["CVE-2021-26307","GHSA-hvqc-pc78-x9wh","GHSA-jrf8-cmgg-gv2m","RUSTSEC-2021-0013"],"related":["CVE-2021-26306"],"kind":"vulnerability","state":"published","title":"Soundness issue in raw-cpuid","summary":"An issue was discovered in the raw-cpuid crate before 9.0.0 for Rust. It allows __cpuid_count() calls even if the processor does not support the CPUID instruction, which is unsound and causes a deterministic crash.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"An issue was discovered in the raw-cpuid crate before 9.0.0 for Rust. It allows __cpuid_count() calls even if the processor does not support the CPUID instruction, which is unsound and causes a deterministic crash.","source":"cvelist"},{"lang":"en","text":"VendorInfo::as_string(), SoCVendorBrand::as_string(), and ExtendedFunctionInfo::processor_brand_string() construct byte slices using std::slice::from_raw_parts(), with data coming from #[repr(Rust)] structs. This is always undefined behavior.\nThis flaw has been fixed in v9.0.0, by making the relevant structs #[repr(C)].","format":"markdown","source":"ghsa"},{"lang":"en","text":"native_cpuid::cpuid_count() exposes the unsafe __cpuid_count() intrinsic from core::arch::x86 or core::arch::x86_64 as a safe function, and uses it internally, without checking the safety requirement:\n\n* The CPU the program is currently running on supports the function being called.\n\nCPUID is available in most, but not all, x86/x86_64 environments. The crate compiles only on these architectures, so others are unaffected. This issue is mitigated by the fact that affected programs are expected to crash deterministically every time.\n\nThe flaw has been fixed in v9.0.0, by intentionally breaking compilation when targeting SGX or 32-bit x86 without SSE. This covers all affected CPUs.","format":"markdown","source":"ghsa"},{"lang":"en","text":"## Undefined behavior in `as_string()` methods\n\n`VendorInfo::as_string()`, `SoCVendorBrand::as_string()`,\nand `ExtendedFunctionInfo::processor_brand_string()` construct byte slices\nusing `std::slice::from_raw_parts()`, with data coming from\n`#[repr(Rust)]` structs. This is always undefined behavior.\n\nSee https://github.com/gz/rust-cpuid/issues/40.\n\nThis flaw has been fixed in v9.0.0, by making the relevant structs\n`#[repr(C)]`.\n\n## `native_cpuid::cpuid_count()` is unsound\n\n`native_cpuid::cpuid_count()` exposes the unsafe `__cpuid_count()` intrinsic\nfrom `core::arch::x86` or `core::arch::x86_64` as a safe function, and uses\nit internally, without checking the\n[safety requirement](https://doc.rust-lang.org/core/arch/index.html#overview):\n\n> The CPU the program is currently running on supports the function being\n> called.\n\nCPUID is available in most, but not all, x86/x86_64 environments. The crate\ncompiles only on these architectures, so others are unaffected.\n\nThis issue is mitigated by the fact that affected programs are expected\nto crash deterministically every time.\n\nSee https://github.com/gz/rust-cpuid/issues/41.\n\nThe flaw has been fixed in v9.0.0, by intentionally breaking compilation\nwhen targeting SGX or 32-bit x86 without SSE. This covers all affected CPUs.","format":"markdown","source":"rustsec"},{"lang":"es","text":"Se detectó un problema en la crate raw-cpuid versiones anteriores a 9.0.0 para Rust.&#xa0;Permite llamadas a la función __cpuid_count() inclusive si el procesador no admite la instrucción CPUID, lo cual no es sólido y causa un bloqueo determinista","source":"nvd"}],"published":"2021-01-20T12:00:00.000Z","modified":"2026-06-17T03:43:05.003Z","severity":{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:L/AC:L/Au:N/C:N/I:N/A:P","score":2.1,"rating":"LOW"}],"cwes":["CWE-198","CWE-400","CWE-657"],"affected":[{"ranges":[{"version":"n/a","status":"affected"}],"source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"9.0.0"}],"ecosystem":"crates.io","package":"raw-cpuid","purl":"pkg:cargo/raw-cpuid","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"9.0.0"}],"ecosystem":"crates.io","package":"raw-cpuid","purl":"pkg:cargo/raw-cpuid","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0.0.0-0","status":"affected","fixed":"9.0.0"}],"ecosystem":"crates.io","package":"raw-cpuid","purl":"pkg:cargo/raw-cpuid","source":"rustsec"},{"ranges":[{"status":"affected","fixed":"9.0.0"}],"vendor":"raw-cpuid_project","product":"raw-cpuid","cpe":"cpe:2.3:a:raw-cpuid_project:raw-cpuid:*:*:*:*:*:rust:*:*","source":"nvd"}],"references":[{"url":"https://rustsec.org/advisories/RUSTSEC-2021-0013.html","tags":["advisory","exploit","vendor-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","rustsec","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-26306","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/gz/rust-cpuid/issues/40","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/RustSec/advisory-db/pull/614","tags":["web"],"sources":["ghsa","rustsec"]},{"url":"https://github.com/gz/rust-cpuid","tags":["package"],"sources":["ghsa"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-26307","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/gz/rust-cpuid/issues/41","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/gz/rust-cpuid/commit/91b676eecd01f2163e2984215e2c0ac89e30ce75","tags":["web"],"sources":["ghsa"]},{"url":"https://crates.io/crates/raw-cpuid","tags":["package"],"sources":["rustsec"]}],"credits":[],"assigner":"mitre","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2021-26307","url":"https://www.cve.org/CVERecord?id=CVE-2021-26307","licence":"CVE Terms of Use","modified":"2024-08-03T20:19:20.400Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-hvqc-pc78-x9wh","url":"https://github.com/advisories/GHSA-hvqc-pc78-x9wh","licence":"CC-BY-4.0","modified":"2023-11-08T04:05:20.849Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-jrf8-cmgg-gv2m","url":"https://github.com/advisories/GHSA-jrf8-cmgg-gv2m","licence":"CC-BY-4.0","modified":"2023-11-08T04:05:20.849Z"},{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2021-0013","url":"https://rustsec.org/advisories/RUSTSEC-2021-0013.html","licence":"CC0-1.0","modified":"2023-11-08T04:05:20.849Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-26307","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-26307","licence":"Public domain","modified":"2026-06-17T03:43:05.003Z"}],"updatedAt":"2026-11-25T22:57:59.753Z","epss":{"score":0.00346,"percentile":0.30116,"date":"2026-12-01T12:00:22.000Z"}}