GHSA-f7qj-v3vp-4856 libafl has unsound usages of `core::slice::from_raw_parts_mut`
Unsound memory alignment in libafl can lead to memory corruption, potentially allowing code execution or crashes.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Not stated
- Victim action needed
- Not needed
- Fix
- Available
What is GHSA-f7qj-v3vp-4856?
GHSA-f7qj-v3vp-4856 is a memory corruption vulnerability in libafl, published on 19 Dec 2024.
Official description
The library breaks the safety assumptions when using unsafe API slice::from_raw_parts_mut. The pointer passed to from_raw_parts_mut is misaligned by casting u8 to u16 raw pointer directly, which is unsound. The bug is patched by using align_offset, which could make sure the memory address is aligned to 2 bytes for u16.
This was patched in 0.11.2 in the commit.
Which versions are affected by GHSA-f7qj-v3vp-4856?
3 open source packages ship an affected version, including libafl.
| Package | Affected | Fixed in |
|---|---|---|
libafl crates.io | All versions | 0.11.2 |
libafl crates.io | All versions | 0.11.2 |
libafl crates.io | From 0.0.0-0 | 0.11.2 |
How do I fix GHSA-f7qj-v3vp-4856?
Upgrade libafl to 0.11.2 or later.
Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.
Is GHSA-f7qj-v3vp-4856 being exploited?
There is no known exploitation of GHSA-f7qj-v3vp-4856 in the wild and no public exploit code.
Sources
Also known as RUSTSEC-2024-0424.