GHSA-jp37-5qhw-mffw: Sharks Sharks Has A Bias Of Vulnerability

MODERATE
CWE-334
Published
Advisory Summary

GHSA-jp37-5qhw-mffw is a MODERATE sharks has a bias of vulnerability (CWE-334: Small Space of Random Values) affecting Sharks libraries in the crates.io ecosystem. The issue involves sharks has a bias of polynomial coefficients in secret sharing. Remediation is available in the latest vendor maintenance releases.

GHSA-jp37-5qhw-mffw at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-jp37-5qhw-mffw
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-334: Small Space of Random Values
Affected Product Sharks
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix GHSA-jp37-5qhw-mffw

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

sharks fixed: Latest secure release
Upgrade sharks to Latest secure release
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 sharks

How to Check if You Are Affected

To determine whether your application is affected by GHSA-jp37-5qhw-mffw, inspect your project dependencies for Sharks:

inspect dependencies for sharks

Analyze the terminal output to locate any version of Sharks in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), 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 CWE-334: Small Space of Random Values, where the number of possible random values is smaller than needed by the product, making it more susceptible to brute force attacks. In Sharks, 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

Affected versions of this crate allowed for a bias when generating random polynomials for Shamir Secret Sharing, where instead of being within the range `[0, 255]` they were instead in the range `[1, 255]`. A description from Cure53, who originally found the issue, is available: > The correct method to select a random polynomial would be to select all coefficients (including the most significant coefficient) uniformly in the range 0..255 (inclusive). Otherwise, knowledge that a coefficient in a polynomial cannot be 0 permits the exclusion of single byte values for the shared secret given one share less than required. [...] Exploiting this weakness necessitates sharing the same secret multiple times. In this scenario, an attacker could exclude an exponential number of values for each of the shared bytes until sufficiently few values remain for brute forcing. Cure53 estimates that under ideal circumstances (e.g., a 2-out-of-N scheme) a shared secret can be reconstructed if the same secret has been distributed 500-1500 times. Secrets that have been shared a low amount of times (ideally, once) would not be impacted. However, secrets that are repeatedly shared may be vulnerable, especially if the shares are still available, and should be rotated. The vulnerability does not impact reconstitution of secrets: secrets that have already been split can be recombined without issue. The flaw can be corrected by changing the lower bound of the polynomial coefficient range in the `sharks::math::random_polynomial` function to `0`. The `blahaj` crate has been made available with a fixed version of the code, after attempts to reach the maintainer of the `sharks` crate were unsuccessful.

GHSA-jp37-5qhw-mffw Affected Sharks Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
sharks
crates.io
≤ 0.5.0

References

Frequently Asked Questions

What is GHSA-jp37-5qhw-mffw?
GHSA-jp37-5qhw-mffw is a security vulnerability in Sharks involving Sharks has a Bias of Polynomial Coefficients in Secret Sharing under CWE-334: Small Space of Random Values.
Which Sharks versions are affected?
Affected versions include releases prior to current release patches across affected packages: sharks.
What version fixes GHSA-jp37-5qhw-mffw?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is sharks affected?
Yes, sharks is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What CWE is associated with GHSA-jp37-5qhw-mffw?
GHSA-jp37-5qhw-mffw is classified under CWE-334: Small Space of Random Values (The number of possible random values is smaller than needed by the product, making it more susceptible to brute force attacks.).
How can I check crates.io dependencies for GHSA-jp37-5qhw-mffw?
Run the dependency tree command: 'inspect dependencies for sharks'. 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-jp37-5qhw-mffw",
  "modified" : "2024-11-18T20:03:25Z",
  "published" : "2024-11-18T20:03:25Z",
  "aliases" : [ ],
  "summary" : "Sharks has a Bias of Polynomial Coefficients in Secret Sharing",
  "details" : "Affected versions of this crate allowed for a bias when generating random polynomials for Shamir Secret Sharing, where instead of being within the range `[0, 255]` they were instead in the range `[1, 255]`. A description from Cure53, who originally found the issue, is available:\n\n> The correct method to select a random polynomial would be to select all coefficients (including the most significant coefficient) uniformly in the range 0..255 (inclusive). Otherwise, knowledge that a coefficient in a polynomial cannot be 0 permits the exclusion of single byte values for the shared secret given one share less than required. [...] Exploiting this weakness necessitates sharing the same secret multiple times. In this scenario, an attacker could exclude an exponential number of values for each of the shared bytes until sufficiently few values remain for brute forcing.  Cure53 estimates that under ideal circumstances (e.g., a 2-out-of-N scheme) a shared secret can be reconstructed if the same secret has been distributed 500-1500 times.\n\nSecrets that have been shared a low amount of times (ideally, once) would not be impacted. However, secrets that are repeatedly shared may be vulnerable, especially if the shares are still available, and should be rotated.\n\nThe vulnerability does not impact reconstitution of secrets: secrets that have already been split can be recombined without issue.\n\nThe flaw can be corrected by changing the lower bound of the polynomial coefficient range in the `sharks::math::random_polynomial` function to `0`. The `blahaj` crate has been made available with a fixed version of the code, after attempts to reach the maintainer of the `sharks` crate were unsuccessful.\n",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:P/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "sharks"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "0.5.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://git.distrust.co/public/blahaj/commit/4faab1cd33d455f0ca2ccc7208093fd6c18e0767"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/c0dearm/sharks"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2024-0398.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-334" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-11-18T20:03:25Z",
    "nvd_published_at" : null
  }
}