GHSA-2jq9-6xx7-3h29 Use of uninitialized memory in temporary
Use of uninitialized memory for RNG seeding in a testing library causes undefined behavior, potentially leading to unpredictable results 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-2jq9-6xx7-3h29?
GHSA-2jq9-6xx7-3h29 is a memory corruption vulnerability in temporary, published on 22 Aug 2018.
Official description
Uninit memory is used as a RNG seed in temporary
The following function is used as a way to get entropy from the system, which does operations on and exposes uninit memory, which is UB.
fn random_seed(_: &Path, _: &str) -> [u64; 2] {
use std::mem::uninitialized as rand;
unsafe { [rand::<u64>() ^ 0x12345678, rand::<u64>() ^ 0x87654321] }
}
This has been resolved in the 0.6.4 release.
The crate is not intended to be used outside of a testing environment.
For a general purpose crate to create temporary directories, tempfile is an alternative for this crate.
Which versions are affected by GHSA-2jq9-6xx7-3h29?
3 open source packages ship an affected version, including temporary.
| Package | Affected | Fixed in |
|---|---|---|
temporary crates.io | From 0.3.0 | 0.6.4 |
temporary crates.io | From 0.3.0 | 0.6.4 |
temporary crates.io | From 0.3.0 | 0.6.4 |
How do I fix GHSA-2jq9-6xx7-3h29?
Upgrade temporary to 0.6.4 or later.
Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.
Is GHSA-2jq9-6xx7-3h29 being exploited?
There is no known exploitation of GHSA-2jq9-6xx7-3h29 in the wild and no public exploit code.
Sources
Also known as RUSTSEC-2018-0022.