GHSA-ppjr-267j-5p9x: Stb image NULL Pointer Derefernce Vulnerability

MODERATE
CWE-476
Published
Advisory Summary

GHSA-ppjr-267j-5p9x is a MODERATE null pointer derefernce vulnerability (CWE-476: NULL Pointer Dereference) affecting Stb image libraries in the crates.io ecosystem. The issue involves null pointer derefernce in `stb_image`. Remediation is available by upgrading affected packages to version 0.2.5.

GHSA-ppjr-267j-5p9x at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-ppjr-267j-5p9x
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-476: NULL Pointer Dereference
Affected Product Stb image
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix GHSA-ppjr-267j-5p9x

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

stb_image fixed: 0.2.5
Upgrade stb_image to 0.2.5
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 stb_image

How to Check if You Are Affected

To determine whether your application is affected by GHSA-ppjr-267j-5p9x, inspect your project dependencies for Stb image:

inspect dependencies for stb_image

Analyze the terminal output to locate any version of Stb image in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.2.5), 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-476: NULL Pointer Dereference, where the product dereferences a pointer that it expects to be valid but is null. In Stb image, 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

A bug in error handling in the `stb_image` C library could cause a NULL pointer dereference when attempting to load an invalid or unsupported image file. This is fixed in version 0.2.5 and later of the `stb_image` Rust crate, by patching the C code to correctly handle NULL pointers.

GHSA-ppjr-267j-5p9x Affected Stb image Versions

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

References

Frequently Asked Questions

What is GHSA-ppjr-267j-5p9x?
GHSA-ppjr-267j-5p9x is a security vulnerability in Stb image involving NULL pointer derefernce in `stb_image` under CWE-476: NULL Pointer Dereference.
Which Stb image versions are affected?
Affected versions include releases prior to 0.2.5 across affected packages: stb_image.
What version fixes GHSA-ppjr-267j-5p9x?
Upgrading to 0.2.5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is stb_image affected?
Yes, stb_image is affected in releases prior to 0.2.5. Upgrade your dependency to 0.2.5 or later.
What CWE is associated with GHSA-ppjr-267j-5p9x?
GHSA-ppjr-267j-5p9x is classified under CWE-476: NULL Pointer Dereference (The product dereferences a pointer that it expects to be valid but is NULL.).
How can I check crates.io dependencies for GHSA-ppjr-267j-5p9x?
Run the dependency tree command: 'inspect dependencies for stb_image'. 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-ppjr-267j-5p9x",
  "modified" : "2023-07-19T19:19:42Z",
  "published" : "2023-03-20T21:11:58Z",
  "aliases" : [ ],
  "summary" : "NULL pointer derefernce in `stb_image`",
  "details" : "A bug in error handling in the `stb_image` C library could cause a NULL pointer dereference when attempting to load an invalid or unsupported image file.  This is fixed in version 0.2.5 and later of the `stb_image` Rust crate, by patching the C code to correctly handle NULL pointers.\n",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "stb_image"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.2.5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/servo/rust-stb-image/pull/102"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/servo/rust-stb-imag"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2023-0021.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-476" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-03-20T21:11:58Z",
    "nvd_published_at" : null
  }
}