GHSA-9q78-27f3-2jmh: Webp Webp Crate May Expose Memory Vulnerability

MODERATE
CWE-125
Published
Advisory Summary

GHSA-9q78-27f3-2jmh is a MODERATE webp crate may expose memory vulnerability (CWE-125: Out-of-bounds Read) affecting Webp libraries in the crates.io ecosystem. The issue involves webp crate may expose memory contents when encoding an image. Remediation is available by upgrading affected packages to version 0.3.1.

GHSA-9q78-27f3-2jmh at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-9q78-27f3-2jmh
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-125: Out-of-bounds Read
Affected Product Webp
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix GHSA-9q78-27f3-2jmh

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

webp fixed: 0.3.1
Upgrade webp to 0.3.1
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 webp

How to Check if You Are Affected

To determine whether your application is affected by GHSA-9q78-27f3-2jmh, inspect your project dependencies for Webp:

inspect dependencies for webp

Analyze the terminal output to locate any version of Webp in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.3.1), 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-125: Out-of-bounds Read, where the product reads data past the end, or before the beginning, of the intended buffer. In Webp, 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

Affected versions of this crate did not check that the input slice passed to `"webp::Encoder::encode()` is large enough for the specified image dimensions. If the input slice is too short, the library will read out of bounds of the buffer and encode other memory contents as an image, resulting in memory exposure or a segmentation fault. The flaw was corrected in [pull request #44](https://github.com/jaredforth/webp/pull/44) by always validating the input buffer size when constructing the encoder.

GHSA-9q78-27f3-2jmh Affected Webp Versions

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

References

Frequently Asked Questions

What is GHSA-9q78-27f3-2jmh?
GHSA-9q78-27f3-2jmh is a security vulnerability in Webp involving webp crate may expose memory contents when encoding an image under CWE-125: Out-of-bounds Read.
Which Webp versions are affected?
Affected versions include releases prior to 0.3.1 across affected packages: webp.
What version fixes GHSA-9q78-27f3-2jmh?
Upgrading to 0.3.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is webp affected?
Yes, webp is affected in releases prior to 0.3.1. Upgrade your dependency to 0.3.1 or later.
What CWE is associated with GHSA-9q78-27f3-2jmh?
GHSA-9q78-27f3-2jmh is classified under CWE-125: Out-of-bounds Read (The product reads data past the end, or before the beginning, of the intended buffer.).
How can I check crates.io dependencies for GHSA-9q78-27f3-2jmh?
Run the dependency tree command: 'inspect dependencies for webp'. 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-9q78-27f3-2jmh",
  "modified" : "2025-08-29T20:30:04Z",
  "published" : "2025-08-29T20:30:04Z",
  "aliases" : [ ],
  "summary" : "webp crate may expose memory contents when encoding an image",
  "details" : "Affected versions of this crate did not check that the input slice passed to `\"webp::Encoder::encode()` is large enough for the specified image dimensions.\n\nIf the input slice is too short, the library will read out of bounds of the buffer and encode other memory contents as an image, resulting in memory exposure or a segmentation fault.\n\nThe flaw was corrected in [pull request #44](https://github.com/jaredforth/webp/pull/44) by always validating the input buffer size when constructing the encoder.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:U"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "webp"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.3.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/jaredforth/webp/issues/40"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jaredforth/webp/pull/44"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jaredforth/webp/commit/62b47060d7fb8cc0e92e522ee54948edf5aab556"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/jaredforth/webp"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2024-0443.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-125" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-08-29T20:30:04Z",
    "nvd_published_at" : null
  }
}