GHSA-gw5w-5j7f-jmjj: Unsound usages of `std :slice::from_raw_parts` Vulnerability

LOW
Published
Advisory Summary

GHSA-gw5w-5j7f-jmjj is a LOW :slice::from_raw_parts` vulnerability (General Security Weakness) affecting Unsound usages of `std libraries in the crates.io ecosystem. The issue involves :slice::from_raw_parts`. Remediation is available by upgrading affected packages to version 0.14.0.

GHSA-gw5w-5j7f-jmjj at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-gw5w-5j7f-jmjj
Severity LOW
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product Unsound usages of `std
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix GHSA-gw5w-5j7f-jmjj

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

pprof fixed: 0.14.0
Upgrade pprof to 0.14.0
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 pprof

How to Check if You Are Affected

To determine whether your application is affected by GHSA-gw5w-5j7f-jmjj, inspect your project dependencies for Unsound usages of `std:

inspect dependencies for pprof

Analyze the terminal output to locate any version of Unsound usages of `std in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.14.0), 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 Unsound usages of `std, 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 library breaks the safety assumptions when using unsafe API `std::slice::from_raw_parts`. First, when using the API in iterator implementation (`TempFdArrayIterator.next`), generic type could be any type, which would create and pass a misaligned pointer to the unsafe API. Second, when validating the address, the code passed the type `c_void`, which could also be any type, leading to potential uninitialized memory exposure. Two unsound usages here highlight the necessity for developers to perform type checks before doing type conversion with unsafe API. The panic caused by the misalignment causes several downstream applications (e.g., `greptimedb`) to crash when using `pprof::report::ReportBuilder::build`. This was patched in 0.14.0. The developer also suggested moving to [pprof2](https://crates.io/crates/pprof2).

GHSA-gw5w-5j7f-jmjj Affected Unsound usages of `std Versions

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

References

Frequently Asked Questions

What is GHSA-gw5w-5j7f-jmjj?
GHSA-gw5w-5j7f-jmjj is a security vulnerability in Unsound usages of `std involving :slice::from_raw_parts` under General Security Weakness.
Which Unsound usages of `std versions are affected?
Affected versions include releases prior to 0.14.0 across affected packages: pprof.
What version fixes GHSA-gw5w-5j7f-jmjj?
Upgrading to 0.14.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is pprof affected?
Yes, pprof is affected in releases prior to 0.14.0. Upgrade your dependency to 0.14.0 or later.
What CWE is associated with GHSA-gw5w-5j7f-jmjj?
GHSA-gw5w-5j7f-jmjj is classified under General Security Weakness.
How can I check crates.io dependencies for GHSA-gw5w-5j7f-jmjj?
Run the dependency tree command: 'inspect dependencies for pprof'. 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-gw5w-5j7f-jmjj",
  "modified" : "2024-12-05T19:05:57Z",
  "published" : "2024-12-05T19:05:57Z",
  "aliases" : [ ],
  "summary" : "Unsound usages of `std::slice::from_raw_parts` ",
  "details" : "The library breaks the safety assumptions when using unsafe API `std::slice::from_raw_parts`. First, when using the API in iterator implementation (`TempFdArrayIterator.next`), generic type could be any type, which would create and pass a misaligned pointer to the unsafe API. Second, when validating the address, the code passed the type `c_void`, which could also be any type, leading to potential uninitialized memory exposure.  \n\nTwo unsound usages here highlight the necessity for developers to perform type checks before doing type conversion with unsafe API.  \n\nThe panic caused by the misalignment causes several downstream applications (e.g., `greptimedb`) to crash when using `pprof::report::ReportBuilder::build`.  \n\nThis was patched in 0.14.0.  \n\nThe developer also suggested moving to [pprof2](https://crates.io/crates/pprof2).  \n",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "pprof"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.14.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/tikv/pprof-rs/issues/232"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/tikv/pprof-rs"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2024-0408.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-12-05T19:05:57Z",
    "nvd_published_at" : null
  }
}