Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2026-47251

CVE-2026-47251: libheif Use-After-Free Vulnerability

CVE-2026-47251 is a use-after-free flaw in libheif that allows attackers to trigger out-of-bounds heap reads via crafted HEIF files. This article covers technical details, affected versions, impact, and mitigation.

Published:

CVE-2026-47251 Overview

CVE-2026-47251 is an integer overflow vulnerability in libheif, an open-source HEIF and AVIF file format decoder and encoder. The flaw resides in the security check introduced by the fix for CVE-2026-3949 (commit b97c8b5, PR #1712). Attackers can bypass the check using a crafted HEIF file containing a Versatile Video Coding (VVC) track, triggering the same out-of-bounds heap read the earlier patch attempted to prevent. The vulnerability is classified as [CWE-125] Out-of-Bounds Read. Version 1.22.0 resolves the issue.

Critical Impact

A crafted HEIF file with a VVC track can bypass the patched boundary check, causing an out-of-bounds heap read in applications parsing untrusted image files.

Affected Products

  • libheif versions containing commit b97c8b5 prior to 1.22.0
  • Applications embedding vulnerable libheif for HEIF/AVIF decoding
  • Downstream distributions shipping affected libheif builds

Discovery Timeline

  • 2026-07-21 - CVE-2026-47251 published to the National Vulnerability Database (NVD)
  • 2026-07-22 - Last updated in NVD database

Technical Details for CVE-2026-47251

Vulnerability Analysis

The vulnerability affects libheif's handling of VVC track metadata inside HEIF containers. The maintainers introduced a bounds check in commit b97c8b5 to remediate CVE-2026-3949, an out-of-bounds heap read. However, the added arithmetic can overflow a 32-bit unsigned integer when size approaches UINT32_MAX, so the comparison silently produces a value that satisfies the safety condition. Once the check passes, the decoder reads past the end of the allocated heap buffer while processing the VVC track. The out-of-bounds read can expose adjacent heap memory or crash the parsing process, depending on the allocator state.

Root Cause

The root cause is an integer overflow in the very validation logic that was meant to prevent CVE-2026-3949. Issue #1712 was closed as fixed without covering the edge case where size is near UINT32_MAX. Because the overflow bypasses the check, the original out-of-bounds heap read remains reachable through a crafted VVC track.

Attack Vector

Exploitation requires an attacker to deliver a malformed HEIF file to a target that parses it with a vulnerable libheif build. User interaction is required, such as opening an image in a viewer, gallery, or thumbnailer that links libheif. The attack vector is local, and the primary impact is information disclosure through the out-of-bounds read and potential process termination. See the GitHub Security Advisory GHSA-p6q9-fhf2-vj9v for technical details.

Detection Methods for CVE-2026-47251

Indicators of Compromise

  • Unexpected crashes or segmentation faults in processes that decode HEIF or AVIF files
  • HEIF files containing VVC tracks with size fields near UINT32_MAX
  • Repeated parsing failures logged by applications embedding libheif

Detection Strategies

  • Inventory installed libheif versions across endpoints and servers, flagging any build earlier than 1.22.0
  • Perform static analysis of container images and software bills of materials (SBOMs) to detect vulnerable libheif dependencies
  • Sandbox HEIF parsing and monitor for out-of-bounds reads using AddressSanitizer (ASan) in test environments

Monitoring Recommendations

  • Alert on crash telemetry from image viewers, gallery services, and thumbnail generators that link libheif
  • Log HEIF and AVIF file uploads to web applications and inspect for anomalous size fields
  • Track upstream advisories from the strukturag/libheif repository for follow-on fixes

How to Mitigate CVE-2026-47251

Immediate Actions Required

  • Upgrade libheif to version 1.22.0 or later on all systems that decode HEIF or AVIF content
  • Rebuild and redeploy applications, containers, and packages that statically link libheif
  • Restrict processing of untrusted HEIF and AVIF files until patched builds are deployed

Patch Information

libheif version 1.22.0 patches the integer overflow in the VVC size validation added by commit b97c8b5. Review the GitHub Issue Discussion and the GitHub Security Advisory for remediation guidance and downstream package updates.

Workarounds

  • Disable HEIF and AVIF decoding in applications that do not require these formats
  • Route HEIF and AVIF processing through isolated sandboxes or dedicated parsing services
  • Block inbound HEIF and AVIF attachments at email and web gateways where feasible until patches are applied

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

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

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.