CVE-2026-66040 FFmpeg Heap Out-of-Bounds Write via PNG/APNG eXIf Encoder

High 8.7 Published Updated

Remote attackers can achieve arbitrary code execution or crash the application by supplying a crafted PNG image with a malicious eXIf chunk to FFmpeg.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2026-66040?

CVE-2026-66040 is a high-severity memory corruption vulnerability in Ffmpeg Ffmpeg, published on 24 Jul 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

Official description

FFmpeg through 8.1.2, fixed in commit b506faf, contains a heap out-of-bounds write vulnerability in the native PNG and APNG encoders that allows remote attackers to corrupt heap memory by supplying a crafted PNG image with a malicious eXIf chunk. Attackers can craft an eXIf chunk where multiple IFD entries reference the same large value payload, causing canonical serialization to expand the output far beyond the undersized allocation estimated by add_exif_profile_size(), resulting in png_write_chunk() writing tens of thousands of bytes past the buffer boundary, leading to deterministic heap corruption, process crash, and potentially arbitrary code execution.

Weakness: CWE-122

Which versions are affected by CVE-2026-66040?

It affects 1 product.

Products include Ffmpeg Ffmpeg.

How do I fix CVE-2026-66040?

Apply the vendor's patch.

Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.

Is CVE-2026-66040 being exploited?

There is no known exploitation of CVE-2026-66040 in the wild and no public exploit code.

All Ffmpeg Ffmpeg vulnerabilities

Sources

Also known as DEBIAN-CVE-2026-66040, GHSA-6vcg-882j-82v5, JLSEC-2026-1186, MINI-pf39-4f2g-674f, UBUNTU-CVE-2026-66040.

Is CVE-2026-66040 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free