Vulnerability CriticalRUSTSEC-2021-0100 · sha2
RUSTSEC-2021-0100: Miscomputed results when using AVX2 backend
Short answerA security vulnerability in the sha2 crate: Miscomputed results when using AVX2 backend. GitHub rates it Critical. Fixed in 0.9.8: update to a fixed version.
| Crate | sha2 |
|---|---|
| Type | Vulnerability (crypto-failure) |
| Affected versions | From 0.9.7 before 0.9.8. |
| Fixed in | 0.9.8 |
| Severity | Critical (GitHub rating) |
| Published | 2021-09-08 |
| Last changed | 2023-11-08 |
| Also known as | CVE-2021-45696, GHSA-fc7x-2cmc-8j2g, GHSA-xpww-g9jx-hp8r |
What to do
- See which version you have:
cargo tree -i sha2(it also shows which of your dependencies pulls it in). - Update within your version requirement:
cargo update -p sha2. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for examplesha2 = "0.9.8") 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
The v0.9.7 release of the sha2 crate introduced a new AVX2-accelerated backend which was automatically enabled for all x86/x86_64 CPUs where AVX2 support was autodetected at runtime.
This backend was buggy and would miscompute results for long messages (i.e. messages spanning multiple SHA blocks).
The crate has since been yanked, but any users who upgraded to v0.9.7 should immediately upgrade to v0.9.8 and recompute any hashes which were previously computed by v0.9.7.
References
- Package: crates.io/crates/sha2
- Advisory: rustsec.org/advisories/RUSTSEC-2021-0100.html
- Web: github.com/RustCrypto/hashes/pull/314
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
Same cratesha2: security historyEvery advisory for this crate, and whether it is safe to use today.Read it next →Did this answer your question?