Rust advisories / temporary
Vulnerability MediumRUSTSEC-2018-0022 · temporary
RUSTSEC-2018-0022: Use of uninitialized memory in temporary
Short answerA security vulnerability in the temporary crate: Use of uninitialized memory in temporary. GitHub rates it Medium. Fixed in 0.6.4: update to a fixed version.
| Crate | temporary |
|---|---|
| Type | Vulnerability (memory-exposure) |
| Affected versions | From 0.3.0 before 0.6.4. |
| Fixed in | 0.6.4 |
| Severity | Medium (GitHub rating) |
| Published | 2018-08-22 |
| Last changed | 2023-11-08 |
| Also known as | GHSA-2jq9-6xx7-3h29 |
What to do
- See which version you have:
cargo tree -i temporary(it also shows which of your dependencies pulls it in). - Update within your version requirement:
cargo update -p temporary. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for exampletemporary = "0.6.4") or update the dependency that pulls it in. - Check again with
cargo audit, or paste your Cargo.lock into our Cargo.toml checker.
Details from the advisory
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.
References
- Package: crates.io/crates/temporary
- Advisory: rustsec.org/advisories/RUSTSEC-2018-0022.html
- Report: github.com/stainless-steel/temporary/issues/2
From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.
Up next
Are you affected?Check your whole dependency treePaste Cargo.lock: every advisory, for your exact versions.Read it next →Also worth your time
Did this answer your question?