Security Vulnerability Report
中文
CVE-2026-32740 CVSS 8.8 HIGH

CVE-2026-32740

Published: 2026-05-19 20:16:19
Last Modified: 2026-05-20 14:17:03

Description

libheif is a HEIF and AVIF file format decoder and encoder. Versions 1.21.2 and prior contain a heap-buffer-overflow (write) vulnerability in the grid tile compositing, allowing an attacker to write 64 bytes of fully attacker-controlled data past the end of a chroma plane heap allocation by crafting a HEIF/AVIF file with a 1×4 grid of odd-height tiles. The overflow is triggered during normal image decoding with default build configuration. The written bytes are chroma (Cb/Cr) pixel values from the attacking tile, giving the attacker full control over the overflow content. This issue has been fixed in version 1.22.0.

CVSS Details

CVSS Score
8.8
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Configurations (Affected Products)

cpe:2.3:a:struktur:libheif:*:*:*:*:*:*:*:* - VULNERABLE
libheif <= 1.21.2

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
import struct # Proof of Concept (Conceptual) for CVE-2026-32740 # This script demonstrates the logic to construct a malicious HEIF/AVIF file structure # that triggers the heap buffer overflow in libheif < 1.22.0 # The vulnerability is triggered by a 1x4 grid of odd-height tiles. def create_malicious_heif(filename): with open(filename, 'wb') as f: # HEIF File Header (ftyp) f.write(b'\x00\x00\x00\x20ftypheic') # ... (Complex HEIF structure omitted for brevity) ... # Conceptual Grid Image Item Box construction # The goal is to define a grid with 1 row and 4 columns # where tile heights are odd numbers (e.g., 5x5, 5x5, 5x5, 5x5) # This configuration triggers the 64-byte chroma overflow. grid_height = 5 # Odd height grid_width = 5 # Width rows = 1 columns = 4 # Writing the grid item properties (simplified) # In a real exploit, precise offsets and box sizes are required. print(f"Constructing malicious grid: {rows}x{columns}, Tile Size: {grid_width}x{grid_height}") print(f"Writing to: {filename}") print("Note: This is a conceptual stub. A real file requires valid ISO Base Media File Format boxes.") if __name__ == "__main__": create_malicious_heif("exploit.heic")

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-32740", "sourceIdentifier": "[email protected]", "published": "2026-05-19T20:16:18.917", "lastModified": "2026-05-20T14:17:02.530", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "libheif is a HEIF and AVIF file format decoder and encoder. Versions 1.21.2 and prior contain a heap-buffer-overflow (write) vulnerability in the grid tile compositing, allowing an attacker to write 64 bytes of fully attacker-controlled data past the end of a chroma plane heap allocation by crafting a HEIF/AVIF file with a 1×4 grid of odd-height tiles. The overflow is triggered during normal image decoding with default build configuration. The written bytes are chroma (Cb/Cr) pixel values from the attacking tile, giving the attacker full control over the overflow content. This issue has been fixed in version 1.22.0."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "baseScore": 8.8, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "REQUIRED", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "HIGH"}, "exploitabilityScore": 2.8, "impactScore": 5.9}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-787"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:struktur:libheif:*:*:*:*:*:*:*:*", "versionEndExcluding": "1.22.0", "matchCriteriaId": "CB01CAAF-1D64-461B-8CC0-3CF2FBAC60A5"}]}]}], "references": [{"url": "https://github.com/strukturag/libheif/releases/tag/v1.22.0", "source": "[email protected]", "tags": ["Release Notes"]}, {"url": "https://github.com/strukturag/libheif/security/advisories/GHSA-frfr-f3vg-2g6j", "source": "[email protected]", "tags": ["Exploit", "Vendor Advisory"]}, {"url": "https://github.com/strukturag/libheif/security/advisories/GHSA-frfr-f3vg-2g6j", "source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "tags": ["Exploit", "Vendor Advisory"]}]}}