GHSA-h7h7-6mx3-r89v Unsound usages of `Vec::from_raw_parts`
Unsound memory transmutation in Fyrox engine library allows attackers to trigger undefined behavior and potential code execution via crafted data.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Not stated
- Victim action needed
- Not needed
- Fix
- Available
What is GHSA-h7h7-6mx3-r89v?
GHSA-h7h7-6mx3-r89v is a memory corruption vulnerability in fyrox-core, published on 19 Dec 2024.
Official description
The library provides a public safe API transmute_vec_as_bytes, which incorrectly assumes that any generic type T could have stable layout, causing to uninitialized memory exposure if the users pass any types with padding bytes as T and cast it to u8 pointer.
In the issue, we develop a PoC to show passing struct type to transmute_vec_as_bytes could lead to undefined behavior with Vec::from_raw_parts.
The developers provide a patch by changing trait of Copy to Pod, which can make sure T should be plain data. This was patched in the latest version of master branch, but still not on the latest release (0.28.1).
Which versions are affected by GHSA-h7h7-6mx3-r89v?
3 open source packages ship an affected version, including fyrox-core.
| Package | Affected | Fixed in |
|---|---|---|
fyrox-core crates.io | From 0.0.0-0 | 0.36.0 |
fyrox-core crates.io | From 0.28.1 | 0.36 |
fyrox-core crates.io | From 0.28.1 | 0.36 |
How do I fix GHSA-h7h7-6mx3-r89v?
Upgrade fyrox-core to a fixed version for your release line: 0.36.0 or 0.36.
Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.
Is GHSA-h7h7-6mx3-r89v being exploited?
There is no known exploitation of GHSA-h7h7-6mx3-r89v in the wild and no public exploit code.
Sources
Also known as RUSTSEC-2024-0435.