{"id":"CVE-2020-35926","aliases":["EUVD-2021-1796","GHSA-m9m5-cg5h-r582","RUSTSEC-2020-0089"],"status":"published","title":"Improper random number generation in nanorand","description":"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.","severity":{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical","assessor":"primary","from":"nvd"},"epss":{"day":"2026-11-09","score":0.01534,"percentile":0.74998,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-330","CWE-338","CWE-681"],"published":"2020-12-09T12:00:00Z","modified":"2026-06-17T03:14:37Z","fixes":[{"ecosystem":"crates.io","package":"nanorand","fixed_in":["0.5.1"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"crates.io","package":"nanorand","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"0.5.1"}]}]},{"source":"osv","ecosystem":"crates.io","package":"nanorand","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"0.5.1"}]}]},{"source":"osv","ecosystem":"crates.io","package":"nanorand","ranges":[{"type":"SEMVER","events":[{"introduced":"0.0.0-0"},{"fixed":"0.5.1"}]}]}],"products":[{"vendor":"nanorand_project","product":"nanorand"}],"references":[{"url":"https://rustsec.org/advisories/RUSTSEC-2020-0089.html","tags":["x_refsource_MISC","x_transferred","Third Party Advisory","web","advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2020-35926","tags":["advisory"]},{"url":"https://github.com/Absolucy/nanorand-rs/commit/5ba218ac29df4786b002d7d12b47fa0c04a331f2","tags":["web"]},{"url":"https://twitter.com/aspenluxxxy/status/1336684692284772352","tags":["web"]},{"url":"https://github.com/advisories/GHSA-m9m5-cg5h-r582"},{"url":"https://github.com/Absolucy/nanorand-rs","tags":["package"]},{"url":"https://crates.io/crates/nanorand","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2020-35926","description":"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.","status":"published","published":"2020-12-31T08:16:30Z","modified":"2024-08-04T17:16:13.237Z","updated_at":"2026-11-02T14:35:57.67317Z"}],"euvd":[{"id":"EUVD-2021-1796","description":"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.","status":"published","published":"2020-12-31T08:16:30Z","modified":"2024-08-04T17:16:13Z","updated_at":"2026-11-03T03:07:04.595509Z"}],"ghsa":[{"id":"GHSA-m9m5-cg5h-r582","title":"Improper random number generation in nanorand","description":"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.","status":"published","published":"2021-08-25T20:50:24Z","modified":"2023-06-13T20:01:40Z","cvss":[{"version":"3.1","score":5.1,"vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N","level":"medium"}],"cwes":["CWE-338"],"updated_at":"2026-11-02T14:36:53.654352Z"}],"nvd":[{"id":"CVE-2020-35926","description":"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.","status":"published","published":"2020-12-31T09:15:16.38Z","modified":"2026-06-17T03:14:37.22Z","cvss":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical","assessor":"primary"},{"version":"2.0","score":7.5,"vector":"AV:N/AC:L/Au:N/C:P/I:P/A:P","level":"high","assessor":"primary"}],"cwes":["CWE-330","CWE-681"],"updated_at":"2026-11-02T14:06:28.340168Z"}],"osv":[{"id":"GHSA-m9m5-cg5h-r582","title":"Improper random number generation in nanorand","description":"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.","status":"published","published":"2021-08-25T20:50:24Z","modified":"2023-11-08T04:03:39.76967Z","cvss":[{"version":"3.1","score":5.1,"vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N","level":"medium"}],"cwes":["CWE-338"],"updated_at":"2026-11-02T15:46:51.811331Z"},{"id":"RUSTSEC-2020-0089","title":"nanorand 0.5.0 - RNGs failed to generate properly for non-64-bit numbers","description":"In versions of `nanorand` prior to 0.5.1, `RandomGen` implementations for standard unsigned integers could\nfail to properly generate numbers, due to using bit-shifting to truncate a 64-bit number, rather than just\nan `as` conversion.\n\nThis often manifested as RNGs returning nothing but 0, including the cryptographically secure `ChaCha` random\nnumber generator..","status":"published","published":"2020-12-09T12:00:00Z","modified":"2023-11-08T04:03:39.76967Z","cvss":[{"version":"3.1","score":5.1,"vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N","level":"medium"}],"updated_at":"2026-11-02T15:53:39.492624Z"}]}}
