CVE-2020-35926
Improper random number generation in nanorand
An issue was discovered in the nanorand crate before 0.5.1 for Rust. It caused any random number generator (even ChaCha) to return all zeroes because integer truncation was mishandled.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- None
What an attacker can affect
- Confidentiality
- High
- Integrity
- High
- Availability
- High
Exploit likelihood
What each source reports
NVD Score used
9.8
An issue was discovered in the nanorand crate before 0.5.1 for Rust. It caused any random number generator (even ChaCha) to return all zeroes because integer truncation was mishandled.
- Record
CVE-2020-35926- CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - CVSS 2.0
- 7.5 High
AV:N/AC:L/Au:N/C:P/I:P/A:P - Weakness
- CWE-330, CWE-681
- Updated
- 2026-11-02
CVE List No score
An issue was discovered in the nanorand crate before 0.5.1 for Rust. It caused any random number generator (even ChaCha) to return all zeroes because integer truncation was mishandled.
- Record
CVE-2020-35926- Updated
- 2026-11-02
EUVDEUVD-2021-1796 No score
An issue was discovered in the nanorand crate before 0.5.1 for Rust. It caused any random number generator (even ChaCha) to return all zeroes because integer truncation was mishandled.
- Record
EUVD-2021-1796- Updated
- 2026-11-03
GitHub AdvisoriesGHSA-m9m5-cg5h-r582
5.1
Improper random number generation in nanorand
In versions of nanorand prior to 0.5.1, RandomGen implementations for standard unsigned integers could fail to properly generate numbers, due to using bit-shifting to truncate a 64-bit number, rather than just an as conversion. This often manifested as RNGs returning nothing but 0, including the cryptographically secure ChaCha random number generator.
- Record
GHSA-m9m5-cg5h-r582- CVSS 3.1
- 5.1 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N - Weakness
- CWE-338
- Updated
- 2026-11-02
OSVGHSA-m9m5-cg5h-r582
5.1
Improper random number generation in nanorand
In versions of nanorand prior to 0.5.1, RandomGen implementations for standard unsigned integers could fail to properly generate numbers, due to using bit-shifting to truncate a 64-bit number, rather than just an as conversion. This often manifested as RNGs returning nothing but 0, including the cryptographically secure ChaCha random number generator.
- Record
GHSA-m9m5-cg5h-r582- CVSS 3.1
- 5.1 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N - Weakness
- CWE-338
- Updated
- 2026-11-02
OSVRUSTSEC-2020-0089
5.1
nanorand 0.5.0 - RNGs failed to generate properly for non-64-bit numbers
In versions of nanorand prior to 0.5.1, RandomGen implementations for standard unsigned integers could
fail to properly generate numbers, due to using bit-shifting to truncate a 64-bit number, rather than just
an as conversion.
This often manifested as RNGs returning nothing but 0, including the cryptographically secure ChaCha random
number generator..
- Record
RUSTSEC-2020-0089- CVSS 3.1
- 5.1 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N - Updated
- 2026-11-02
Affected products
Affected packages
History
| Recorded | Changed | Sources |
|---|---|---|
| aliases | EUVD | |
| first indexed | CVE List, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2020-35926 is a critical vulnerability (CVSS 9.8) in Nanorand Project Nanorand, published December 9, 2020. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 1.53%, the 74th percentile. Fixed in nanorand 0.5.1.
References
rustsec.org/advisories/RUSTSEC-2020-0089.html
nvd.nist.gov/vuln/detail/CVE-2020-35926
github.com/Absolucy/nanorand-rs/commit/5ba218ac29df4786b002d7d12b47fa0c04a331f2
twitter.com/aspenluxxxy/status/1336684692284772352
github.com/advisories/GHSA-m9m5-cg5h-r582
github.com/Absolucy/nanorand-rs
crates.io/crates/nanorand