Skip to main content
Vulnerability Database/CVE-2025-32025

CVE-2025-32025: bep/imagemeta Go Library DOS Vulnerability

CVE-2025-32025 is a denial-of-service vulnerability in bep/imagemeta Go library affecting PNG and WebP metadata parsing. Unbounded memory allocation could enable DOS attacks. This article covers technical details, impact, and mitigation.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2025-32025 Overview

CVE-2025-32025 is an unbounded resource allocation vulnerability [CWE-770] in bep/imagemeta, a Go library for reading EXIF, IPTC, and XMP metadata from JPEG, TIFF, PNG, and WebP images. The library's buffer for parsing PNG and WebP metadata was bounded only by the input data type, allowing attackers to trigger large memory allocations by crafting images with oversized metadata length fields. Processing untrusted images with versions prior to v0.11.0 can lead to denial-of-service conditions through memory exhaustion. Version v0.11.0 introduced a 10 MB upper limit on buffer allocation.

Critical Impact

Applications using bep/imagemeta to parse untrusted PNG or WebP images may suffer denial-of-service through excessive memory allocation driven by attacker-controlled length fields.

Affected Products

  • bep/imagemeta Go library versions prior to v0.11.0
  • Applications parsing PNG metadata via the affected library
  • Applications parsing WebP metadata via the affected library

Discovery Timeline

  • 2025-04-08 - CVE-2025-32025 published to NVD
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2025-32025

Vulnerability Analysis

The bep/imagemeta library parses metadata chunks from PNG and WebP files by reading a length field from the image stream and allocating a buffer of that size. Prior to v0.11.0, the only constraint on buffer size was the maximum value of the length field's data type. An attacker crafting a malicious PNG or WebP file with an oversized length value causes the library to attempt extremely large allocations.

For applications processing user-supplied images, this behavior enables denial-of-service through memory exhaustion. The attack requires no authentication and executes entirely within the parsing routine, before any validation of the actual data payload.

Root Cause

The bufferedReader function in io.go accepted a length parameter derived from untrusted image data without validating it against a reasonable upper bound. The missing size check allowed attackers to request allocations far exceeding any legitimate metadata size.

Attack Vector

Exploitation requires an application to parse an attacker-supplied PNG or WebP file. The attacker constructs an image where metadata chunk length fields specify very large values. When the library processes the file, it attempts to allocate a buffer matching the declared length, exhausting available memory and triggering the host process to crash or become unresponsive.

go
// Security patch in io.go - introduces a 10 MB buffer cap
return binary.BigEndian
}

// 10 MB should be plenty for image metadata.
const maxBufSize = 10 * 1024 * 1024

// bufferedReader reads length bytes from the stream and returns a ReaderCloser.
// It's important to call Close on the ReaderCloser when done.
func (e *streamReader) bufferedReader(length int64) (readerCloser, error) {
    if length > maxBufSize {
        return nil, newInvalidFormatErrorf("length %d exceeds max %d", length, maxBufSize)
    }
    if length == 0 {
        return struct {
            io.ReadSeeker

Source: GitHub commit ee0de9b

Detection Methods for CVE-2025-32025

Indicators of Compromise

  • Sudden spikes in resident memory for processes that invoke bep/imagemeta to parse images
  • Repeated process crashes or out-of-memory kills in image-processing services
  • Inbound PNG or WebP files with abnormally large declared chunk lengths relative to file size

Detection Strategies

  • Inventory Go applications and container images for bep/imagemeta dependencies below v0.11.0 using software composition analysis (SCA) tooling
  • Enable Go runtime memory telemetry and alert on allocation anomalies in image parsing workers
  • Inspect ingress image files for chunk length fields that exceed the 10 MB threshold enforced by the patch

Monitoring Recommendations

  • Monitor cgroup and container OOM-kill events on services that process user-uploaded images
  • Track latency and memory metrics for image upload endpoints and alert on outliers
  • Log and review failed image parse operations returning invalid format errors introduced in v0.11.0

How to Mitigate CVE-2025-32025

Immediate Actions Required

  • Upgrade bep/imagemeta to v0.11.0 or later in all Go modules and rebuild affected binaries
  • Audit application code paths that pass untrusted images into the library and prioritize those exposed to external users
  • Apply resource limits (memory cgroups, Go GOMEMLIMIT) to processes handling untrusted image uploads

Patch Information

The fix was committed to bep/imagemeta and released in v0.11.0. It introduces a maxBufSize constant of 10 MB and rejects any requested buffer length that exceeds this value in bufferedReader. Details are published in GitHub Security Advisory GHSA-fmhh-rw3h-785m and the corresponding patch commit.

Workarounds

  • Reject or pre-validate PNG and WebP uploads at the application boundary, enforcing maximum file sizes before parsing
  • Isolate image parsing in a separate process or container with strict memory limits to contain denial-of-service impact
  • Avoid processing images from untrusted sources until the library is upgraded to v0.11.0
bash
# Upgrade the dependency in a Go module
go get github.com/bep/imagemeta@v0.11.0
go mod tidy

# Verify the resolved version
go list -m github.com/bep/imagemeta

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.