GHSA-r24f-hg58-vfrw unsafe-libyaml unaligned write of u64 on 32-bit and 16-bit platforms
An attacker can cause a crash in unsafe-libyaml on 32-bit or 16-bit platforms due to unaligned memory writes, leading to denial of service.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Not stated
- Victim action needed
- Not needed
- Fix
- Available
What is GHSA-r24f-hg58-vfrw?
GHSA-r24f-hg58-vfrw is a memory corruption vulnerability in unsafe-libyaml, published on 20 Dec 2023.
Official description
Affected versions allocate memory using the alignment of usize and write data to it of type u64, without using core::ptr::write_unaligned. In platforms with sub-64bit alignment for usize (including wasm32 and x86) these writes are insufficiently aligned some of the time.
If using an ordinary optimized standard library, the bug exhibits Undefined Behavior so may or may not behave in any sensible way, depending on optimization settings and hardware and other things. If using a Rust standard library built with debug assertions enabled, the bug manifests deterministically in a crash (non-unwinding panic) saying "ptr::write requires that the pointer argument is aligned and non-null".
No 64-bit platform is impacted by the bug.
The flaw was corrected by allocating with adequately high alignment on all platforms.
Which versions are affected by GHSA-r24f-hg58-vfrw?
3 open source packages ship an affected version, including unsafe-libyaml.
| Package | Affected | Fixed in |
|---|---|---|
unsafe-libyaml crates.io | All versions | 0.2.10 |
unsafe-libyaml crates.io | All versions | 0.2.10 |
unsafe-libyaml crates.io | From 0.0.0-0 | 0.2.10 |
How do I fix GHSA-r24f-hg58-vfrw?
Upgrade unsafe-libyaml to 0.2.10 or later.
Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.
Is GHSA-r24f-hg58-vfrw being exploited?
There is no known exploitation of GHSA-r24f-hg58-vfrw in the wild and no public exploit code.
Sources
Also known as RUSTSEC-2023-0075.