GHSA-wfg4-322g-9vqv: Memoffset Memoffset Allows Reading Uninitialized Memory Vulnerability

MODERATE
Published
Advisory Summary

GHSA-wfg4-322g-9vqv is a MODERATE memoffset allows reading uninitialized memory vulnerability (General Security Weakness) affecting Memoffset libraries in the crates.io ecosystem. The issue involves memoffset allows reading uninitialized memory. Remediation is available by upgrading affected packages to version 0.6.2.

GHSA-wfg4-322g-9vqv at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-wfg4-322g-9vqv
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product Memoffset
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix GHSA-wfg4-322g-9vqv

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

memoffset fixed: 0.6.2
Upgrade memoffset to 0.6.2
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 memoffset

How to Check if You Are Affected

To determine whether your application is affected by GHSA-wfg4-322g-9vqv, inspect your project dependencies for Memoffset:

inspect dependencies for memoffset

Analyze the terminal output to locate any version of Memoffset in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.6.2), 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 Memoffset, 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

memoffset allows attempt of reading data from address `0` with arbitrary type. This behavior is an undefined behavior because address `0` to `std::mem::size_of<T>` may not have valid bit-pattern with `T`. Old implementation dereferences uninitialized memory obtained from `std::mem::align_of`. Older implementation prior to it allows using uninitialized data obtained from `std::mem::uninitialized` with arbitrary type then compute offset by taking the address of field-projection. This may also result in an undefined behavior for "father" that includes (directly or transitively) type that [does not allow to be uninitialized](https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html). This flaw was corrected by using `std::ptr::addr_of` in <https://github.com/Gilnaa/memoffset/pull/50>.

GHSA-wfg4-322g-9vqv Affected Memoffset Versions

1 component(s)
Fixed Versions:
0.6.2
Product / Package Ecosystem Affected Versions Fixed Version
memoffset
crates.io
< 0.6.2
0.6.2

References

Frequently Asked Questions

What is GHSA-wfg4-322g-9vqv?
GHSA-wfg4-322g-9vqv is a security vulnerability in Memoffset involving memoffset allows reading uninitialized memory under General Security Weakness.
Which Memoffset versions are affected?
Affected versions include releases prior to 0.6.2 across affected packages: memoffset.
What version fixes GHSA-wfg4-322g-9vqv?
Upgrading to 0.6.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is memoffset affected?
Yes, memoffset is affected in releases prior to 0.6.2. Upgrade your dependency to 0.6.2 or later.
What CWE is associated with GHSA-wfg4-322g-9vqv?
GHSA-wfg4-322g-9vqv is classified under General Security Weakness.
How can I check crates.io dependencies for GHSA-wfg4-322g-9vqv?
Run the dependency tree command: 'inspect dependencies for memoffset'. 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-wfg4-322g-9vqv",
  "modified" : "2023-06-21T22:06:29Z",
  "published" : "2023-06-21T22:06:29Z",
  "aliases" : [ ],
  "summary" : "memoffset allows reading uninitialized memory",
  "details" : "memoffset allows attempt of reading data from address `0` with arbitrary type. This behavior is an undefined behavior because address `0` to `std::mem::size_of<T>` may not have valid bit-pattern with `T`. Old implementation dereferences uninitialized memory obtained from `std::mem::align_of`. Older implementation prior to it allows using uninitialized data obtained from `std::mem::uninitialized` with arbitrary type then compute offset by taking the address of field-projection. This may also result in an undefined behavior for \"father\" that includes (directly or transitively) type that [does not allow to be uninitialized](https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html).\n\nThis flaw was corrected by using `std::ptr::addr_of` in <https://github.com/Gilnaa/memoffset/pull/50>.\n",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "memoffset"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.6.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/Gilnaa/memoffset/issues/24"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Gilnaa/memoffset/pull/50"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Gilnaa/memoffset"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2023-0045.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-06-21T22:06:29Z",
    "nvd_published_at" : null
  }
}