CVE-2021-45705 — nanorand
CVE-2021-45705 is a security vulnerability in nanorand. A fix is available for nanorand — see the affected versions and patch details below.
Aliased mutable references from `tls_rand` & `TlsWyRand`
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
Real-World Exposure
nanorandReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects crates.io packages — download data is not available via public APIs for these ecosystems.
Description
An issue was discovered in the nanorand crate before 0.6.1 for Rust. There can be multiple mutable references to the same object because the TlsWyRand Deref implementation dereferences a raw pointer.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🦀crates.io | nanorand | ≥ 0.5.0&&< 0.6.1 | 0.6.1cargo update -p nanorand --precise 0.6.1 |
Affected Products
nanorandnanorand_projectDetection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for nanorand, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update nanorand to 0.6.1 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2021-45705 is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
Frequently Asked Questions
Is CVE-2021-45705 in your dependencies?
Find it across crates.io, including transitive dependencies.