Advisory Database
  • Advisories
  • Dependency Scanning
  1. cargo
  2. ›
  3. sha2
  4. ›
  5. CVE-2021-45696

CVE-2021-45696: Incorrect hash in sha2

January 6, 2022 (updated June 13, 2023)

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

  • github.com/RustCrypto/hashes
  • github.com/RustCrypto/hashes/pull/314
  • github.com/advisories/GHSA-fc7x-2cmc-8j2g
  • nvd.nist.gov/vuln/detail/CVE-2021-45696
  • raw.githubusercontent.com/rustsec/advisory-db/main/crates/sha2/RUSTSEC-2021-0100.md
  • rustsec.org/advisories/RUSTSEC-2021-0100.html

Code Behaviors & Features

Detect and mitigate CVE-2021-45696 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions starting from 0.9.7 before 0.9.8, version 0.9.7

Fixed versions

  • 0.9.8

Solution

Upgrade to version 0.9.8 or above.

Impact 9.8 CRITICAL

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Learn more about CVSS

Weakness

  • CWE-327: Use of a Broken or Risky Cryptographic Algorithm

Source file

cargo/sha2/CVE-2021-45696.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 14 May 2025 12:16:13 +0000.