GHSA-cq8v-f236-94qc: Rand :rng() Vulnerability
LOWGHSA-cq8v-f236-94qc is a LOW :rng() vulnerability (CWE-20: Improper Input Validation) affecting Rand libraries in the crates.io ecosystem. The issue involves :rng(). Remediation is available by upgrading affected packages to version 0.9.3, 0.10.1, 0.8.6.
GHSA-cq8v-f236-94qc at a Glance
How to Fix GHSA-cq8v-f236-94qc
To remediate this vulnerability, upgrade all affected Rand dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade rand to 0.9.3
Upgrade rand to 0.10.1
Upgrade rand to 0.8.6
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for rand
How to Check if You Are Affected
To determine whether your application is affected by GHSA-cq8v-f236-94qc, inspect your project dependencies for Rand:
inspect dependencies for rand
Analyze the terminal output to locate any version of Rand in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.9.3), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Rand, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-cq8v-f236-94qc Affected Rand Versions
3 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
rand
|
crates.io |
≥ 0.9.0
< 0.9.3
|
0.9.3
|
|
rand
|
crates.io |
≥ 0.10.0
< 0.10.1
All 1 versions
0.10.0
|
0.10.1
|
|
rand
|
crates.io |
≥ 0.7.0
< 0.8.6
|
0.8.6
|
References
Frequently Asked Questions
What is GHSA-cq8v-f236-94qc?
Which Rand versions are affected?
What version fixes GHSA-cq8v-f236-94qc?
Is rand affected?
What CWE is associated with GHSA-cq8v-f236-94qc?
How can I check crates.io dependencies for GHSA-cq8v-f236-94qc?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-cq8v-f236-94qc",
"modified" : "2026-04-22T20:13:40Z",
"published" : "2026-04-14T01:03:36Z",
"aliases" : [ ],
"summary" : "Rand is unsound with a custom logger using rand::rng()",
"details" : "It has been reported (by @lopopolo) that the `rand` library is [unsound](https://rust-lang.github.io/unsafe-code-guidelines/glossary.html#soundness-of-code--of-a-library) (i.e. that safe code using the public API can cause Undefined Behaviour) when all the following conditions are met:\n\n- The `log` and `thread_rng` features are enabled\n- A [custom logger](https://docs.rs/log/latest/log/#implementing-a-logger) is defined\n- The custom logger accesses `rand::rng()` (previously `rand::thread_rng()`) and calls any `TryRng` (previously `RngCore`) methods on `ThreadRng`\n- The `ThreadRng` (attempts to) reseed while called from the custom logger (this happens every 64 kB of generated data)\n- Trace-level logging is enabled or warn-level logging is enabled and the random source (the `getrandom` crate) is unable to provide a new seed\n\n`TryRng` (previously `RngCore`) methods for `ThreadRng` use `unsafe` code to cast `*mut BlockRng<ReseedingCore>` to `&mut BlockRng<ReseedingCore>`. When all the above conditions are met this results in an aliased mutable reference, violating the Stacked Borrows rules. Miri is able to detect this violation in sample code. Since construction of [aliased mutable references is Undefined Behaviour](https://doc.rust-lang.org/stable/nomicon/references.html), the behaviour of optimized builds is hard to predict.",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "crates.io",
"name" : "rand"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0.9.0"
}, {
"fixed" : "0.9.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "rand"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0.10.0"
}, {
"fixed" : "0.10.1"
} ]
} ],
"versions" : [ "0.10.0" ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "rand"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0.7.0"
}, {
"fixed" : "0.8.6"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/rust-random/rand/pull/1763"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/rust-random/rand"
}, {
"type" : "WEB",
"url" : "https://rustsec.org/advisories/RUSTSEC-2026-0097.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-20" ],
"severity" : "LOW",
"github_reviewed" : true,
"github_reviewed_at" : "2026-04-14T01:03:36Z",
"nvd_published_at" : null
}
}