GHSA-74r5-g7vc-j2v2: Zerovec derive Zerovec-derive Incorrectly Uses `#[repr(packed)]` Vulnerability

MODERATE
CVSS 6.2
CWE-120
Published
Advisory Summary

GHSA-74r5-g7vc-j2v2 is a MODERATE (CVSS 6.2) zerovec-derive incorrectly uses `#[repr(packed)]` vulnerability (CWE-120: Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')) affecting Zerovec derive libraries in the crates.io ecosystem. The issue involves zerovec-derive incorrectly uses `#[repr(packed)]`. Remediation is available by upgrading affected packages to version 0.10.3, 0.9.7.

GHSA-74r5-g7vc-j2v2 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-74r5-g7vc-j2v2
Severity MODERATE
CVSS v3.1 Base Score 6.2
CWE Classification CWE-120: Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')
Affected Product Zerovec derive
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 6.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N).

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity High (I:H)
Availability None (A:N)

How to Fix GHSA-74r5-g7vc-j2v2

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

zerovec-derive fixed: 0.10.3
Upgrade zerovec-derive to 0.10.3
zerovec-derive fixed: 0.9.7
Upgrade zerovec-derive to 0.9.7
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 zerovec-derive

How to Check if You Are Affected

To determine whether your application is affected by GHSA-74r5-g7vc-j2v2, inspect your project dependencies for Zerovec derive:

inspect dependencies for zerovec-derive

Analyze the terminal output to locate any version of Zerovec derive in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.10.3), 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-120: Buffer Copy without Checking Size of Input ('Classic Buffer Overflow'), where the product copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer. In Zerovec derive, 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 affected versions make unsafe memory accesses under the assumption that `#[repr(packed)]` has a guaranteed field order. The Rust specification does not guarantee this, and https://github.com/rust-lang/rust/pull/125360 (1.80.0-beta) starts reordering fields of `#[repr(packed)]` structs, leading to illegal memory accesses. The patched versions `0.9.7` and `0.10.3` use `#[repr(C, packed)]`, which guarantees field order.

GHSA-74r5-g7vc-j2v2 Affected Zerovec derive Versions

2 component(s)
Fixed Versions:
0.10.30.9.7
Product / Package Ecosystem Affected Versions Fixed Version
zerovec-derive
crates.io
≥ 0.10.0
< 0.10.3
0.10.3
zerovec-derive
crates.io
< 0.9.7
0.9.7

References

Frequently Asked Questions

What is GHSA-74r5-g7vc-j2v2?
GHSA-74r5-g7vc-j2v2 is a security vulnerability in Zerovec derive involving zerovec-derive incorrectly uses `#[repr(packed)]` under CWE-120: Buffer Copy without Checking Size of Input ('Classic Buffer Overflow').
Which Zerovec derive versions are affected?
Affected versions include releases prior to 0.10.3, 0.9.7 across affected packages: zerovec-derive.
What version fixes GHSA-74r5-g7vc-j2v2?
Upgrading to 0.10.3, 0.9.7 (or the latest patched release for your respective branch) resolves the vulnerability.
Is zerovec-derive affected?
Yes, zerovec-derive is affected in releases prior to 0.10.3, 0.9.7. Upgrade your dependency to 0.10.3, 0.9.7 or later.
What is the CVSS score of GHSA-74r5-g7vc-j2v2?
GHSA-74r5-g7vc-j2v2 has a CVSS v3.1 base score of 6.2 (MODERATE) with vector string CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N.
What CWE is associated with GHSA-74r5-g7vc-j2v2?
GHSA-74r5-g7vc-j2v2 is classified under CWE-120: Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') (The product copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer.).
How can I check crates.io dependencies for GHSA-74r5-g7vc-j2v2?
Run the dependency tree command: 'inspect dependencies for zerovec-derive'. 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-74r5-g7vc-j2v2",
  "modified" : "2024-07-09T19:45:09Z",
  "published" : "2024-07-08T18:39:18Z",
  "aliases" : [ ],
  "summary" : "zerovec-derive incorrectly uses `#[repr(packed)]`",
  "details" : "The affected versions make unsafe memory accesses under the assumption that `#[repr(packed)]` has a guaranteed field order. \n\nThe Rust specification does not guarantee this, and https://github.com/rust-lang/rust/pull/125360 (1.80.0-beta) starts \nreordering fields of `#[repr(packed)]` structs, leading to illegal memory accesses.\n\nThe patched versions `0.9.7` and `0.10.3` use `#[repr(C, packed)]`, which guarantees field order.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "zerovec-derive"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.10.0"
      }, {
        "fixed" : "0.10.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "zerovec-derive"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.9.7"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/unicode-org/icu4x/issues/5196#issuecomment-2214711069"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rustsec/advisory-db/pull/2007"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2024-0346.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-120" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-07-08T18:39:18Z",
    "nvd_published_at" : null
  }
}