/

CVE-2026-47247

Severity:

HIGH RISK

(7.5)

Heap Data Exposure (CWE-200) via libheif Grid Decoding

CVE-2026-47247

Analyzed

Vulnerability type

Category:

Information Disclosure

CWE:

CWE-200, CWE-226, CWE-682, CWE-908

Impact:

Exposure of sensitive heap memory contents

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A heap data exposure vulnerability in libheif causes chunks of process memory to be rendered as pixel values when decoding crafted HEIF/AVIF grid images.

When such images are processed by server-side or local image tooling, an attacker can download the transcoded output (JPEG/PNG/WebP) and recover sensitive heap contents, including pointers that weaken ASLR and other secrets.

Affected context

The vulnerability arises in environments that decode HEIF/AVIF images using libheif, especially when grid images are supported and transcoded into other formats.

It is most relevant for server-side image processing pipelines (e.g., CMS platforms, image optimization services, thumbnail generators) that automatically convert user-supplied AVIF/HEIC content into publicly accessible formats.

Local desktop or command-line tools that rely on libheif for viewing or converting HEIF/AVIF content are also affected when they process attacker-controlled files.

Exploit preconditions

  • Attack surface: Any workflow that decodes and re-encodes AVIF/HEIC images using libheif, including web services, batch converters, and local tools.
  • Required access: Ability for the attacker to supply or upload a crafted HEIF/AVIF grid image to the target processing pipeline.
  • Trigger point: Image decoding of the malicious grid through libheif, followed by encoding to a standard format (JPEG, PNG, WebP, etc.) and making the output available or viewable.
  • Why exploitation is possible: Bugs in how libheif handles grid images cause uninitialized or stale heap regions to be interpreted as color data, turning sensitive memory into visual output that can be sampled and reconstructed offline.

Why this happens

At its core, this issue stems from improper handling of internal buffers and grid image composition logic within libheif, causing process heap regions to be treated as valid pixel data.

This maps to CWE-200: Exposure of Sensitive Information, with related aspects of CWE-226: Sensitive Information Uncleared Before Reuse of Resource, and CWE-908: Use of Uninitialized Resource, where image buffers are not correctly initialized or sanitized before being exposed.

The flaws mean that certain decoding paths mix or propagate unintended memory contents into the final image, turning the transcoding process into a side-channel for leaking heap state and implementation details such as code pointers.

Potential impact

  • Attackers may recover heap-resident pointers and structures sufficient to significantly reduce or defeat ASLR protections.
  • Attackers could extract application secrets present in heap memory, such as tokens, keys, or session-related data, if they reside near image buffers.
  • Information leaks can facilitate chaining with other memory corruption bugs to achieve more reliable exploitation (e.g., remote code execution).
  • Local tools processing malicious images may inadvertently expose sensitive in-memory data through saved or shared converted images.

General mitigation guidance

Mitigation focuses on hardening image decoding paths and reducing the trust placed in decoded pixel data originating from untrusted images.

Recommended patterns include:

  • Ensuring all image buffers and intermediate structures are fully initialized before use, especially in grid or tiling operations.
  • Clearing or overwriting temporary buffers that might contain sensitive data before they are reused for pixel storage.
  • Isolating image processing into restricted, minimal-privilege contexts or sandboxed helper processes to reduce the sensitivity of leaked memory.
  • Treating user-supplied HEIF/AVIF input as potentially hostile and avoiding exposing raw decoded output without normalization or validation steps.
  • Applying defense-in-depth measures such as strict memory safety practices around complex image composition code paths.

How teams detect issues like this

Effective detection typically combines code-focused and behavior-focused approaches:

  • Static analysis rules and manual reviews targeting use of uninitialized buffers, incomplete initialization patterns, and memory reuse in image composition code.
  • Inspection of grid-image handling logic for assumptions about buffer contents, plus tests that intentionally exercise edge cases (e.g., oversized grids, sparse tiles).
  • Dynamic analysis using crafted test images to observe whether uninitialized or stale memory regions appear in decoded output under various configurations.
  • Security-focused CI checks and fuzzing campaigns against libheif-based decoding pipelines to surface unexpected memory disclosure behavior.

Sources

SourceLink
github.comgithub.com/strukturag/libheif/security/advisories/GHSA-2vh6-whr3-cmq3

Frequently asked

questions

It is broadly exploitable wherever user-supplied HEIF/AVIF images are automatically processed and transcoded using libheif, especially on web platforms that publish converted images. Attackers only need an upload or ingestion path for their crafted files.

No elevated privileges are required. The attacker simply needs the ability to get a malicious HEIF/AVIF image decoded by a libheif-using tool or service, such as uploading to a CMS or feeding it to a batch converter.

The safest general approach is to ensure that all image-related buffers are fully initialized, never reused without clearing, and that decoding logic cannot propagate unintended memory contents to output. Leveraging strict memory hygiene and, where possible, memory-safe implementations for complex image operations is key.

Preventive strategies include embedding memory-safety checks into development workflows, applying fuzzing to image formats and grid features, enforcing code review attention on buffer management, and isolating image processing components in minimal-privilege, sandboxed environments to limit the value of any leaked memory.

Find out what's already
exploitable in your codebase.