CVE-2026-32741: CWE-122: Heap-based Buffer Overflow in strukturag libheif
libheif is a HEIF and AVIF file format decoder and encoder. Versions 1.21.2 and below contain a heap buffer overflow in MaskImageCodec::decode_mask_image(). When decoding a HEIF file containing a mask image (mski), the function copies the full iloc extent data into a pixel buffer using memcpy(dst, data.data(), data.size()). The copy length data.size() is determined by the iloc extent in the file (attacker-controlled), while the destination buffer is sized based on the declared image dimensions. Because no upper-bound check exists on the data length, a crafted file whose iloc extent exceeds the pixel buffer allocation overflows the heap. The vulnerable single-memcpy branch is reached when the mskC property specifies bits_per_pixel = 8 and the ispe property declares an even width ≥ 64 (so that stride == width), with no changes to default security limits or external codec plugins required. This issue has been fixed in version 1.22.0.
AI Analysis
Technical Summary
CVE-2026-32741 is a heap-based buffer overflow vulnerability in the libheif library, specifically in the MaskImageCodec::decode_mask_image() function. When decoding a HEIF file with a mask image (mski), the function copies data using memcpy without an upper-bound check on the data length. The length is derived from the iloc extent in the file, which is attacker-controlled, while the destination buffer size is based on declared image dimensions. This mismatch can cause a heap overflow if the iloc extent exceeds the pixel buffer allocation. The vulnerable code path is triggered when the mskC property specifies bits_per_pixel = 8 and the ispe property declares an even width of at least 64. This vulnerability affects libheif versions prior to 1.22.0 and has been fixed in version 1.22.0.
Potential Impact
An attacker can craft a malicious HEIF file that triggers a heap-based buffer overflow during decoding, potentially leading to denial of service or other impacts related to memory corruption. The CVSS v3.1 score is 7.1 (high), indicating a network attack vector with low attack complexity, no privileges required, user interaction required, unchanged scope, no confidentiality impact, limited integrity impact, and high availability impact.
Mitigation Recommendations
This vulnerability is fixed in libheif version 1.22.0. Users should upgrade to version 1.22.0 or later to remediate this issue. Patch status is not explicitly stated in the vendor advisory excerpt, but the description confirms the fix in 1.22.0. No additional mitigations are indicated by the vendor advisory.
CVE-2026-32741: CWE-122: Heap-based Buffer Overflow in strukturag libheif
Description
libheif is a HEIF and AVIF file format decoder and encoder. Versions 1.21.2 and below contain a heap buffer overflow in MaskImageCodec::decode_mask_image(). When decoding a HEIF file containing a mask image (mski), the function copies the full iloc extent data into a pixel buffer using memcpy(dst, data.data(), data.size()). The copy length data.size() is determined by the iloc extent in the file (attacker-controlled), while the destination buffer is sized based on the declared image dimensions. Because no upper-bound check exists on the data length, a crafted file whose iloc extent exceeds the pixel buffer allocation overflows the heap. The vulnerable single-memcpy branch is reached when the mskC property specifies bits_per_pixel = 8 and the ispe property declares an even width ≥ 64 (so that stride == width), with no changes to default security limits or external codec plugins required. This issue has been fixed in version 1.22.0.
CVSS v3.1
Score 7.1high
Affected software
pkg:github/strukturag/libheifRun on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
CVE-2026-32741 is a heap-based buffer overflow vulnerability in the libheif library, specifically in the MaskImageCodec::decode_mask_image() function. When decoding a HEIF file with a mask image (mski), the function copies data using memcpy without an upper-bound check on the data length. The length is derived from the iloc extent in the file, which is attacker-controlled, while the destination buffer size is based on declared image dimensions. This mismatch can cause a heap overflow if the iloc extent exceeds the pixel buffer allocation. The vulnerable code path is triggered when the mskC property specifies bits_per_pixel = 8 and the ispe property declares an even width of at least 64. This vulnerability affects libheif versions prior to 1.22.0 and has been fixed in version 1.22.0.
Potential Impact
An attacker can craft a malicious HEIF file that triggers a heap-based buffer overflow during decoding, potentially leading to denial of service or other impacts related to memory corruption. The CVSS v3.1 score is 7.1 (high), indicating a network attack vector with low attack complexity, no privileges required, user interaction required, unchanged scope, no confidentiality impact, limited integrity impact, and high availability impact.
Mitigation Recommendations
This vulnerability is fixed in libheif version 1.22.0. Users should upgrade to version 1.22.0 or later to remediate this issue. Patch status is not explicitly stated in the vendor advisory excerpt, but the description confirms the fix in 1.22.0. No additional mitigations are indicated by the vendor advisory.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-03-13T15:02:00.628Z
- Cvss Version
- 3.1
- State
- PUBLISHED
- Remediation Level
- null
- Vendor Advisory Urls
- [{"url":"https://access.redhat.com/security/cve/CVE-2026-32741","vendor":"Red Hat"}]
Threat ID: 6a0cc91dba1db47362ec07c7
Added to database: 05/19/2026, 20:33:33 UTC
Last enriched: 07/15/2026, 08:56:27 UTC
Last updated: 07/31/2026, 19:22:58 UTC
Views: 70
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.