GHSA-xfhw-6mc4-mgxf: crayon ObjectPool Creates Uninitialized Memory When Vulnerability

HIGH
CVSS 7.5
CWE-908
Published
Advisory Summary

GHSA-xfhw-6mc4-mgxf is a HIGH (CVSS 7.5) objectpool creates uninitialized memory when vulnerability (CWE-908: Use of Uninitialized Resource) affecting crayon libraries in the crates.io ecosystem. The issue involves objectpool creates uninitialized memory when freeing objects. Remediation is available in the latest vendor maintenance releases.

GHSA-xfhw-6mc4-mgxf at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-xfhw-6mc4-mgxf
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-908: Use of Uninitialized Resource
Affected Product crayon
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 7.5

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

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

How to Fix GHSA-xfhw-6mc4-mgxf

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

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

How to Check if You Are Affected

To determine whether your application is affected by GHSA-xfhw-6mc4-mgxf, inspect your project dependencies for crayon:

inspect dependencies for crayon

Analyze the terminal output to locate any version of crayon 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-908: Use of Uninitialized Resource, where the product uses or accesses a resource that has not been initialized. In crayon, 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

As of version 0.6.0, the ObjectPool explicitly creates an uninitialized instance of its type parameter when it attempts to free an object, and swaps it into the storage. This causes instant undefined behavior due to reading the uninitialized memory in order to write it to the pool storage. Extremely basic usage of the crate can trigger this issue, e.g. this code from a doctest: ```rust use crayon::prelude::*; application::oneshot().unwrap(); let mut params = MeshParams::default(); let mesh = video::create_mesh(params, None).unwrap(); // Deletes the mesh object. video::delete_mesh(mesh); // <-- UB ``` The Clippy warning for this code was silenced in commit c2fde19caf6149d91faa504263f0bc5cafc35de5. Discovered via https://asan.saethlin.dev/ub?crate=crayon&version=0.7.1

GHSA-xfhw-6mc4-mgxf Affected crayon Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
crayon
crates.io
≥ 0.6.0
≤ 0.7.1

References

Frequently Asked Questions

What is GHSA-xfhw-6mc4-mgxf?
GHSA-xfhw-6mc4-mgxf is a security vulnerability in crayon involving ObjectPool creates uninitialized memory when freeing objects under CWE-908: Use of Uninitialized Resource.
Which crayon versions are affected?
Affected versions include releases prior to current release patches across affected packages: crayon.
What version fixes GHSA-xfhw-6mc4-mgxf?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is crayon affected?
Yes, crayon is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of GHSA-xfhw-6mc4-mgxf?
GHSA-xfhw-6mc4-mgxf has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with GHSA-xfhw-6mc4-mgxf?
GHSA-xfhw-6mc4-mgxf is classified under CWE-908: Use of Uninitialized Resource (The product uses or accesses a resource that has not been initialized.).
How can I check crates.io dependencies for GHSA-xfhw-6mc4-mgxf?
Run the dependency tree command: 'inspect dependencies for crayon'. 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-xfhw-6mc4-mgxf",
  "modified" : "2024-04-05T15:40:40Z",
  "published" : "2024-04-05T15:40:40Z",
  "aliases" : [ ],
  "summary" : "crayon: ObjectPool creates uninitialized memory when freeing objects",
  "details" : "As of version 0.6.0, the ObjectPool explicitly creates an uninitialized instance of its type parameter when it attempts to free an object, and swaps it into the storage. This causes instant undefined behavior due to reading the uninitialized memory in order to write it to the pool storage.\n\nExtremely basic usage of the crate can trigger this issue, e.g. this code from a doctest:\n\n```rust\nuse crayon::prelude::*;\napplication::oneshot().unwrap();\n\nlet mut params = MeshParams::default();\n\nlet mesh = video::create_mesh(params, None).unwrap();\n\n// Deletes the mesh object.\nvideo::delete_mesh(mesh); // <-- UB\n```\n\nThe Clippy warning for this code was silenced in commit c2fde19caf6149d91faa504263f0bc5cafc35de5.\n\nDiscovered via https://asan.saethlin.dev/ub?crate=crayon&version=0.7.1\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "crayon"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.6.0"
      }, {
        "last_affected" : "0.7.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/shawnscode/crayon/issues/109"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/shawnscode/crayon/commit/c2fde19caf6149d91faa504263f0bc5cafc35de5"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/shawnscode/crayon"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2024-0018.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-908" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-04-05T15:40:40Z",
    "nvd_published_at" : null
  }
}