GHSA-xpww-g9jx-hp8r: Sha2 Miscomputed Sha2 Results When Using Vulnerability

HIGH
Published
Advisory Summary

GHSA-xpww-g9jx-hp8r is a HIGH miscomputed sha2 results when using vulnerability (General Security Weakness) affecting Sha2 libraries in the crates.io ecosystem. The issue involves miscomputed sha2 results when using avx2 backend. Remediation is available by upgrading affected packages to version 0.9.8.

GHSA-xpww-g9jx-hp8r at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-xpww-g9jx-hp8r
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product Sha2
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix GHSA-xpww-g9jx-hp8r

To remediate this vulnerability, upgrade all affected Sha2 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

sha2 fixed: 0.9.8
Upgrade sha2 to 0.9.8
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for sha2

How to Check if You Are Affected

To determine whether your application is affected by GHSA-xpww-g9jx-hp8r, inspect your project dependencies for Sha2:

inspect dependencies for sha2

Analyze the terminal output to locate any version of Sha2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.9.8), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under General Security Weakness. In Sha2, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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.

GHSA-xpww-g9jx-hp8r Affected Sha2 Versions

1 component(s)
Fixed Versions:
0.9.8
Product / Package Ecosystem Affected Versions Fixed Version
sha2
crates.io
≥ 0.9.7
< 0.9.8
All 1 versions
0.9.7
0.9.8

References

Frequently Asked Questions

What is GHSA-xpww-g9jx-hp8r?
GHSA-xpww-g9jx-hp8r is a security vulnerability in Sha2 involving Miscomputed sha2 results when using AVX2 backend under General Security Weakness.
Which Sha2 versions are affected?
Affected versions include releases prior to 0.9.8 across affected packages: sha2.
What version fixes GHSA-xpww-g9jx-hp8r?
Upgrading to 0.9.8 (or the latest patched release for your respective branch) resolves the vulnerability.
Is sha2 affected?
Yes, sha2 is affected in releases prior to 0.9.8. Upgrade your dependency to 0.9.8 or later.
What CWE is associated with GHSA-xpww-g9jx-hp8r?
GHSA-xpww-g9jx-hp8r is classified under General Security Weakness.
How can I check crates.io dependencies for GHSA-xpww-g9jx-hp8r?
Run the dependency tree command: 'inspect dependencies for sha2'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-xpww-g9jx-hp8r",
  "modified" : "2022-06-17T00:19:35Z",
  "published" : "2022-06-17T00:19:35Z",
  "aliases" : [ ],
  "summary" : "Miscomputed sha2 results when using AVX2 backend",
  "details" : "The v0.9.7 release of the `sha2` crate introduced a new AVX2-accelerated\nbackend which was automatically enabled for all x86/x86_64 CPUs where AVX2\nsupport was autodetected at runtime.\n\nThis backend was buggy and would miscompute results for long messages\n(i.e. messages spanning multiple SHA blocks).\n\nThe crate has since been yanked, but any users who upgraded to v0.9.7 should\nimmediately upgrade to v0.9.8 and recompute any hashes which were previously\ncomputed by v0.9.7.\n",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "sha2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.9.7"
      }, {
        "fixed" : "0.9.8"
      } ]
    } ],
    "versions" : [ "0.9.7" ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/RustCrypto/hashes/pull/314"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/RustCrypto/hashes"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2021-0100.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-06-17T00:19:35Z",
    "nvd_published_at" : null
  }
}