GHSA-rjhf-4mh8-9xjq: Zerocopy Some Ref Methods Are Unsound Vulnerability

MODERATE
Published
Advisory Summary

GHSA-rjhf-4mh8-9xjq is a MODERATE some ref methods are unsound vulnerability (General Security Weakness) affecting Zerocopy libraries in the crates.io ecosystem. The issue involves some ref methods are unsound with some type parameters. Remediation is available by upgrading affected packages to version 0.2.9, 0.3.2, 0.4.1, 0.5.2, 0.6.6, 0.7.31.

GHSA-rjhf-4mh8-9xjq at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-rjhf-4mh8-9xjq
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product Zerocopy
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix GHSA-rjhf-4mh8-9xjq

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

zerocopy fixed: 0.2.9
Upgrade zerocopy to 0.2.9
zerocopy fixed: 0.3.2
Upgrade zerocopy to 0.3.2
zerocopy fixed: 0.4.1
Upgrade zerocopy to 0.4.1
zerocopy fixed: 0.5.2
Upgrade zerocopy to 0.5.2
zerocopy fixed: 0.6.6
Upgrade zerocopy to 0.6.6
zerocopy fixed: 0.7.31
Upgrade zerocopy to 0.7.31
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 zerocopy

How to Check if You Are Affected

To determine whether your application is affected by GHSA-rjhf-4mh8-9xjq, inspect your project dependencies for Zerocopy:

inspect dependencies for zerocopy

Analyze the terminal output to locate any version of Zerocopy in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.2.9), 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 Zerocopy, 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 `Ref` methods `into_ref`, `into_mut`, `into_slice`, and `into_slice_mut` are unsound and may allow safe code to exhibit undefined behavior when used with `Ref<B, T>` where `B` is [`cell::Ref`](https://doc.rust-lang.org/core/cell/struct.Ref.html) or [`cell::RefMut`](https://doc.rust-lang.org/core/cell/struct.RefMut.html). Note that these methods remain sound when used with `B` types other than `cell::Ref` or `cell::RefMut`. See https://github.com/google/zerocopy/issues/716 for a more in-depth analysis. The current plan is to yank the affected versions soon. See https://github.com/google/zerocopy/issues/679 for more detail.

GHSA-rjhf-4mh8-9xjq Affected Zerocopy Versions

6 component(s)
Fixed Versions:
0.2.90.3.20.4.10.5.20.6.60.7.31
Product / Package Ecosystem Affected Versions Fixed Version
zerocopy
crates.io
≥ 0.2.2
< 0.2.9
0.2.9
zerocopy
crates.io
≥ 0.3.0
< 0.3.2
0.3.2
zerocopy
crates.io
≥ 0.4.0
< 0.4.1
0.4.1
zerocopy
crates.io
≥ 0.5.0
< 0.5.2
0.5.2
zerocopy
crates.io
≥ 0.6.0
< 0.6.6
0.6.6
zerocopy
crates.io
≥ 0.7.0
< 0.7.31
0.7.31

References

Frequently Asked Questions

What is GHSA-rjhf-4mh8-9xjq?
GHSA-rjhf-4mh8-9xjq is a security vulnerability in Zerocopy involving Some Ref methods are unsound with some type parameters under General Security Weakness.
Which Zerocopy versions are affected?
Affected versions include releases prior to 0.2.9, 0.3.2, 0.4.1, 0.5.2, 0.6.6, 0.7.31 across affected packages: zerocopy.
What version fixes GHSA-rjhf-4mh8-9xjq?
Upgrading to 0.2.9, 0.3.2, 0.4.1, 0.5.2, 0.6.6, 0.7.31 (or the latest patched release for your respective branch) resolves the vulnerability.
Is zerocopy affected?
Yes, zerocopy is affected in releases prior to 0.2.9, 0.3.2, 0.4.1, 0.5.2, 0.6.6, 0.7.31. Upgrade your dependency to 0.2.9, 0.3.2, 0.4.1, 0.5.2, 0.6.6, 0.7.31 or later.
What CWE is associated with GHSA-rjhf-4mh8-9xjq?
GHSA-rjhf-4mh8-9xjq is classified under General Security Weakness.
How can I check crates.io dependencies for GHSA-rjhf-4mh8-9xjq?
Run the dependency tree command: 'inspect dependencies for zerocopy'. 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-rjhf-4mh8-9xjq",
  "modified" : "2024-02-12T15:57:50Z",
  "published" : "2023-12-18T19:18:46Z",
  "aliases" : [ ],
  "summary" : "Zerocopy: Some Ref methods are unsound with some type parameters",
  "details" : "The `Ref` methods `into_ref`, `into_mut`, `into_slice`, and `into_slice_mut` are unsound and may allow safe code to exhibit undefined behavior when used with `Ref<B, T>` where `B` is [`cell::Ref`](https://doc.rust-lang.org/core/cell/struct.Ref.html) or [`cell::RefMut`](https://doc.rust-lang.org/core/cell/struct.RefMut.html). Note that these methods remain sound when used with `B` types other than `cell::Ref` or `cell::RefMut`.\n\nSee https://github.com/google/zerocopy/issues/716 for a more in-depth analysis.\n\nThe current plan is to yank the affected versions soon. See https://github.com/google/zerocopy/issues/679 for more detail.\n",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "zerocopy"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.2.2"
      }, {
        "fixed" : "0.2.9"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "zerocopy"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.3.0"
      }, {
        "fixed" : "0.3.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "zerocopy"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.4.0"
      }, {
        "fixed" : "0.4.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "zerocopy"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.5.0"
      }, {
        "fixed" : "0.5.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "zerocopy"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.6.0"
      }, {
        "fixed" : "0.6.6"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "zerocopy"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.7.0"
      }, {
        "fixed" : "0.7.31"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/google/zerocopy/issues/679"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/google/zerocopy/issues/71"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/google/zerocopy/issues/716"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/google/zerocopy"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2023-0074.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-12-18T19:18:46Z",
    "nvd_published_at" : null
  }
}