# CVE-2026-62291: Memory corruption in libheif

> A heap out-of-bounds write in libheif allows attackers to corrupt memory and potentially execute code via crafted image files.

- **Severity:** Medium 5.3 (`CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 18 Aug 2026
- **Updated:** 21 Aug 2026
- **Also known as:** BELL-CVE-2026-62291, DEBIAN-CVE-2026-62291, ECHO-9d99-9ed1-60b7, GHSA-xpw3-9rhw-482x, MINI-p699-fc2q-h228, UBUNTU-CVE-2026-62291

## What is CVE-2026-62291?

CVE-2026-62291 is a medium-severity memory corruption vulnerability in strukturag libheif, published on 18 Aug 2026. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official description

libheif is a HEIF and AVIF file format decoder and encoder. In 1.23.0 and earlier, a crafted image sequence with a 2x2 primary plane and a 256x256 auxiliary alpha plane can cause attacker-controlled heap corruption during a normal decode and re-encode workflow. Track_Visual::decode_next_image_sample() calls transfer_channel_from_image_as() without checking that the auxiliary alpha dimensions match the main frame. The resulting inconsistent image reaches heif_track_decode_next_image() and then heif_context_encode_image(). In unc_encoder::encode(), unc_encoder_component_interleave::encode_tile() sizes its buffer with compute_tile_data_size_bytes() using the primary dimensions but copies each component using its actual plane dimensions. The oversized alpha plane is therefore copied beyond the allocation, causing an out-of-bounds write; the inverse size mismatch can also produce an out-of-bounds read. This issue is fixed in version 1.23.1.

Weakness: CWE-787 (Out-of-bounds Write), CWE-125 (Out-of-bounds Read)

## Which versions are affected by CVE-2026-62291?


## How do I fix CVE-2026-62291?

Upgrade to a fixed version.

## Is CVE-2026-62291 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-62291 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-62291 and fix it if it is affected.

What it is: CVE-2026-62291 is a medium-severity memory corruption vulnerability in strukturag libheif, published on 18 Aug 2026. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-62291 exists.

Affected product: strukturag libheif. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-62291/ (Markdown: https://insights.sbomify.com/CVE-2026-62291/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-62291
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-62291
- OSV: https://osv.dev/vulnerability/CVE-2026-62291

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-62291/
Summaries are generated and may contain mistakes; the official description above is the record.
